Pushes a new context message into this stack.
An IDisposable that can be used to clean up the context stack.
Pushes a new context onto this stack. An IDisposable is returned that can be used to clean up this stack. This can be easily combined with the using
keyword to scope the context.
Simple example of using the Push
method with the using
keyword.
[C#]
using(log4net.ThreadContext.Stacks["NDC"].Push("Stack_Message"))
{
log.Warn("This should have an ThreadContext Stack message");
}
ThreadContextStack Class | log4net.Util Namespace