[英]Mix SLF4J with Log4J
I've got a logger implementing the SLF4J interface and a class org.slf4j.impl.StaticLoggerBinder
implementing org.slf4j.spi.LoggerFactoryBinder
on the classpath, because it is in the same jar as other required dependencies. 我有一个实现SLF4J接口的记录器,以及一个在类路径上实现
org.slf4j.spi.LoggerFactoryBinder
的类org.slf4j.impl.StaticLoggerBinder
,因为它与其他所需依赖项位于同一个jar中。
Now I want to use the Log4J-Logger in a project using the Log4J
interface only, but relying on other libs which use SLF4J. 现在,我只想在使用
Log4J
接口的项目中使用Log4J-Logger,但要依赖使用SLF4J的其他库。 Therefore I will have to throw a SLF4J-LOG4J-Bridge
into the classpath. 因此,我将不得不将
SLF4J-LOG4J-Bridge
扔到类路径中。
I'm wondering if my org.slf4j.impl.StaticLoggerBinder
will interfere with the SLF4J-LOG4J-Bridge
. 我想知道
org.slf4j.impl.StaticLoggerBinder
是否会干扰SLF4J-LOG4J-Bridge
。 Must I remove my org.slf4j.impl.StaticLoggerBinder
to get the LOG4J-Logger
working. 我必须删除我的
org.slf4j.impl.StaticLoggerBinder
才能使LOG4J-Logger
工作。 Or asked differently: Does the SLF4J-LOG4J-Bridge
also implement org.slf4j.impl.StaticLoggerBinder
? 还是不同地问:
SLF4J-LOG4J-Bridge
是否也实现org.slf4j.impl.StaticLoggerBinder
?
org.slf4j.impl.StaticLoggerBinder
is an class and not an interface. org.slf4j.impl.StaticLoggerBinder
是一个类,而不是一个接口。
If you go to http://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12/1.6.4 , download and open the jar you will see that it doesn't contain StaticLoggerBinder
class. 如果您转到http://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12/1.6.4 ,下载并打开jar,您将看到它不包含
StaticLoggerBinder
类。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.