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

loggerContext NPE in classic.LoggerContext.getMDCAdapter()

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Not a bug
    • Icon: Major Major
    • None
    • 1.4.8
    • logback-classic
    • None

    Description

      Have pushed a repo with single test case demonstrating the issue:

      https://bitbucket.org/tomhaines/logback-npe-148-mdc/src/master/

       
      Starting in 1.4.8, the following NPE occurs:

      Cannot invoke "ch.qos.logback.classic.LoggerContext.getMDCAdapter()" because "this.loggerContext" is null
      java.lang.NullPointerException: Cannot invoke "ch.qos.logback.classic.LoggerContext.getMDCAdapter()" because "this.loggerContext" is null
      at ch.qos.logback.classic.spi.LoggingEvent.getMDCPropertyMap(LoggingEvent.java:407)
      at com.logback.example.StackJsonLayout.createContextNode(StackJsonLayout.java:74)
      at com.logback.example.StackJsonLayout.doLayout(StackJsonLayout.java:60)
      at com.logback.example.StackJsonLayoutTest.testBasic(StackJsonLayoutTest.java:22)

      To replicate, run

      ./gradlew test
      

      If you change back to logback 1.4.7 via gradle dependencies, the test passes.
       

      Attachments

        Activity

          People

            logback-dev Logback dev list
            thomas.haines Thomas Haines
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: