NLog icon indicating copy to clipboard operation
NLog copied to clipboard

Add support for .Net asynchronous/distributed thread tracking via ActivityId.

Open optimiz3 opened this issue 13 years ago • 4 comments

.Net supports logical thread ids for asynchronous operations that may execute over multiple thread pool threads. This is provided via the System.Diagnostics.Trace.CorrelationManager.ActivityId property. .Net always ensures the ActivityId gets propagated across Begin/End async calls as well as QueueUserWorkItem operations. It is often a best practice to also include the ActivityId over network RPC operations so the logical thread/operation can be tracked in a distributed system.

This commit adds the ActivityIdLayoutRenderer to simply write this value out if the user desires. It is derived from the original GuidLayoutRenderer. Much appreciated!

optimiz3 avatar Aug 09 '11 19:08 optimiz3

Wow, thanks - I never heard of this ActivityId property. It will probably turn out very useful for me some day :)

jkff avatar Aug 09 '11 22:08 jkff

Happy to help! It's incredibly useful when analyzing and merging massive amounts of logs from a cluster.

optimiz3 avatar Aug 09 '11 22:08 optimiz3

Yep, I'm actually using a thingie of my own for that; in case you're interested: https://github.com/jkff/greg , http://code.google.com/p/greg/ (with an NLog appender of course - however the .NET version belongs to my employer; only Java and Haskell I opensourced)

jkff avatar Aug 09 '11 22:08 jkff

Why hasn't this been merged?

dan-turner avatar Nov 04 '14 07:11 dan-turner