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

Format string parameter substitution not working for single exception argument

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 1.7.25
    • Core API
    • 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

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

            Dates

              Created:
              Updated: