Upgrade to SLF4J 2.0 and Logback 1.4
See original GitHub issueWith thanks to @rwinch, I’ve just learned that Boot doesn’t work with Logback 1.3 (still in alpha). It fails on launch with the following exception:
java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder
at org.springframework.boot.logging.logback.LogbackLoggingSystem.getLoggerContext(LogbackLoggingSystem.java:273)
at org.springframework.boot.logging.logback.LogbackLoggingSystem.beforeInitialize(LogbackLoggingSystem.java:99)
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationStartingEvent(LoggingApplicationListener.java:191)
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:170)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)
at org.springframework.boot.context.event.EventPublishingRunListener.starting(EventPublishingRunListener.java:68)
at org.springframework.boot.SpringApplicationRunListeners.starting(SpringApplicationRunListeners.java:48)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:313)
StaticLoggerBinder was removed in this commit which appears to be part of a broader effort to provide Jigsaw modules for SLF4J and Logback.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:19
- Comments:70 (39 by maintainers)
Top Results From Across the Web
News - Logback - QOS.ch
2022-10-02 Release of logback versions 1.3.2 and 1.4.2. • Significantly improved the performance of LogbackMDCAdapter , i.e. logback's implementation of org.
Read more >SLF4J FAQ
For most users, upgrading to version 2.0..x should be a drop-in replacement, as long as the logging provider is updated as well. In...
Read more >NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder ...
StaticLoggerBinder has been deleted in version 1.3.x of logback-classic. Here are two ways to solve this problem: Use versions of slf4j-api (2.
Read more >ch.qos.logback » logback-classic » 1.4.5 - Maven Repository
Implementation of the SLF4J API for Logback, a reliable, generic, ... #2 in Logging Frameworks ... Category/License, Group / Artifact, Version, Updates ......
Read more >SLF4J FAQ
However, the underlying logging system might have a higher requirement. For instance, the slf4j-jdk14 binding requires JDK 1.4. Logback requires JDK 1.5.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It’s possible to make Spring Boot 2.x work with Slf4j 2.0 simply by disabling the custom logging facade used by Spring Boot. To do so, one needs to set
org.springframework.boot.logging.LoggingSystemsystem property tonone(and also making sure that all dependencies to logback/slf4j on classpath have been updated in Maven/Gradle). I managed to run my project in this way.As I looked at the code, it should be possible to write a custom
LoggingSystemFactoryfor Spring Boot that delegates stuff to Slf4j, rather than talking to Logback directly. The public API of Slf4j 2.0.x is backward compatible with 1.x. In fact, I wished if things were done in this way from the beginning.@code-magician323 As I said above, the current target is 3.0.0-RC1.