LOGBACK-1742 cause compatibility issues when use custom LoggerContext

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/9c318804cf8bbc27eac20513887fa426498... <https://github.com/qos-ch/logback/commit/9c318804cf8bbc27eac20513887fa426498... >. 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. Thanks
participants (1)
-
胡子杰(致节)