Tag Archives: SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”.

[Solved] SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”.

The reason for the error is the lack of slf4j NOP jar slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.Jar or logback classic Just add one jar package in jar (only one, and there will be conflicts if there are more).

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-simple</artifactId>
    <version>1.7.25</version>
</dependency>

[Solved] SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”.

SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”.

Recently, log4f was used to integrate SSM, and the added dependencies are as follows:

        <!-- log -->
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>

However, during operation, an error is reported:

Baidu has a lot of problems, most of which are that the jar package of slf4f is not introduced, lack of dependency or scope, but these solutions have no effect on my mistakes. The website inadvertently found the compatibility problem, so it took the compatibility problems of log4j and sl4f as a breakthrough, and finally solved the problem.

Solution: if you try to import dependencies and modify the scope is invalid, it should be a compatibility problem

https://mvnrepository.com Search slf4j-log4j12

Select a log4j version. I choose version 1.7.30 here. After entering, you can see the corresponding log4j version below.

Here: log4j version 1.2.17 corresponds to slf4j version 1.7.30

Import dependencies are as follows

        <!-- log -->
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.30</version>
        </dependency>

Problem solved!

[Solved] SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”.

Error content:

SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”.

SLF4J: Defaulting to no-operation (NOP) logger implementation

SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

Solution:

1) First, look at the version of sl4j API in your project (for example, mine is 1.7.25)

2) Then in http://mvnrepository.com/ Search slf4j-log4j12 and slf4j log4j12 binding will appear. Click to enter and there will be many versions of slf4j-log4j12. We click slf4j-log4j12 of version 1.7.25 to enter the details page and view the dependent log4j

Click: 1.2.27

Perfect problem solving:

Pom.xml installation dependency of Maven project:

<dependencies>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.25</version>
        </dependency>
    </dependencies>