Coder Social home page Coder Social logo

Comments (8)

notxndy avatar notxndy commented on August 26, 2024 1

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.

ceki avatar ceki commented on August 26, 2024

SLF4J 2.x requires logback 1.3 or later.

from logback.

notxndy avatar notxndy commented on August 26, 2024

Right but 1.3 and above breaks the casting.

from logback.

ceki avatar ceki commented on August 26, 2024

It should not. What is the exception?

from logback.

notxndy avatar notxndy commented on August 26, 2024

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.

ceki avatar ceki commented on August 26, 2024

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.

notxndy avatar notxndy commented on August 26, 2024

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.

ceki avatar ceki commented on August 26, 2024

qos-ch/slf4j#415 (comment) is closely related.

from logback.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.