diff --git a/log4j-over-slf4j/src/main/java/org/apache/log4j/MDC.java b/log4j-over-slf4j/src/main/java/org/apache/log4j/MDC.java index 5d808842..dbc96978 100644 --- a/log4j-over-slf4j/src/main/java/org/apache/log4j/MDC.java +++ b/log4j-over-slf4j/src/main/java/org/apache/log4j/MDC.java @@ -16,6 +16,9 @@ package org.apache.log4j; +import java.util.Hashtable; +import java.util.Map; + public class MDC { public static void put(String key, String value) { @@ -41,4 +44,21 @@ public class MDC { public static void clear() { org.slf4j.MDC.clear(); } + + /** + * This method is not part of the Log4J public API. However it + * has been called by other projects. This method is here temporarily + * until projects who are depending on this method release fixes. + */ + @Deprecated + public static Hashtable getContext() { + Map map = org.slf4j.MDC.getCopyOfContextMap(); + + if (map != null) { + return new Hashtable(map); + } + else { + return new Hashtable(); + } + } }