How adding Kotlin coroutine name in logging?

Viewed 172

Working with coroutines, it is possible to use the -Dkotlinx.coroutines.debug jvm option to display the coroutine names in the log as explained in the doc.

How is it possible to reproduce that effect without the jvm option but with a configuration of the logger (logback for example) and/or the application.properties file?

1 Answers

I have not been able to get the coroutine name, but it is possible to use the MDCContext module to add a MDC value to the coroutine that can be logged using the %X{} of logback.

Related