[mule-dev] Replacing log4j with slf4j & logback

6 views
Skip to first unread message

Arunagiri Rajasekaran

unread,
Sep 16, 2011, 6:59:21 AM9/16/11
to d...@mule.codehaus.org
hi,

To replace log4j with slf4j & logback.xml. I have added the following jars inside %MULE_HOME%/lib/boot

logback-classic-0.9.26.jar
logback-core-0.9.26.jar
janino-2.5.16.jar
slf4j-api-1.6.1.jar
slf4j-ext-1.6.1.jar

I have also added logback.xml in %MULE_HOME%/conf

The Mule version used is Standalone 3.1.2 community

The slf4j logger works fine along with log4j but when I remove log4j-1.2.14.jar and log4j.properties file, the mule server does not start up and it throws up NoClassDefFound errors for the classes inside log4j jars

Error in WrapperListener.start callback. java.lang.NoClassDefFoundError: org/apache/log4j/spi/RepositorySelector
java.lang.NoClassDefFoundError: org/apache/log4j/spi/RepositorySelector
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.getConstructor(Unknown Source)
at org.mule.module.reboot.MuleContainerWrapper.start(MuleContainerWrapper.java:53)
at org.tanukisoftware.wrapper.WrapperManager$12.run(WrapperManager.java:2788)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.spi.RepositorySelector
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 6 more
<-- Wrapper Stopped

The log4j jar and the properties file are being referenced by the mule container classes

How to overcome this problem like removing log4j references and making mule work with only slf4j?

Thanks in advance

Regards,
Arunagiri

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


Andrew Perepelytsya

unread,
Sep 16, 2011, 7:35:25 AM9/16/11
to d...@mule.codehaus.org

Mule logging is a bit more complex than just replacing jars. E.g. otherwise per-app logging wouldn't be possible.

I'm not sure what you're trying to achieve. Slf4j is already bridged by Mule with log4j implementation. The code uses the commons-logging, but only the api. At the end of the day it's still log4j. Can you simply configure log4j to do what you need?

Andrew

Victor Romero

unread,
Sep 16, 2011, 10:49:50 AM9/16/11
to d...@mule.codehaus.org
Can you upload that failing mule instance somewhere?

I bet that with some wrapper.conf changes this can be accomplished.

Arunagiri Rajasekaran

unread,
Sep 19, 2011, 9:31:29 AM9/19/11
to d...@mule.codehaus.org
I have uploaded the whole mule instance via google docs

The link is given below,

[https://docs.google.com/leaf?id=0BwWBXc9mqx-kNDkyMjRlZjUtNGU0MS00ZDkzLTkwY2ItYTQ1YmVlZGI2Zjhi&hl=en_US]

Please let me know if you find anything

Thanks in advance

Regards,
Arunagiri

---------------------------------------------------------------------

Reply all
Reply to author
Forward
0 new messages