Class Log4jMDCAdapter

java.lang.Object
org.slf4j.log4j12.Log4jMDCAdapter
All Implemented Interfaces:
MDCAdapter

public class Log4jMDCAdapter extends Object implements MDCAdapter
  • Constructor Details

    • Log4jMDCAdapter

      public Log4jMDCAdapter()
  • Method Details

    • clear

      public void clear()
      Specified by:
      clear in interface MDCAdapter
    • get

      public String get(String key)
      Specified by:
      get in interface MDCAdapter
    • put

      public void put(String key, String val)
      Put a context value (the val parameter) as identified with the key parameter into the current thread's context map. The key parameter cannot be null. Log4j does not support null for the val parameter.

      This method delegates all work to log4j's MDC.

      Specified by:
      put in interface MDCAdapter
      Throws:
      IllegalArgumentException - in case the "key" or "val" parameter is null
    • remove

      public void remove(String key)
      Specified by:
      remove in interface MDCAdapter
    • getCopyOfContextMap

      public Map getCopyOfContextMap()
      Specified by:
      getCopyOfContextMap in interface MDCAdapter
    • setContextMap

      public void setContextMap(Map<String,​String> contextMap)
      Specified by:
      setContextMap in interface MDCAdapter