Closed jivedude closed 5 months ago
@jivedude Which setContextMap
method are you referring to? There is no setContextMap
method in org.apache.log4j.MDC
Are you referring to setContextMap
method in the slf4j-reload4j module?
Where is the getContext() method located? The method below:
public static Hashtable<String, Object> getContext() {
return new Hashtable((Map)localMap.get());
}
My bad i think i have the wrong project. It's in slf4-reload4j which my native search brought me to the wrong github.
The reload4j setContextMap relies on the MDC.getContext() call to get the current MDC map, and then does a putAll on the provided Map to override or set new values.
However the getContext() call does a new HashTable() , so it returns a copy of the Map thats stored in the ThreadLocal. So when putting in new key/values it does this in the copy and not in the stored ThreadLocal. Thus loosing the new MDC map on the next getContext Call.