Pushes a new context message.
Namespace: log4netAssembly: log4net (in log4net.dll) Version: 1.2.15.0 (1.2.15.0)
Syntax
Parameters
- message
- Type:
System.String
The new context message.
Return Value
Type:
An

Remarks
![]() |
---|
The NDC is deprecated and has been replaced by the Stacks. The current NDC implementation forwards to the ThreadContext.Stacks["NDC"]. |
Pushes a new context onto the context stack. An IDisposable
is returned that can be used to clean up the context stack. This
can be easily combined with the using keyword to scope the
context.
Examples
using(log4net.NDC.Push("NDC_Message")) { log.Warn("This should have an NDC message"); }
See Also