Comments (8)
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.
from logback.
SLF4J 2.x requires logback 1.3 or later.
from logback.
Right but 1.3 and above breaks the casting.
from logback.
It should not. What is the exception?
from logback.
As the title reads: java.lang.ClassCastException: class org.apache.logging.slf4j.Log4jLogger cannot be cast to class ch.qos.logback.classic.Logger
Edit: With the following in my maven pom file dependencymanagement:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.9</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.3.0</version>
<scope>test</scope>
</dependency>
from logback.
org.apache.logging.slf4j.Log4jLogger
ships with log4j-slf4j-impl module, part of log4j 2.x project. Thus, you surely have log4j-slf4j-impl.jar in your class path which is causing the cast exception.
from logback.
For some reason I wasn't able to exclude from the dependency tree. But I'm sure this is still an acceptable answer.
from logback.
qos-ch/slf4j#415 (comment) is closely related.
from logback.
Related Issues (20)
- Vulnerability detected for hardcoded password in ch/qos/logback/core/net/ssl/SSL.java (OWASP category : Reverse Engineering) HOT 1
- AsyncAppender should avoid adding items to queue when log event happens in Worker thread
- Maven Central: Project URL and Source Control outdated
- Link to the Janino library in the online documentation outdated
- Expose copy of map of deques in LogbackMDCAdapter HOT 4
- MDC variable not getting restored in Java 21 Virtual Threads
- No way to replace MDCAdapter when using Logback HOT 5
- JaninoEventEvaluator Doesn't support Marker HOT 3
- Failed to initialize or to run Configurator: ch.qos.logback.classic.util.DefaultJoranConfigurator
- Java 11 or Java 21 required? HOT 2
- PatternLayoutBase custom converter classloading trouble in OSGi
- logback-classic 1.5.5 breaks conditional logger from included xml HOT 8
- Appenders are created even if their only reference is inside of another appender that does not get referenced HOT 1
- Problems in weekly rolling HOT 1
- make it easier to ingest stack traces into logging backends HOT 6
- No Log starting from Version 1.5.5 using included file from resources of jar HOT 3
- Failing while building logback-parent version 1.3.1 using mvnw clean install (ch.qos.logback:logback-parent:1.3.1) HOT 2
- LogbackMDCAdapter Performance HOT 1
- SiftingAppender don't work in logback 1.4.14
- Logback 1.5.5 and 1.5.6 incompatible with springProfile HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from logback.