public String get(String key) { return (String) org.apache.log4j.MDC.get(key); }
public Object getMdc(String key) { return MDC.get( key ); }
@Override protected String get(String key) { Object result = MDC.get(key); return result instanceof String ? (String) result : null; }
public Object getMdc(String key) { return MDC.get(key); }
/** Returns the the context corresponding to the <code>key</code> parameter. If there is a local MDC copy, possibly because we are in a logging server or running inside AsyncAppender, then we search for the key in MDC copy, if a value is found it is returned. Otherwise, if the search in MDC copy returns a null result, then the current thread's <code>MDC</code> is used. <p>Note that <em>both</em> the local MDC copy and the current thread's MDC are searched. */ public Object getMDC(String key) { Object r; // Note the mdcCopy is used if it exists. Otherwise we use the MDC // that is associated with the thread. if(mdcCopy != null) { r = mdcCopy.get(key); if(r != null) { return r; } } return MDC.get(key); }
/** Returns the the context corresponding to the <code>key</code> parameter. If there is a local MDC copy, possibly because we are in a logging server or running inside AsyncAppender, then we search for the key in MDC copy, if a value is found it is returned. Otherwise, if the search in MDC copy returns a null result, then the current thread's <code>MDC</code> is used. <p>Note that <em>both</em> the local MDC copy and the current thread's MDC are searched. */ public Object getMDC(String key) { Object r; // Note the mdcCopy is used if it exists. Otherwise we use the MDC // that is associated with the thread. if(mdcCopy != null) { r = mdcCopy.get(key); if(r != null) { return r; } } return MDC.get(key); }
public Object putMdc(String key, Object val) { try { return MDC.get( key ); } finally { MDC.put( key, val ); } }
public Object putMdc(String key, Object val) { try { return MDC.get(key); } finally { MDC.put(key, val); } }
/** Returns the the context corresponding to the <code>key</code> parameter. If there is a local MDC copy, possibly because we are in a logging server or running inside AsyncAppender, then we search for the key in MDC copy, if a value is found it is returned. Otherwise, if the search in MDC copy returns a null result, then the current thread's <code>MDC</code> is used. <p>Note that <em>both</em> the local MDC copy and the current thread's MDC are searched. */ public Object getMDC(String key) { Object r; // Note the mdcCopy is used if it exists. Otherwise we use the MDC // that is associated with the thread. if(mdcCopy != null) { r = mdcCopy.get(key); if(r != null) { return r; } } return MDC.get(key); }
/** Returns the the context corresponding to the <code>key</code> parameter. If there is a local MDC copy, possibly because we are in a logging server or running inside AsyncAppender, then we search for the key in MDC copy, if a value is found it is returned. Otherwise, if the search in MDC copy returns a null result, then the current thread's <code>MDC</code> is used. <p>Note that <em>both</em> the local MDC copy and the current thread's MDC are searched. */ public Object getMDC(String key) { Object r; // Note the mdcCopy is used if it exists. Otherwise we use the MDC // that is associated with the thread. if(mdcCopy != null) { r = mdcCopy.get(key); if(r != null) { return r; } } return MDC.get(key); }
/** Returns the the context corresponding to the <code>key</code> parameter. If there is a local MDC copy, possibly because we are in a logging server or running inside AsyncAppender, then we search for the key in MDC copy, if a value is found it is returned. Otherwise, if the search in MDC copy returns a null result, then the current thread's <code>MDC</code> is used. <p>Note that <em>both</em> the local MDC copy and the current thread's MDC are searched. */ public Object getMDC(String key) { Object r; // Note the mdcCopy is used if it exists. Otherwise we use the MDC // that is associated with the thread. if(mdcCopy != null) { r = mdcCopy.get(key); if(r != null) { return r; } } return MDC.get(key); }
@Override protected String getFromMdc(String key) { final Object mdcValue = MDC.get(key); if (mdcValue == null) { return null; } return String.valueOf(mdcValue); }
public Object putMdc(String key, Object val) { try { return MDC.get(key); } finally { MDC.put(key, val); } }
public Object putMdc(String key, Object val) { try { return MDC.get(key); } finally { MDC.put(key, val); } }
public Object putMdc(String key, Object val) { try { return MDC.get(key); } finally { MDC.put(key, val); } }
public Object putMdc(String key, Object val) { try { return MDC.get(key); } finally { MDC.put(key, val); } }
public Object putMdc(String key, Object val) { try { return MDC.get(key); } finally { MDC.put(key, val); } }
@Override public AuditContext detachContext() { AuditContext context = (AuditContext) MDC.get( MDC_AUDIT_CONTEXT_KEY ); MDC.remove( MDC_AUDIT_CONTEXT_KEY ); return context; }
public Object putMdc(String key, Object val) { try { return MDC.get(key); } finally { MDC.put(key, val); } }
@Test public void testValue() { ServerInfo.add("hello", "world"); Assert.assertEquals("world", ServerInfo.get("hello")); Assert.assertEquals("world", MDC.get("hello").toString()); }