[logback-dev] [JIRA] Updates for LOGBACK-1758: loggerContext NPE in classic.LoggerContext.getMDCAdapter()

logback developers list logback-dev at qos.ch
Thu Jul 13 09:09:00 CEST 2023


logback / LOGBACK-1758 [Open]
loggerContext NPE in classic.LoggerContext.getMDCAdapter()

==============================

Here's what changed in this issue in the last few minutes.

This issue has been created
This issue is now assigned to you.


View or comment on issue using this link
https://jira.qos.ch/browse/LOGBACK-1758

==============================
 Issue created
------------------------------

Thomas Haines created this issue on 13/Jul/23 8:58

Summary:              loggerContext NPE in classic.LoggerContext.getMDCAdapter()
Issue Type:           Bug
Affects Versions:     1.4.8
Assignee:             Logback dev list
Components:           logback-classic
Created:              13/Jul/23 8:58
Priority:             Major
Reporter:             Thomas Haines
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:
  
  
  {code:java}
  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){code}
  To replicate, run
  {code:java}
  ./gradlew test
  {code}
  If you change back to logback 1.4.7 via gradle dependencies, the test passes.
   


==============================
 This message was sent by Atlassian Jira (v9.6.0#960000-sha1:a3ee8af)



More information about the logback-dev mailing list