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

conversion word %ex length handling is off by one

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.1.0
    • Component/s: logback-core
    • Labels:
      None

      Description

      The %ex and %xEx define a stack trace length. The integer spec is somewhat faulty and misleading. First of all this is a stack trace depth imho and not length. Anyway, I was poking around with the SMTPAppender and wanted to include the sole exception message into the subject. The outcome was:

      1. The docs do not define a valid interval for the integer value. You can only deduce from logic.
      2. I defined %ex

      {short}

      and it included 2 lines of the stack trace.
      3. I defined %ex

      {2}

      and it included 3 lines of the stack trace.
      4. I defined %ex

      {0}

      and it included 1 line of the stack trace.
      5. Defining any negative number omits the stack trace. But it does not make sense at all to have a negative stack trace depth.

      I checked also the source of the https://github.com/ceki/logback/blob/master/logback-classic/src/main/java/ch/qos/logback/classic/pattern/ThrowableProxyConverter.java converter, the lines 54 and 58 cause the problem.

        Attachments

          Activity

            People

            • Assignee:
              tony19 Tony Trinh
              Reporter:
              michael-o Michael Osipov
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: