Class 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):
    Since:
    1.1.0
    Author:
    mark.petrenyi
    • Constructor Detail

      • MDC

        public MDC()
        Default constructor, constructs a new object.
    • Method Detail

      • put

        public static void put​(String key,
                               String val)
        Puts value into underlying MDC implementation.
        Parameters:
        key - MDC lookup key fro the value
        val - the value
      • get

        public static String get​(String key)
        Gets value for key or null from 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.