in slf4j-to-log4j-api/src/main/java/org/apache/logging/slf4j/Log4jMDCAdapter.java [85:95]
public String popByKey(final String key) {
if (key == null) {
return ThreadContext.getDepth() > 0 ? ThreadContext.pop() : null;
}
final String value = mapOfStacks.popByKey(key);
if (!Objects.equals(ThreadContext.get(key), value)) {
LOGGER.warn("The key {} was used in both the string and stack-valued MDC.", key);
}
ThreadContext.put(key, mapOfStacks.peekByKey(key));
return value;
}