Different app instances use different log files???

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Different app instances use different log files???

ShadeOfRed
Hello,

I', in the need of guaranting that different instances of the same application work on different log files. Is there any *trick* in how I define the filename to be made to obtain such a result??? Consider that my application can eventually provide a unique application instance identifier ... but then I don't know how to make it available to NLog ....
Thx.


S.
Reply | Threaded
Open this post in threaded view
|

Re: Different app instances use different log files???

Jarek Kowalski
Administrator
I've just published a new set of snapshots with features which may be useful to you:

a) GDC - Global Diagnostics Context - modelled after MDC but there's a single instance for each application

To add a value there use: GDC.Set("xxx", "value");
To retrieve it use ${gdc:item=xxx}.

b) ${processname} and ${processid} to retrieve the name/ID of current process

Additionally, depending on your scenario, you might want to use ${threadid} which is also unique system-wide or ${guid} - but this one generates a new value each time it is evaluated.

The snapshot is located here:

http://nlog.sourceforge.net/snapshots/

Jarek
NLog Blog