Details
-
Bug
-
Resolution: Fixed
-
Minor
-
1.7.25
-
None
Description
It turned out that method org.slf4j.impl.Log4jMDCAdapter#getCopyOfContextMap() may return null however org.slf4j.impl.Log4jMDCAdapter#setContextMap() does not handle this situation. That causes the Slf4j API consumer to eventually break with NPE in this code, depending on implementation / current logging backend provider:
Map<String, String> mcdContextMap = MDC.getCopyOfContextMap(); ... MDC.setContextMap(mcdContextMap);
It is expected that MDC.setContextMap() API treats null map as empty map.
Attachments
Issue Links
- relates to (in)
-
LOGBACK-944 MDC.getCopyOfContextMap can return null, but MDC.setContextMap doesn't accept it
- Open
- links to