1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.log4j;
18
19 import java.util.Hashtable;
20 import java.util.Map;
21
22 public class MDC {
23
24 public static void put(String key, String value) {
25 org.slf4j.MDC.put(key, value);
26 }
27
28 public static void put(String key, Object value) {
29 if (value != null) {
30 put(key, value.toString());
31 } else {
32 put(key, null);
33 }
34 }
35
36 public static Object get(String key) {
37 return org.slf4j.MDC.get(key);
38 }
39
40 public static void remove(String key) {
41 org.slf4j.MDC.remove(key);
42 }
43
44 public static void clear() {
45 org.slf4j.MDC.clear();
46 }
47
48
49
50
51
52
53
54
55 @SuppressWarnings({ "rawtypes", "unchecked" })
56 @Deprecated
57 public static Hashtable getContext() {
58 Map map = org.slf4j.MDC.getCopyOfContextMap();
59
60 if (map != null) {
61 return new Hashtable(map);
62 } else {
63 return new Hashtable();
64 }
65 }
66 }