You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2020/05/20 21:45:00 UTC

[jira] [Commented] (LOG4J2-2433) Support MDCs with Kotlin coroutines

    [ https://issues.apache.org/jira/browse/LOG4J2-2433?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17112632#comment-17112632 ] 

ASF subversion and git services commented on LOG4J2-2433:
---------------------------------------------------------

Commit a22efc2d8b8ad64397bca86eaf884227ba2af42d in logging-log4j-kotlin's branch refs/heads/master from Raman Gupta
[ https://gitbox.apache.org/repos/asf?p=logging-log4j-kotlin.git;h=a22efc2 ]

LOG4J2-2433: Add ThreadContext support with coroutines

Create a Kotlin coroutines CoroutineThreadContext, which can be used to
integrate the thread-local based log4j2 ThreadContext with Kotlin
coroutine context.

This is based on the SLF4J MDC adapter maintained by Jetbrains @
https://github.com/Kotlin/kotlinx.coroutines/blob/master/integration/kotlinx-coroutines-slf4j/src/MDCContext.kt.


> Support MDCs with Kotlin coroutines
> -----------------------------------
>
>                 Key: LOG4J2-2433
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2433
>             Project: Log4j 2
>          Issue Type: New Feature
>          Components: Kotlin API
>    Affects Versions: Kotlin 1.0.0
>            Reporter: Raman Gupta
>            Priority: Major
>          Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> Create support for log4j2 MDC when used with Kotlin coroutines. Since coroutines do not guarantee which underlying thread is executing code after a continuation, a standard ThreadLocal is not sufficient to keep the MDC context.
> Kotlin coroutines have a mechanism by which "coroutine local" data can be stored. See the reference implementation for SLF4J here:
> https://github.com/Kotlin/kotlinx.coroutines/tree/master/integration/kotlinx-coroutines-slf4j
> We should implement an optional native module to add support for log4j2 MDC using the same pattern, that does not require having SLF4J and the slf4j-log4j2 implementation on the classpath.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)