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

LogbackMDCAdapter should store mdc in LinkedHashMap to predict order of MDC in %X

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.1.11, 1.2.3
    • Fix Version/s: None
    • Component/s: logback-classic
    • Labels:
      None

      Description

      LogbackMDCAdapter uses HashMap rather than LinkedHashMap and so the order of the key value pairs when logging MDC with %X cannot be predicted from one log line to another.  This makes log parsing harder than it has to be.

       Using LinkedHashMap would address this as the order of adding to MDC would be preserved.

       

      See https://github.com/qos-ch/logback/blob/v_1.2.3/logback-classic/src/main/java/ch/qos/logback/classic/util/LogbackMDCAdapter.java

      https://github.com/qos-ch/logback/blob/v_1.1.11/logback-classic/src/main/java/ch/qos/logback/classic/util/LogbackMDCAdapter.java

        Attachments

          Activity

            People

            • Assignee:
              logback-dev Logback dev list
              Reporter:
              martin.walsh@siteminder.com Martin Walsh
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: