You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NLog has the GlobalDiagnosticsContext and the MappedDiagnosticsContext.
The MappedDiagnosticsContext stores the dictionary in the thread locall storage, which it does not flow in async points. For example, if I am using the async/await pattern in my web application, and I want to log a specific property (being set in the begining of the request processing), in all my log statements, if I use the MaapedDiagnosticsContext, I will lose the property in logs as soon the request jump to another thread.
Looks like a nice addition to NLog. I would recommend that you created a pull request at the NLog-Contrib repository, then I'll make sure it get uploaded to NuGet. Please let me know if you need any help
NLog has the GlobalDiagnosticsContext and the MappedDiagnosticsContext.
The MappedDiagnosticsContext stores the dictionary in the thread locall storage, which it does not flow in async points. For example, if I am using the async/await pattern in my web application, and I want to log a specific property (being set in the begining of the request processing), in all my log statements, if I use the MaapedDiagnosticsContext, I will lose the property in logs as soon the request jump to another thread.
I've explained this problem in my blog: http://www.bfcamara.com/post/66886024762/nlog-how-to-include-custom-context-variables-in-all
Log4Net supports this scenario by using the log4net.ThreadLogicalContext
In my current project, I've implemented this feature, but before doing a PR, I would like to have some opinions.
Basically I've used the CallContext (instead of thread local storage), which flows in async points.
I also have a new Layout Render (mdlc - mapped diagnostics logical context)
What do you think?
The text was updated successfully, but these errors were encountered: