Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-1684

Unnecessary synchronization in LogbackMDCAdapter

    XMLWordPrintable

Details

    Description

      LogbackMDCAdapter uses synchronization. Synchronization has been added to fix problems related to use of inheritable thread local (LOGBACK-434) Inheritable thread local was removed in commit aa7d584ecdb1638bfc4c7223f4a5ff92d5ee6273 to fix issues LOGBACK-422 and LOGBACK-624. Synchronization was not removed

      It seems that synchronization and clever use of atomicinteger are no longer required. Logback exposes MDC variables only using single value getter and a method that returns a copy.

      Removing synchronization could have significant impact on situations where you need to update MDC often. One such use case is reactive java, that requires one to update MDC between every task that logs.

      Synchronization does also cause problems with project loom. 

      Attachments

        Activity

          People

            ceki Ceki Gülcü
            zkorhonen Sami Korhonen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: