Class MDC


  • public class MDC
    extends Object
    Contains methods for MDC Logging. Delegates to the matching logging framework via LoggerFactory
    • Constructor Detail

      • MDC

        public MDC()
    • Method Detail

      • get

        public static Object get​(String key)
        Get the context value identified by key from the map.
        Parameters:
        key - identification key
        Returns:
        context value
      • put

        public static void put​(String key,
                               Object o)
        Puts the context value o which can be identified with key into the map.
        Parameters:
        key - identification key
        o - value to be put
      • remove

        public static void remove​(String key)
        Remove the context value identified by key from the map.
        Parameters:
        key - identification key
      • getCopy

        public static Map<String,​String> getCopy()
        Returns:
        a copy of the current thread's context map. Returned value may be null.
      • setMap

        public static void setMap​(Map<String,​String> map)
        Set content of parameter map as the new content of the current MDC map. If parameter is null, it will simply clear the map.
        Parameters:
        map - the instance to be set, or null.
      • clear

        public static void clear()
        Remove all values from the MDC.