Uploaded image for project: 'SLF4J'
  1. SLF4J
  2. SLF4J-563

Reload4jMDCAdapter.setContextMap does not work correctly in 2.0

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.0.2
    • 2.0.0
    • None
    • None

    Description

      The Reload4jMDCAdapter has been updated in 2.0 and the setContextMap method has a small but crucial logic bug in the case where the existing MDC is null.

      Compare Reload4jMDCAdapter from 1.7.36 and the Reload4jMDCAdapter from the current master branch.

      The former iterates over the context map and adds entries to the MDC like this:

      org.apache.log4j.MDC.put((String) mapEntry.getKey(), mapEntry.getValue());
      

      The latter also iterates over the context map but adds entries like this:

      org.apache.log4j.MDC.put(mapEntry.getKey(), mapEntry);
      

      This winds up setting an MDC where the keys are mapped to the map entry objects of the original context map instead of the values from that map.

      Attachments

        Activity

          People

            ceki Ceki Gülcü
            mwartes Michael Wartes
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: