-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting a NullPointerException #870
Comments
@sjmuir The Are you using a |
@ceki It's not a unit test, it's production code that we're trying to upgrade various libraries in, including logback. This method is invoked by ch.qos.logback.classic.callAppenders(ILoggingEvent event). In my case, for this parameter: event.toString() = "Logger[com.bluepumpkin.IU.FrameWork.FusionExchangeServer]" It's during the processing of "Logger[ROOT]" that the NullPointerException occurs. |
@ceki Normally, the |
We are not using spring-boot. We are using version 2.0.7 of org.slf4j:slf4j-api, org.slf4j:slf4j-jdk14 and org.slf4j:log4j-over-slf4j and version 1.3.14 of ch.qos.logback:logback-core and ch.qos.logback:logback-classic . I'm wondering if upgrading to 2.0.16 of slf4j* would fix the issue but I can't find release notes on slf4j to tell me what has changed in each 2.* release. |
When you say that "in some cases" What other components/frameworks are you using? Release notes can be found at SLF4J's news page. By the way, slf4j-jdk14 is an slf4j provider like logback-classic. It does not make sense to have more than one SLF4J provider. |
getMDCAdapter() always returns null when I step through the code, but it must have worked in the past before we started upgrading things. This a complex application, so I can't really comment on what other components/frameworks we're using. Because our logging is based on log4j, according to the bottom left diagram on this page: https://www.slf4j.org/legacy.html |
If logback-classic is your logging provider of choice, you should be using jul-to-slf4j and not slf4j-jdk14, as shown in the top-left diagram. Coming back to the bug at hand, I think it closely related to issue #709 As mentioned above, some component in your project is initializing SLF4J without calling the Without further information, I am closing this issue with NOT_A_BUG and WONT_FIX. |
Changing to the top-left diagram resolved the issue thanks. I still think it would be better to detect the null pointer and report the issue somehow rather than just let the NullPointerException happen. |
I checked this in versions 1.3.14 and 1.5.10. In ch.qos.logback.classic.spi.LoggingEvent.getMDCPropertyMap(), I found this line:
In some cases, I found that this returned null. This is not checked for, giving a NullPointerException on this line:
Please add a null pointer check.
The text was updated successfully, but these errors were encountered: