Uploaded image for project: 'SLF4J'
  1. SLF4J
  2. SLF4J-416

Format string parameter substitution not working for single exception argument

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.7.25
    • Fix Version/s: None
    • Component/s: Core API
    • Labels:
      None

      Description

      Some logging statements will not work as intended after upgrading to 1.7.25, due to a change in the way exceptions are handled in MessageFormatter. The following test will illustrate the issue:
       

      @Test
      public void testExceptionAsParameter() {
        Exception e = new Exception("A terrible mistake");
        result = MessageFormatter.format("Error! {}", e).getMessage();
        assertEquals("Error! A terrible mistake", result);
      }
      

      Result:

      org.junit.ComparisonFailure: 
       Expected :Error! A terrible mistake
       Actual :Error! {}
      

      This seems to be a regression of SLF4J-353.

        Attachments

          Activity

            People

            • Assignee:
              slf4j-dev SLF4J developers list
              Reporter:
              spod Stefan Podkowinski
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: