Class Slf4jMDCAdapter

  • All Implemented Interfaces:
    MDCAdapter

    public class Slf4jMDCAdapter
    extends Object
    implements MDCAdapter
    MDC adapter for org.slf4j.MDC
    Since:
    1.1.0
    Author:
    mark.petrenyi
    • Constructor Detail

      • Slf4jMDCAdapter

        public Slf4jMDCAdapter()
                        throws Exception
        Slf4jMDCAdapter default constructor
        Throws:
        Exception - error
    • Method Detail

      • put

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

        public String get​(String key)
        Gets value for key or null from underlying MDC implementation.
        Specified by:
        get in interface MDCAdapter
        Parameters:
        key - MDC lookup key
        Returns:
        the value or null
      • remove

        public void remove​(String key)
        Removes the value for key from the underlying MDC implementation.
        Specified by:
        remove in interface MDCAdapter
        Parameters:
        key - MDC lookup key
      • getMap

        public Map<String,​String> getMap()
        Returns the diagnostic context map from the underlying MDC implementation.
        Specified by:
        getMap in interface MDCAdapter
        Returns:
        the MDC map
      • clear

        public void clear()
        Clears the underlying MDC implementation.
        Specified by:
        clear in interface MDCAdapter