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

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

    XMLWordPrintable

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 1.1.11, 1.2.3
    • logback-classic
    • 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

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

            Dates

              Created:
              Updated: