[logback-user] LOGBACK-1742 cause compatibility issues when use custom LoggerContext

胡子杰(致节) hzj266771 at alibaba-inc.com
Thu Jul 27 08:15:01 CEST 2023

Dear sir:
 I update logback form 1.4.7 to 1.4.8, then I find the logback logger could'n print log, the console print: LOGBACK: No context given for ch.qos.logback.core.ConsoleAppender[CONSOLE]
 I found an NPE (NullPointerException) here:
 Then I found this pr: https://github.com/qos-ch/logback/commit/9c318804cf8bbc27eac20513887fa426498a4837 <https://github.com/qos-ch/logback/commit/9c318804cf8bbc27eac20513887fa426498a4837 >. In my case, the LogContext is not created by LogbackLoggerSpaceFactory, it's created by myself. so the MDCAdapter in loggerContext is null, then cause NullPointerException.
 I think this is an incompatible change, as some users may customize LogContext in certain scenarios, which will cause the custom LogContexts to be unusable.
I hope LogBack can consider fixing this compatibility issue, for example, to ensure backward compatibility by obtaining MDCAdapter from MDC when MDCAdapter obtained from LogContext is null.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20230727/a4bbdb65/attachment.htm>

More information about the logback-user mailing list