Using NLog's MappedDiagnosticsContext with ServiceStack -
i'm using nlog servicestack service. i'd use nlog's mappeddiagnosticscontext append variable each log entry. in case, i'd generate unique identifier each request , have identifier logged log entries logged during request.
the servicestack.logging.ilog
interface (or other servicestack logging class matter) doesn't seem support this.
i can nlog.mappeddiagnosticscontext.set("somekey", "some value")
. works ties me nlog (i'm not worried though).
two questions:
- is there better way servicestack.
- is safe assume values set nlog's mappeddiagnosticscontext scoped request?
i'm planning use mappeddiagnosticscontext these purposes:
eventid's event log targets: ${mdc:item=eventid}. had been considering using eventcontext property instead, changes way have log items.
sessionid's other targets when logging asp.net code: ${mdc:item=sessionid} since ${aspnet-sessionid} way doesn't seem work correctly non-asp code nlog 2.0.1.0 nuget.
my tests show these cases make sense purposes.
Comments
Post a Comment