Dependency management for SLF4J and Logback

14,727

You need to add logback-classic to your pom

    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>1.0.13</version>
    </dependency>

it will transitively add the following two:

<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-core</artifactId>
    <version>1.0.13</version>
</dependency>

and

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.7.5</version>
</dependency>

See https://logback.qos.ch/setup.html#mavenBuild for more information.

Share:
14,727
Admin
Author by

Admin

Updated on June 05, 2022

Comments

  • Admin
    Admin almost 2 years

    I'd like to start using SLF4J with Logback. I read over Logback's online documentation and am now ready to add the JARs to my repo and try it out.

    But I'm at a loss! What JARs do I need? I downloaded that latest SLF4J (1.7.5) and expected to see something like slf4j-logback.jar, but don't see anything of the sorts. I've read that Logback contains a "native implementation" of SLF4J, but don't know exactly what this means, or if it also implies that I don't even need slf4j-api-1.7.5.jar on the classpath.

    So I ask: to use the latest Logback (1.0.13), what JARs do I need? I took a look at the Maven central repo for logback 1.0.13 and don't see any dependencies listed, so that didn't help me at all. Thanks in advance!

  • Kanagavelu Sugumar
    Kanagavelu Sugumar almost 7 years
    Thanks! but is also expecting org.codehaus.groovy/groovy-all ? any idea ..?
  • Steve Goossens
    Steve Goossens over 6 years
    You probably just need to add the optional dependency: <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-all</artifactId> <version>2.4.0</version> </dependency> source: logback.qos.ch/setup.html#mavenBuild
  • Tyron
    Tyron over 5 years
    Thank you, I have been trying to figure this out for hours!