⚠️ NLog 5.0 introduces ScopeContext that replaces NDLC + NDC
Nested Diagnostics Context - a thread-local structure that keeps a stack of strings and provides methods to output them in layouts.
Platforms Supported: All
NDC is considered legacy, and instead is recommended to use NDLC that includes support for async Tasks. See also NLog Context
${ndc:bottomFrames=Integer:topFrames=Integer:separator=String}
-1
is no limit. Integer
. Default -1
.-1
is no limit. Integer
. Default -1
string
. Default
(space)NestedDiagnosticsContext.Push("entering method X"); ... // log here NestedDiagnosticsContext.Pop(); //leaving methods
Then in the log config:
logs entering method X
if logged between push()
and pop()
NestedDiagnosticsContext.Push("entering method X1"); NestedDiagnosticsContext.Push("entering method X2"); ... // log here NestedDiagnosticsContext.Pop(); //leaving method X2 NestedDiagnosticsContext.Pop(); //leaving method X1
logs entering method X1 entering method X2
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4