qos-ch / slf4j

Simple Logging Facade for Java
http://www.slf4j.org
MIT License
2.32k stars 980 forks source link

Support nested putCloseable invocations (issues/404) #405

Open mdpearson opened 5 months ago

mdpearson commented 5 months ago

Hi folks,

This PR fixes #404 by preventing putCloseable from clobbering a key that was present in the MDC before the putCloseable was created. It thereby allows nested putCloseables. The existing behavior surprised us when we were writing some recursive code. Let me know what you think, and thanks for making SLF4j!