slf4j& log4j2 maven设置查询 [英] slf4j & log4j2 maven setup query
问题描述
我在我的项目中使用log4j2和slf4j&使用maven进行构建。我正在使用以下pom文件(仅显示相关的依赖项)但我收到下面复制的错误与此pom文件 - 任何想法我需要添加/删除以使其工作。我已经访问了错误中的url以及log4j2依赖项页面,因此请不要只指向响应中的URL。
I am using log4j2 and slf4j in my project & using maven for the build. I am using the following pom file (releveant dependencies shown only) but I am getting the error copied below with this pom file - any idea what I need to add/remove to get this to work. I have already visited the url in the error as well as the log4j2 dependencies page so please do not just point to URLs in your response.
消息:
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.
pom file
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<slf4j.version>1.7.7</slf4j.version>
</properties>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>com.lmax</groupId>
<artifactId>disruptor</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.0.1</version>
</dependency>
更新:
我向我的pom添加了以下依赖项文件,我在我的mavenrepository中看到了jar - 虽然我在运行mvn clean / install时仍然看到相同的消息
Update: I added the following dependency to my pom file and I see the jar in my mavenrepository - though I still see the same message when I run mvn clean/install
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.0.1</version>
</dependency>
推荐答案
您好像丢失了pom文件中的以下内容。
You seem to be missing the following from your pom file.
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.0.1</version>
</dependency>
这篇关于slf4j& log4j2 maven设置查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!