Package org.slf4j
Class LampMdcAdapter
java.lang.Object
org.slf4j.LampMdcAdapter
- All Implemented Interfaces:
org.slf4j.spi.MDCAdapter
重构
LogbackMDCAdapter类,搭配TransmittableThreadLocal实现父子线程之间的数据传递- Author:
- Ceki Gülcü, zuihou
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear all entries in the MDC.voidclearDequeByKey(String key) Get the context identified by thekeyparameter.Return a copy of the current thread's context map.static org.slf4j.spi.MDCAdaptergetKeys()Returns the keys in the MDC as aSet.Get the current thread's MDC as a map.voidvoidPut a context value (thevalparameter) as identified with thekeyparameter into the current thread's context map.voidRemove the the context identified by thekeyparameter.voidsetContextMap(Map<String, String> contextMap)
-
Constructor Details
-
LampMdcAdapter
public LampMdcAdapter()
-
-
Method Details
-
getInstance
public static org.slf4j.spi.MDCAdapter getInstance() -
put
Put a context value (thevalparameter) as identified with thekeyparameter into the current thread's context map. Note that contrary to log4j, thevalparameter can be null. If the current thread does not have a context map it is created as a side effect of this call.- Specified by:
putin interfaceorg.slf4j.spi.MDCAdapter- Throws:
IllegalArgumentException- in case the "key" parameter is null
-
remove
Remove the the context identified by thekeyparameter.- Specified by:
removein interfaceorg.slf4j.spi.MDCAdapter
-
clear
public void clear()Clear all entries in the MDC.- Specified by:
clearin interfaceorg.slf4j.spi.MDCAdapter
-
get
Get the context identified by thekeyparameter.- Specified by:
getin interfaceorg.slf4j.spi.MDCAdapter
-
getPropertyMap
Get the current thread's MDC as a map. This method is intended to be used internally. -
getKeys
Returns the keys in the MDC as aSet. The returned value can be null. -
getCopyOfContextMap
Return a copy of the current thread's context map. Returned value may be null.- Specified by:
getCopyOfContextMapin interfaceorg.slf4j.spi.MDCAdapter
-
setContextMap
- Specified by:
setContextMapin interfaceorg.slf4j.spi.MDCAdapter
-
pushByKey
- Specified by:
pushByKeyin interfaceorg.slf4j.spi.MDCAdapter
-
popByKey
- Specified by:
popByKeyin interfaceorg.slf4j.spi.MDCAdapter
-
getCopyOfDequeByKey
- Specified by:
getCopyOfDequeByKeyin interfaceorg.slf4j.spi.MDCAdapter
-
clearDequeByKey
- Specified by:
clearDequeByKeyin interfaceorg.slf4j.spi.MDCAdapter
-