Class MDC
- java.lang.Object
-
- hu.icellmobilsoft.coffee.se.logging.mdc.MDC
-
public final class MDC extends Object
Mapped Diagnostic Context.
Internally uses an adapter in order to delegate calls to an existing MDC implementation on the classpath.
Default adapters are (in order of priority):
JbossMDCAdapter- for usingorg.jboss.logging.MDCSlf4jMDCAdapter- for usingorg.slf4j.MDCCoffeeMDCAdapter- fallback MDC, uses aThreadLocal
- Since:
- 1.1.0
- Author:
- mark.petrenyi
-
-
Constructor Summary
Constructors Constructor Description MDC()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidclear()Clears the underlying MDC implementation.static Stringget(String key)Gets value for key ornullfrom underlying MDC implementation.static Map<String,String>getMap()Returns the diagnostic context map from the underlying MDC implementation.static voidput(String key, String val)Puts value into underlying MDC implementation.static voidremove(String key)Removes the value for key from the underlying MDC implementation.
-
-
-
Method Detail
-
put
public static void put(String key, String val)
Puts value into underlying MDC implementation.- Parameters:
key- MDC lookup key fro the valueval- the value
-
get
public static String get(String key)
Gets value for key ornullfrom underlying MDC implementation.- Parameters:
key- MDC lookup key- Returns:
- the value or
null
-
remove
public static void remove(String key)
Removes the value for key from the underlying MDC implementation.- Parameters:
key- MDC lookup key
-
getMap
public static Map<String,String> getMap()
Returns the diagnostic context map from the underlying MDC implementation.- Returns:
- the MDC map
-
clear
public static void clear()
Clears the underlying MDC implementation.
-
-