-
-
Save qerub/d21af753dc2b41f84654 to your computer and use it in GitHub Desktop.
Add org.apache.log4j.MDC.getContext() to log4j-over-slf4j
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 5d80884..d16a7ba 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,15 @@ public class MDC { | |
public static void clear() { | |
org.slf4j.MDC.clear(); | |
} | |
+ | |
+ public static Hashtable getContext() { | |
+ Map map = org.slf4j.MDC.getCopyOfContextMap(); | |
+ | |
+ if (map != null) { | |
+ return new Hashtable(map); | |
+ } | |
+ else { | |
+ return new Hashtable(); | |
+ } | |
+ } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment