Log4j 2
  1. Log4j 2
  2. LOG4J2-319

Double stack trace logging when using %throwable in %style and %highlight

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-beta8
    • Fix Version/s: None
    • Component/s: Layouts
    • Labels:
      None
    • Environment:

      Description

      I'm seeing something odd in trunk:

      When I run org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiStyleLayoutMain

      I see double stack traces:

      [30m2013-07-07 02:27:09,904 [m [34m[main] [m [33mFATAL: [m [32mFatal message.
      [m [30m2013-07-07 02:27:09,906 [m [34m[main] [m [33mERROR: [m [32mError message.
      [m [30m2013-07-07 02:27:09,907 [m [34m[main] [m [33mWARN : [m [32mWarning message.
      [m [30m2013-07-07 02:27:09,907 [m [34m[main] [m [33mINFO : [m [32mInformation message.
      [m [30m2013-07-07 02:27:09,907 [m [34m[main] [m [33mDEBUG: [m [32mDebug message.
      [m [30m2013-07-07 02:27:09,907 [m [34m[main] [m [33mTRACE: [m [32mTrace message.
      [m [30m2013-07-07 02:27:09,907 [m [34m[main] [m [33mERROR: [m [32mError message.
      java.io.IOException: test
      at org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiStyleLayoutMain.main(ConsoleAppenderAnsiStyleLayoutMain.java:44)
      [m java.io.IOException: test
      at org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiStyleLayoutMain.main(ConsoleAppenderAnsiStyleLayoutMain.java:44) [test-classes/:?]

      Note that the last one includes jar provenance.

      The patter in /log4j-core/src/test/resources/log4j2-console-style-ansi.xml is:

      %style{%d{ISO8601}}

      {black}

      %style

      {[%t]} {blue}

      %style

      {%-5level:} {yellow}

      %style

      {%msg%n%throwable} {green}

      When I switch the test to use

      /log4j-core/src/test/resources/log4j2-console.xml, the output contains a single track trace without jar provenance. The patter there is:

      %d

      {ISO8601}

      [%t] %-5level: %msg%n%throwable

      Looks like a bug in pattern/layout parsing?

      1. LOG4J2-319.diff
        4 kB
        Gary Gregory

        Issue Links

          Activity

          Gary Gregory made changes -
          Status In Progress [ 3 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Gary Gregory made changes -
          Status Reopened [ 4 ] In Progress [ 3 ]
          Gary Gregory made changes -
          Summary Double stack trace logging when using %throwable in a %style Double stack trace logging when using %throwable in %style and %highlight
          Gary Gregory made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Assignee Gary Gregory [ garydgregory ]
          Gary Gregory made changes -
          Link This issue is related to LOG4J2-180 [ LOG4J2-180 ]
          Gary Gregory made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Gary Gregory made changes -
          Attachment LOG4J2-319.diff [ 12599576 ]
          Gary Gregory made changes -
          Field Original Value New Value
          Summary Double stack trace logging with ANSI output Double stack trace logging when using %throwable in a %style
          Gary Gregory created issue -

            People

            • Assignee:
              Gary Gregory
              Reporter:
              Gary Gregory
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development