Thread Context in asynchronous programs #1826
Replies: 1 comment 1 reply
-
This might be tricky to figure out, but I think it's possible in theory at least. In Log4j API, there are the Edit: see https://github.com/apache/logging-log4j-kotlin/blob/main/log4j-api-kotlin/src/main/kotlin/org/apache/logging/log4j/kotlin/CoroutineThreadContext.kt for more info. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm writing a program that makes heavy use of Kotlin coroutines (it is a single threaded application handling a few tens of concurrent jobs) and uses Log4j2.
If I'm not mistaken, information pushed into Thread Context is stored in ThreadLocal storage. Thus, I believe I can't use Thread Context in my application. Is it right?
Is there any way that I can provide this Context (map and/or stack) information to the logging call, without going through ThreadLocal storage?
Beta Was this translation helpful? Give feedback.
All reactions