Details
-
Bug
-
Resolution: Duplicate
-
None
-
None
-
Operating System: All
Platform: All
-
normal
-
P1
-
194
Description
Hi guys,
I think log4j-over-slf4j (as well as jcl bridges) checks circular dependency too strict.
Even when slf4j-log4j12.jar is visible, it does not necessarily mean it will be picked up by slf4j-api as the logging backend.
Here is a setup in tomcat 6 demonstrate the issue:
tomcat container lib contains: jcl-over-slf4j.jar, slf4j-api.jar, slf4j-log4j12.jar, log4j.jar
Webapp WEB-INF/lib contains: log4j.jar, log4j-over-slf4j.jar, slf4j-api.jar, logback-core.jar, logback-access.jar.
What we want to achieve is that tomcat logging (from commons-logging) will be routed to log4j and webapp's logging (from log4j) will be routed to logback.
In theory, there will be no circular dependencies in runtime as logback is picked up as the logging backend. However, webapp failed to start because the "potential" circular dependency is detected.
Is it possible to change the circular dependency detection algorithm to test against the actual binding picked up? I did a hack on org.apache.log4j.Log4jLoggerFactory which works for me:
class Log4jLoggerFactory {
...
static {
LoggerFactoryBinder binder = StaticLoggerBinder.getSingleton();
if ("org.slf4j.impl.Log4jLoggerFactory".equals(binder.getLoggerFactoryClassStr()))
}
...
}
Thanks,
Tom
Attachments
Issue Links
- relates to (out)
-
SLF4J-345 Move delegation check loop from log4j-over-slf4j.jar to slf4j-log4j12.jar
- Resolved