1. 程式人生 > >Springboot測試的時候報SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".一個解決方案

Springboot測試的時候報SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".一個解決方案

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.

查了一下,聽說是了slf4j-simple的依賴,然後加入依賴後就可以了。

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

下面是我的logback-spring.xml  的配置

下面是我的測試類寫法

執行結果

至於順序為什麼會亂,我就不知道了,求各位大佬指點。