ConfusedUbuntist
ConfusedUbuntist

Reputation: 175

Is slf4j 2.0.0-alpha7 compatible with log4j 2.17.2?

My problem is extremely similar to the one outlined in this post (it is unanswered): Is SLF4jJ 1.8.0-alpha2 compatible with Log4j 2.8.2.

I am trying to upgrade from slf4j 1.7.36 to 2.0.0-alpha7.

Currently I have this in my POM:

<!-- https://logging.apache.org/log4j/2.x/maven-artifacts.html -->
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-api</artifactId>
        <version>2.17.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
        <version>2.17.2</version>
        </dependency>
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.7.36</version>
    </dependency>
<!--  https://logging.apache.org/log4j/2.x/maven-artifacts.html -->  
    <dependency>
       <groupId>org.apache.logging.log4j</groupId>
       <artifactId>log4j-slf4j-impl</artifactId>
       <version>2

.17.2

This works as intended.

Every time that I try to change slf4j to 2.0.0-alpha7 I get the following error:

SLF4J: No SLF4J providers were found. SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#noProviders for further details. SLF4J: Class path contains SLF4J bindings targeting slf4j-api versions prior to 1.8.

Does anyone know what causes this?

Upvotes: 4

Views: 2578

Answers (1)

Piotr P. Karwasz
Piotr P. Karwasz

Reputation: 16045

No, there is at the moment no SLF4J 2.x binding for Log4j2.

The main reason is that SLF4J 2.x is in its alpha stage and might still have backward incompatible changes without previous notice. There is a branch (slf4j-2.0) of Log4j2's repository that contains a preliminary version of a log4j-slf4j2-impl, but I wouldn't count on it being merged before SLF4J 2.0 reaches a beta stage at least.

Edit: The log4j-slf4j2-impl module is available from version 2.19.0.

Upvotes: 5

Related Questions