Nikky
11/13/2020, 12:03 PMsuspend fun doStuff() = withContext(MDCContext() + exceptionHandler()) {
MDC.put("flow", "do-stuff")
<http://logger.info|logger.info> { "doing stuff" } // mdc is fine here
someSuspendFun()
<http://logger.info|logger.info> { "done doing stuff" } // mdc was reset to the state of MDCContext ie. is empty
}
ideally what i would like to be able to do is update the MDCContext or update the val contextMap: MDCContextMap
after i modify the MDC
( i tried, it fails in different ways )
or use a mechanism where the MDC is stored before doing a suspend call, so any changes are actually picked up
TL;DR currently it leads to rather unnatural looking code and additional nesting or errors that are really hard to findgildor
11/13/2020, 2:51 PMNikky
11/13/2020, 7:19 PMMDCCOntext
or might know workarounds to update itbezrukov
11/13/2020, 8:53 PMNikky
11/14/2020, 11:36 AMgildor
11/15/2020, 12:27 PM