Top Description Fields Constructors Methods
org.jboss.logmanager

public final Class NDC

extends Object
Class Inheritance
Imports
java.security.AccessController, .PrivilegedAction, java.util.Iterator, .ServiceConfigurationError, .ServiceLoader

Nested diagnostic context. This is basically a thread-local stack that holds a string which can be included in a log message.

Field Summary

Modifier and TypeField and Description
private static final NDCProvider

Constructor Summary

AccessConstructor and Description
private
NDC()

Method Summary

Modifier and TypeMethod and Description
public static void
clear()

Clear the thread's NDC stack.

pack-priv static NDCProvider
public static String

Returns:

the current NDC value, or "" if there is none
get
()

Get the current NDC value.

public static String

Returns:

the value or null if there is none
get
(int
the index
n
)

Provided for compatibility with log4j.

pack-priv static NDCProvider
public static int

Returns:

the stack depth
getDepth
()

Get the current NDC stack depth.

pack-priv static NDCProvider
public static String

Returns:

the old topmost value
pop
()

Pop the topmost value from the NDC stack and return it.

public static int

Returns:

the new stack depth
push
(String
the new value
context
)

Push a value on to the NDC stack, returning the new stack depth which should later be used to restore the stack.

public static void
trimTo(int
the new size
size
)

Trim the thread NDC stack down to no larger than the given size.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ndcProviderback to summary
private static final NDCProvider ndcProvider

Constructor Detail

NDCback to summary
private NDC()

Method Detail

clearback to summary
public static void clear()

Clear the thread's NDC stack.

doGetDefaultNDCProviderback to summary
pack-priv static NDCProvider doGetDefaultNDCProvider()
getback to summary
public static String get()

Get the current NDC value.

Returns:String

the current NDC value, or "" if there is none

getback to summary
public static String get(int n)

Provided for compatibility with log4j. Get the NDC value that is n entries from the bottom.

Parameters
n:int

the index

Returns:String

the value or null if there is none

getDefaultNDCProviderback to summary
pack-priv static NDCProvider getDefaultNDCProvider()
getDepthback to summary
public static int getDepth()

Get the current NDC stack depth.

Returns:int

the stack depth

getNDCProviderback to summary
pack-priv static NDCProvider getNDCProvider()
popback to summary
public static String pop()

Pop the topmost value from the NDC stack and return it.

Returns:String

the old topmost value

pushback to summary
public static int push(String context)

Push a value on to the NDC stack, returning the new stack depth which should later be used to restore the stack.

Parameters
context:String

the new value

Returns:int

the new stack depth

trimToback to summary
public static void trimTo(int size)

Trim the thread NDC stack down to no larger than the given size. Used to restore the stack to the depth returned by a push().

Parameters
size:int

the new size