[slf4j-dev] Service Provider Interface (using jcl104-over-slf4j.jar with axis.jar)

Ceki Gülcü listid at qos.ch
Tue Mar 21 17:11:29 CET 2006


Hello Dave,

I am a little puzzled by your message. The code contained in 
jcl104-over-slf4j.jar makes no use of meta-information or the 
org.apache.commons.logging.LogFactory system variable. The fact that 
setting JCL related variables has an effect means that you have a copy of 
commons-logging.jar or commons-logging-api.jar in your environment. Have 
you checked that?

Cheers,

At 04:25 PM 3/21/2006, Dave Wallace wrote:
>Hello,
>I recently encountered some trouble adding axis.jar to an existing
>project that uses slf4j and jcl104-over-slf4j.jar to take over logging
>for hibernate and a few other apache commons jars.
>The application failed to load axis.jar until I set this property on the
>Java VM command line:
>-Dorg.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.SLF4FLogFactory.
>
>As it turns out, axis.jar uses commons-logging but through a
>commons-discovery mechanism that looks for a factory implementation
>based on the value of a property with a name from
>org.apache.commons.logging.LogFactory.FACTORY_PROPERTY. Hence the
>property is required, but this led me to look a little deeper into the
>discovery mechanism.
>
>Following
>http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#Service%20Provider
>I added a file named
>"/META-INF/services/org.apache.commons.logging.LogFactory" to
>jcl104-over-slf4j.jar. The file contained a single line naming
>org.apache.commons.logging.impl.SLF4FLogFactory as a provider of the
>LogFactory service. With this modification the property is no longer
>necessary.
>
>Do you think this might be a good thing to add to the jar permanently so
>that whenever jcl104-over-slf4j.jar is dropped in the classpath it
>becomes a provider of the org.apache.commons.logging.LogFactory service?
>
>- Dave

-- 
Ceki Gülcü
http://ceki.blogspot.com/




More information about the slf4j-dev mailing list