简体   繁体   English

SLF4J:无法加载 class“org.slf4j.impl.StaticLoggerBinder”错误

[英]SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder" error

I am running my app with Maven. But I get an error:我正在使用 Maven 运行我的应用程序。但出现错误:

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.

App uses log4j:应用程序使用 log4j:

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class App {
    public static void main(String[] args) {
        Logger logger = LoggerFactory.getLogger(App.class);
        logger.info("Test 1,2,3");
        System.out.println("End of my program");

    }
}

pom.xml file includes next dependencies: pom.xml 文件包括下一个依赖项:

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.30</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.7.30</version>
            <scope>test</scope>
        </dependency>

How to solve this problem?如何解决这个问题呢? I checked solutions in google but it doesnt help...我在谷歌中检查了解决方案,但它没有帮助......

I tried to add implepentation for example slf4j-simple but nothing changed我尝试添加实现,例如 slf4j-simple 但没有任何改变

errr错误

The solution did not need to test scope in Slf4j Dependencies because it is probably not available when you run your main method.该解决方案不需要在 Slf4j 依赖项中测试 scope ,因为当您运行 main 方法时它可能不可用。

       <dependency>
           <groupId>org.slf4j</groupId>
           <artifactId>slf4j-api</artifactId>
           <version>1.7.30</version>
       </dependency>

       <dependency>
           <groupId>org.slf4j</groupId>
           <artifactId>slf4j-simple</artifactId>
           <version>1.7.30</version>
           <scope>test</scope>  //Remove the test scope
       </dependency>

Then it's working fine without any errors.然后它工作正常,没有任何错误。

Thanks.谢谢。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 SLF4J:无法加载类“ org.slf4j.impl.StaticLoggerBinder”。 Java应用程序错误 - SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”. Java Application Error 错误[STDERR] SLF4J:无法加载类“ org.slf4j.impl.StaticLoggerBinder” - ERROR [STDERR] SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder” Hadoop CDH4错误:SLF4J:无法加载类“ org.slf4j.impl.StaticLoggerBinder” - Hadoop CDH4 Error:SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder” SLF4J:无法加载类“org.slf4j.impl.StaticLoggerBinder”。 在运行JUnit测试时 - SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”. when running JUnit test Intellij IDEA SLF4J:无法加载类“ org.slf4j.impl.StaticLoggerBinder” - Intellij IDEA SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder” 无法解决“ SLF4J:无法加载类“ org.slf4j.impl.StaticLoggerBinder””的问题 - Can't solve 'SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”' issue SLF4J:无法加载 class “org.slf4j.impl.StaticLoggerBinder” - SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder" SLF4J:无法加载类“org.slf4j.impl.StaticLoggerBinder”IntelliJ 问题 - SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder" IntelliJ issue 带logback的SLF4J还是提示failed to load class "org.slf4j.impl.StaticLoggerBinder" - SLF4J with logback still prompt failed to load class "org.slf4j.impl.StaticLoggerBinder" Apache jena:SLF4J:无法加载 class“org.slf4j.impl.StaticLoggerBinder” - Apache jena: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder"
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM