[logback-dev] [JIRA] (LOGBACK-1337) LogbackMDCAdapter should store mdc in LinkedHashMap to predict order of MDC in %X

QOS.CH (JIRA) noreply-jira at qos.ch
Thu Aug 24 05:32:00 CEST 2017


Martin Walsh created LOGBACK-1337:
-------------------------------------

             Summary: LogbackMDCAdapter should store mdc in LinkedHashMap to predict order of MDC in %X
                 Key: LOGBACK-1337
                 URL: https://jira.qos.ch/browse/LOGBACK-1337
             Project: logback
          Issue Type: Improvement
          Components: logback-classic
    Affects Versions: 1.2.3, 1.1.11
            Reporter: Martin Walsh
            Assignee: Logback dev list


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



--
This message was sent by Atlassian JIRA
(v7.3.1#73012)


More information about the logback-dev mailing list