Skip to content
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

LoggerContext initialization error results in NoSuchMethodError with SLF4j 2.0.10 #761

Open
ianprime0509 opened this issue Jan 4, 2024 · 1 comment

Comments

@ianprime0509
Copy link

As of SLF4j 2.0.10, the internal org.slf4j.helpers.Util.report method is commented out: https://github.com/qos-ch/slf4j/blob/v_2.0.10/slf4j-api/src/main/java/org/slf4j/helpers/Util.java#L120-L124

Unfortunately, this method is being used in Logback to report errors initializing the LoggerContext: https://github.com/qos-ch/logback/blob/v_1.4.14/logback-classic/src/main/java/ch/qos/logback/classic/spi/LogbackServiceProvider.java#L49-L65

The result is that if the LoggerContext initialization fails for whatever reason (e.g. an exception thrown in some component's start method), a NoSuchMethodError is thrown and bubbles up to the caller, most likely causing the application using it to exit. In contrast, with SLF4j 2.0.9, an error message is printed including the stack trace of the root cause exception, and no exception is thrown to the caller, so the rest of the program can work as usual (except without logs).

@janosvitok
Copy link

janosvitok commented Feb 14, 2024

In commit qos-ch/slf4j@c52da92 the change was reverted. Released in 2.0.12.

Now the method is still there, but deprecated and Reporter.error is recommended.

Now the TODO here is to upgrade dependency, and replace calls to the new methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants