Open mdpearson opened 5 months ago
We had the same issue and addressed it by writing our own NestedMDCClosable
, essentially wrapping the MDC
.
This should also be taken into account for the MDCAmbit
proposal in #377 and #372.
Our use case are correlationId
s in Services where a UUID is supposed to turn up in every log statement of a method call.
This works perfectly in case of a single service but breaks with the current MDCClosable
implementation once one such service is directly calling another such service or methods of itself.
Our team wrote some code that broadly looked like this:
It should be an easy patch to allow callers to nest putCloseable calls and get expected results; in fact, I'll go try to write one now.
Thank you very much, by the way, for SLF4j -- it's a wonderful tool. Cheers