Package org.jboss.logging
Class MDC
- java.lang.Object
-
- org.jboss.logging.MDC
-
public final class MDC extends Object
Mapped diagnostic context. Each log provider implementation may behave different.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
clear()
Clears the message diagnostics context.static Object
get(String key)
Returns the value for the key ornull
if no value was found.static Map<String,Object>
getMap()
Returns the map from the context.static Object
put(String key, Object val)
Puts the value onto the context.static void
remove(String key)
Removes the value from the context.
-
-
-
Method Detail
-
put
public static Object put(String key, Object val)
Puts the value onto the context.- Parameters:
key
- the key for the valueval
- the value- Returns:
- the previous value set or
null
if no value was set
-
get
public static Object get(String key)
Returns the value for the key ornull
if no value was found.- Parameters:
key
- the key to lookup the value for- Returns:
- the value or
null
if not found
-
remove
public static void remove(String key)
Removes the value from the context.- Parameters:
key
- the key of the value to remove
-
getMap
public static Map<String,Object> getMap()
Returns the map from the context.Note that in most implementations this is an expensive operation and should be used sparingly.
- Returns:
- the map from the context or an empty map if the context is
null
-
clear
public static void clear()
Clears the message diagnostics context.
-
-