Package org.jboss.logmanager
Class MDC
- java.lang.Object
-
- org.jboss.logmanager.MDC
-
public final class MDC extends Object
Mapped diagnostic context. This is a thread-local map used to hold loggable information.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
clear()
Clear the current MDC map.static Map<String,String>
copy()
Get a copy of the MDC map.static Map<String,Object>
copyObject()
Get a copy of the MDC map.static String
get(String key)
Get the value for a key, ornull
if there is no mapping.static Object
getObject(String key)
Get the value for a key, ornull
if there is no mapping.static boolean
isEmpty()
Checks of the MDC map is empty.static String
put(String key, String value)
Set the value of a key, returning the old value (if any) ornull
if there was none.static Object
putObject(String key, Object value)
Set the value of a key, returning the old value (if any) ornull
if there was none.static String
remove(String key)
Remove a key.static Object
removeObject(String key)
Remove a key.
-
-
-
Method Detail
-
get
public static String get(String key)
Get the value for a key, ornull
if there is no mapping.- Parameters:
key
- the key- Returns:
- the value
-
getObject
public static Object getObject(String key)
Get the value for a key, ornull
if there is no mapping.- Parameters:
key
- the key- Returns:
- the value
-
put
public static String put(String key, String value)
Set the value of a key, returning the old value (if any) ornull
if there was none.- Parameters:
key
- the keyvalue
- the new value- Returns:
- the old value or
null
if there was none
-
putObject
public static Object putObject(String key, Object value)
Set the value of a key, returning the old value (if any) ornull
if there was none.- Parameters:
key
- the keyvalue
- the new value- Returns:
- the old value or
null
if there was none
-
remove
public static String remove(String key)
Remove a key.- Parameters:
key
- the key- Returns:
- the old value or
null
if there was none
-
removeObject
public static Object removeObject(String key)
Remove a key.- Parameters:
key
- the key- Returns:
- the old value or
null
if there was none
-
copy
public static Map<String,String> copy()
Get a copy of the MDC map. This is a relatively expensive operation.- Returns:
- a copy of the map
-
copyObject
public static Map<String,Object> copyObject()
Get a copy of the MDC map. This is a relatively expensive operation.- Returns:
- a copy of the map
-
isEmpty
public static boolean isEmpty()
Checks of the MDC map is empty.- Returns:
true
if the MDC map is empty, otherwisefalse
-
clear
public static void clear()
Clear the current MDC map.
-
-