【logback】SLF4J: Failed to load class org.slf4j.impl.StaticLoggerBinder. 2021-03-30 Java logback 0 评论 字数统计: 245(字) 阅读时长: 1(分) 测试logback,出现了如下报错: 12345SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".SLF4J: Defaulting to no-operation (NOP) logger implementationSLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.Process finished with exit code 0 使用Maven构建的工程,logback的配置文件也都正常,但却报了上面的错误。仔细察看一番,发现从Maven仓库复制依赖时把scope也给带上了,pom文件中的范围是test,而我的调用代码写在main函数中(非test范围),所以报错了。解决办法:将pom文件中的scope给注释掉,重新加载一下依赖就好。 12345678910111213<dependencies> <!-- https://mvnrepository.com/artifact/ch.qos.logback/logback-classic --> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>1.2.3</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.7.25</version> </dependency></dependencies>