Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-1583

Nested logging call disrupts output of outer logging call

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.6, 2.6.1, 2.6.2
    • 2.7
    • Core
    • None
    • JVM 1.8.0_102, MacOS 10.11.6

    Description

      If a call to logger.info() invokes the toString() method on one of its parameters, and that toString() method invokes another method which has another, nested logging call, then the output of the outer call is mangled.

      This can be quite confusing as the nested logging may be conditional, or at DEBUG level, etc.

      Problem appears to be related to ReusableParameterizedMessage.swapMessage() and the values in indices[]. (It looks inherently non-reentrant.)

      Attachments

        1. LOG4J-1583.tbz2
          2 kB
          Larry West
        2. log4j2.xml
          0.7 kB
          Larry West
        3. Log4j2ProblemDemo.java
          1 kB
          Larry West
        4. pom.xml
          0.6 kB
          Larry West

        Activity

          People

            rpopma Remko Popma
            larry_west Larry West
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: