[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!

Similar Posts: