Java SLF4J记录器绑定不工作
我正在尝试启用SLF4J记录器,但收到以下控制台消息:Java SLF4J记录器绑定不工作,java,spring,maven,logging,slf4j,Java,Spring,Maven,Logging,Slf4j,我正在尝试启用SLF4J记录器,但收到以下控制台消息: 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. <depende
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.
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.5</version>
</dependency>
即使我已将这两个依赖项添加到pom.xml中,但仍然有相同的消息:
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.
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.5</version>
</dependency>
我是Spring/Maven的新手,认为这很容易解决,但没有成功
编辑:
这是我的Maven pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.myfakecompany.project</groupId>
<artifactId>SpringApp</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>Spring MVC Webapp</name>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-cassandra</artifactId>
<version>1.4.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>4.3.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.5</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>spring-milestone</id>
<name>Spring Maven MILESTONE Repository</name>
<url>http://repo.spring.io/libs-milestone</url>
</repository>
</repositories>
<build>
<finalName>SpringMVCApp</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<path>/</path>
<contextReloadable>true</contextReloadable>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
更新:我的记录器现在正在工作,尽管我不确定我到底做了什么才能使它工作:1)在项目结构->工件选项卡下,我单击添加新工件,然后将其删除;2)重新启动应用程序和计算机。很抱歉,我无法准确确定解决方案是什么。根据链接,您应该只使用一个依赖项,而不是两个。。。您应该在pom.xml中包含slf4j simple,您可以在您的问题中添加“mvn dependency:tree”的输出吗?@ryekayo声明slf4j api完全可以。但是,它将被slf4j简单声明引入。因此,如果声明了像slf4j simple这样的绑定,那么slf4j api是多余的。可能是@Ceki的重复,我已经在Edit 2中添加了输出,我相信您发布的链接可能是一个可能的解决方案,但是IDE在发布后的几年中发生了变化,不确定如何导航到talha06指定的选项卡。。。