Open ianprime0509 opened 8 months ago
In commit https://github.com/qos-ch/slf4j/commit/c52da92599b1316c5b7216c8ecf5dab68341e861 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.
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-L124Unfortunately, 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), aNoSuchMethodError
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).