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

Args array is double trimmed when passing more than one trailing throwable

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 1.3.0-alpha5
    • logback-classic
    • None
    • java version "10.0.2" 

      Windows 10 / IDEA

       

       

    Description

      When passing more than one trailing throwable: 

       

      Logger logger = LoggerFactory.getLogger(Main.class);
      logger.warn("Message1={}, message2={}.", 
              new Exception("I'm ex1"), 
              new Exception("I'm ex2"), 
              new Exception("I'm ex3"));
      

      Output:

       

      12:28:09.687 [main] WARN ch.qos.logback.classic.Main - Message1=java.lang.Exception: I'm ex1, message2={}.
      java.lang.Exception: I'm ex3
      at ch.qos.logback.classic/ch.qos.logback.classic.Main.main(Main.java:10)

       

      The second exception is trimmed by MessageFormatter#arrayFormat(String, Object[]) in LoggingEvent#getFormattedMessage(), although throwable had been already extracted in constructor.

       

      Attachments

        Activity

          People

            logback-dev Logback dev list
            lcybo LI CHUANYI
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: