NDC SetMaxDepth Method | Apache log4net™ SDK Documentation

Forces the stack depth to be at most maxDepth.

Namespace: log4net
Assembly: log4net (in log4net.dll) Version: 2.0.8.0-.NET 4.0
Syntax

C#
VB
C++
F#
Copy

    public static void SetMaxDepth(
    	int maxDepth
    )

    Public Shared Sub SetMaxDepth (
    	maxDepth As Integer
    )

    public:
    static void SetMaxDepth(
    	int maxDepth
    )

    static member SetMaxDepth :
            maxDepth : int -> unit

#### Parameters

maxDepth
  Type: System
  Int32
  The maximum depth of the stack

Remarks

Note
The NDC is deprecated and has been replaced by the Stacks. The current NDC implementation forwards to the ThreadContext.Stacks["NDC"].

Forces the stack depth to be at most maxDepth. This may truncate the head of the stack. This only affects the stack in the current thread. Also it does not prevent it from growing, it only sets the maximum depth at the time of the call. This can be used to return to a known context depth.

See Also

#### Reference

NDC Class
log4net Namespace