SLF4J / SLF4J-557 [In Progress] MDCCloseable: not a great fit for a try-with-resources statement
============================== Here's what changed in this issue in the last few minutes. There is 1 comment. View or comment on issue using this link https://jira.qos.ch/browse/SLF4J-557 ============================== 1 comment ------------------------------ Alberto Scotto on 26/Sep/22 12:31 AM Yes, exactly. Your test proves my point. That is, the MDC is a concept not suited to be seen as a Closeable resource, because it leads to miss pieces of information in catch blocks. In a real world scenario, you would have: {code:java} try (MDC.MDCCloseable closeable = MDC.putCloseable(key, val)) { ... } catch (IllegalStateException e) { log.error("logging the error", e); // MDC will not be attached to this log at runtime! }{code} ============================== This message was sent by Atlassian Jira (v8.8.0#808000-sha1:e2c7e59) _______________________________________________ slf4j-dev mailing list slf4j-dev@qos.ch http://mailman.qos.ch/mailman/listinfo/slf4j-dev