mirror of https://github.com/apache/activemq.git
https://issues.apache.org/jira/browse/AMQ-3219 - adding missing MDCHelper class
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1082530 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2b456ddbd0
commit
cc810aa4da
|
@ -0,0 +1,28 @@
|
||||||
|
package org.apache.activemq.util;
|
||||||
|
|
||||||
|
import org.slf4j.MDC;
|
||||||
|
|
||||||
|
import java.util.Hashtable;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper class as MDC Log4J adapter doesn't behave well with null values
|
||||||
|
*/
|
||||||
|
public class MDCHelper {
|
||||||
|
|
||||||
|
public static Map getCopyOfContextMap() {
|
||||||
|
Map map = MDC.getCopyOfContextMap();
|
||||||
|
if (map == null) {
|
||||||
|
map = new Hashtable();
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setContextMap(Map map) {
|
||||||
|
if (map == null) {
|
||||||
|
map = new Hashtable();
|
||||||
|
}
|
||||||
|
MDC.setContextMap(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue