We are attempting to upgrade our logging. Using a gradle file we are updating these packages from :
implementation "org.slf4j:slf4j-api:1.7.6"
implementation "ch.qos.logback:logback-classic:1.2.3"
implementation "ch.qos.logback:logback-core:1.2.3"
to
implementation "org.slf4j:slf4j-api:2.0.5"
implementation "ch.qos.logback:logback-classic:1.4.5"
implementation "ch.qos.logback:logback-core:1.4.5"
However, when doing this update we get the following error :
java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder
We are using spring-boot, but have excluded it's logging packages which worked on the previous versions of the logging packages seen above. This is done via :
configurations {
all*.exclude module: 'spring-boot-starter-logging'
}
We believe to be using the correct updated dependencies for these new versions shown. We are unsure what is causing the issue as we followed other recommendations without any luck. If anyone can help, it be greatly appreciated.
Thank you
CodePudding user response:
StaticLoggerBinder is not present in version org.slf4j-2.0.5.
From what I see you can find that dependency for StaticLoggerBinder here
group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: '2.19.0'
https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j-impl
I also checked and the StaticLoggerBinder is present even in the latest version which is 2.19.0
Also, I checked the old version you had of slf4j-api 1.7.6.
https://mvnrepository.com/artifact/org.slf4j/slf4j-api/1.7.6
That dependency also does not have StaticLoggerBinder either, but it is present in the dependency of log4j-slf4j-impl
which I provided above.