Uploaded image for project: 'JBoss Logging'
  1. JBoss Logging
  2. JBLOGGING-53

Slf4jLogger wrong formatting in methods with Object arrays

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • None
    • 3.0.0.Beta4-jboss-logging
    • None

    Description

      Slf4jLogger in JBoss Logging Manager formats the messages in logging methods with Object array parameters (ie. info(String, Object[]), debug(String, Object[]) etc.) the wrong way. MessageFormatter.format(format, argArray) is used, but MessageFormatter.arrayFormat(format, argArray) should be used instead. Using the format() method results in putting the whole array in the first placeholder and leaving the following ones empty.

      Example:

      logger.info("1: {} 2: {} 3: {}", new Object[]

      { "ONE", "TWO", "THREE" }

      );

      Expected output:
      1: ONE 2: TWO 3: THREE

      Actual output:
      1: [ONE, TWO, THREE] 2: {} 3: {}

      Attachments

        Issue Links

          Activity

            People

              dlloyd@redhat.com David Lloyd
              adammichalik Adam Michalik (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: