public class MDC extends Object
NDC
class except that it is
based on a map instead of a stack. It provides mapped
diagnostic contexts. A Mapped Diagnostic Context, or
MDC in short, is an instrument for distinguishing interleaved log
output from different sources. Log output is typically interleaved
when a server handles multiple clients near-simultaneously.
The MDC is managed on a per thread basis. A child thread automatically inherits a copy of the mapped diagnostic context of its parent.
The MDC class requires JDK 1.2 or above. Under JDK 1.1 the MDC will always return empty values but otherwise will not affect or harm your application.
Modifier and Type | Field and Description |
---|---|
(package private) static int |
HT_SIZE |
(package private) boolean |
java1 |
(package private) static MDC |
mdc |
private Method |
removeMethod |
(package private) Object |
tlm |
Modifier | Constructor and Description |
---|---|
private |
MDC() |
Modifier and Type | Method and Description |
---|---|
static void |
clear()
Remove all values from the MDC.
|
private void |
clear0() |
static Object |
get(String key)
Get the context identified by the
key parameter. |
private Object |
get0(String key) |
static Hashtable |
getContext()
Get the current thread's MDC as a hashtable.
|
private Hashtable |
getContext0() |
static void |
put(String key,
Object o)
Put a context value (the
o parameter) as identified
with the key parameter into the current thread's
context map. |
private void |
put0(String key,
Object o) |
static void |
remove(String key)
Remove the the context identified by the
key
parameter. |
private void |
remove0(String key) |
static final int HT_SIZE
boolean java1
private Method removeMethod
private MDC()
public static void put(String key, Object o)
o
parameter) as identified
with the key
parameter into the current thread's
context map.
If the current thread does not have a context map it is created as a side effect.
public static Object get(String key)
key
parameter.
This method has no side effects.
public static void remove(String key)
key
parameter.public static Hashtable getContext()
public static void clear()
private Hashtable getContext0()
private void clear0()
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses