-
-
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
class org.apache.logging.slf4j.Log4jLogger cannot be cast to class ch.qos.logback.classic.Logger #723
Comments
SLF4J 2.x requires logback 1.3 or later. |
Right but 1.3 and above breaks the casting. |
It should not. What is the exception? |
As the title reads: Edit: With the following in my maven pom file dependencymanagement:
|
|
I see such a jar is compiled under the following dependency `[INFO] - org.springframework.boot:spring-boot-starter-log4j2:jar:2.7.11:compile [INFO] +- org.apache.logging.log4j:log4j-slf4j-impl:jar:2.18.0:compile` Will exclude it and post results. |
For some reason I wasn't able to exclude from the dependency tree. But I'm sure this is still an acceptable answer. |
qos-ch/slf4j#415 (comment) is closely related. |
This bug(?) appears in later versions of ch.qos.logback: classic > 1.2.12
I am using the below code in a unit test class with the following imports and declarations
`
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.read.ListAppender;
import org.slf4j.LoggerFactory;
private final Logger logger = (Logger) LoggerFactory.getLogger(MyClass.class);
private final ListAppender listAppender = new ListAppender<>();
}
`
I am using org.slf4j:api version 2.0.9 and logback-classic version 1.2.12 as that's the last version that doesn't break the casting.
Hoping I can get an answer or a guide to this issue.
The text was updated successfully, but these errors were encountered: