in slf4j-to-log4j-api/src/main/java/org/apache/logging/slf4j/Log4jMDCAdapter.java [71:82]
public void pushByKey(final String key, final String value) {
if (key == null) {
ThreadContext.push(value);
} else {
final String oldValue = mapOfStacks.peekByKey(key);
if (!Objects.equals(ThreadContext.get(key), oldValue)) {
LOGGER.warn("The key {} was used in both the string and stack-valued MDC.", key);
}
mapOfStacks.pushByKey(key, value);
ThreadContext.put(key, value);
}
}