Nikky
11/12/2020, 4:25 PMprivate val exceptionHandler = CoroutineExceptionHandler { context, e -> GlobalScope.launch(MDCContext() + context) {
can i somehow do context.getCopyOfContextMap()
?louiscad
11/12/2020, 5:10 PMgildor
11/13/2020, 6:33 AMhow can i retrieve MDC from a CoroutineContext in a exception handlerMaybe I misunderstood your case, but why not just
CoroutineExceptionHandler { context, e ->
val mdcMap =
context[MDCContext]?.contextMap
}
Nikky
11/13/2020, 12:00 PMMDCContext(context[MDCContext.Key]?.contextMap)
gildor
11/13/2020, 1:01 PMNikky
11/13/2020, 3:13 PMcontext
variable so that the logged error will have the mdc context from where the exception comes.. hopefully