multiple bindings conflict with sl4j

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

multiple bindings conflict with sl4j

atitus
Hello Everyone, 

I'm running into the multiple bindings problem with sl4j, as described in this link: 

http://www.slf4j.org/codes.html#multiple_bindings

Looking at the war file which is included with the orbeon distribution, it includes all of the jar files which cause this conflict. 

Specifically: 

SLF4J: Found binding in [jar:file:WEB-INF/lib/ehcache-dependency-slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:WEB-INF/lib/slf4j-log4j12-1.5.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]

In this situation, the logging is not guaranteed to be setup correctly.  I am trying to use log4j and it never gets initialized; it appears to be using simple as a result of the conflict. 

I looked at the recently available 4.4 version, and the war file still contains all of these jars so the problem is still there.  

Is there a known solution for this?   

Thanks, 
Aaron 

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: multiple bindings conflict with sl4j

Alessandro  Vernet
Administrator
Hi Aaron,

I am not sure to understand. What is the problem, and how are you getting this problem? In essence, how can we reproduce it?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: multiple bindings conflict with sl4j

atitus
Hi Alex, 

The problem is exactly described as in the link I placed in the original post:    http://www.slf4j.org/codes.html#multiple_bindings

If you read the paragraph titled "multiple bindings found on the class path" it explains it very clearly.  The orbeon.war file which you download from the web site contains multiple jar files which contain sl4j bindings for log4j.  When the application server loads the app, there is a conflict and sl4j will pick one and as a result it might not initialize the way you want.  In my testing it consistently does not. 

As far as how to reproduce it, just download the 4.4 orbeon.war and unpack it.  Create a log4j.properties file in WEB-INF/classes with whatever kind of appender you want, I was using rolling file appender, and then start it up.  You will see the multiple bindings error in the main application server log file, and it probably won't use your logging configuration that you defined in log4j. 

Here is sample contents for log4j as I was using: 

log4j.rootCategory=DEBUG, dest1
log4j.appender.dest1=org.apache.log4j.RollingFileAppender
log4j.appender.dest1.file=${catalina.base}/logs/application.log 
log4j.appender.dest1.layout=org.apache.log4j.PatternLayout
log4j.appender.dest1.layout.ConversionPattern=%-5p: %c{1}.%M: %d: %m%n 


Regards, 
Aaron

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: multiple bindings conflict with sl4j

Erik Bruchez
Administrator
Aaron,

I am not sure how log4j.properties is handled as we load our own logj4.xml under WEB-INF/resources/config.

What if you turn off our log4j initialization in web.xml with oxf.initialize-logging set to false?

-Erik