Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-2433

Support MDCs with Kotlin coroutines

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • Kotlin 1.0.0
    • Kotlin 1.1.0
    • Kotlin API
    • None

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              rocketraman Raman Gupta
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h 20m
                  2h 20m