You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by AM <gi...@yahoo.it> on 2006/12/18 15:39:35 UTC
log4j conflict
I'm experiencing the following:
I've a Running Tomcat 5.0 with log4j-1.2.12.jar in $TOMCAT_HOME/shared/lib
Wanted functioning:
I have a library, let's say myLib.jar, which I put in $TOMCAT_HOME/shared/lib
in order to let a few webapplications using it. The myLib library uses log4j
too for its own logging.
Moreover I've a few webapplications, let's say MyWebApp_1 and MyWebApp_2,
deployed as usual in $TOMCAT_HOME/webapps/. Both of them logging and using
myLib.
What I get is the following.
myLib can't log as Log4j can't initalize correctly: a ClassLoader exception
occurs when both the main ClassLoader and webApplications' classloader find the
same classes.
Tried removing the log4j.jar and using just log4j.properties in the
webapplication, but in this case, I couldn't get the webappl's log working.
Can't use a different logging library or change the deployment.
Any hint??
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: log4j conflict
Posted by Jacob Kjome <ho...@visi.com>.
Log4j should not be in shared/lib. Put either in common/lib or WEB-INF/lib (or
both, doesn't really matter), but not shared/lib.
And unless you want to share a logger repository and/or use Log4j for Tomcat
logging (in which case you would also put commons-logging.jar in common/lib), I
would avoid common/lib altogether and just use WEB-INF/lib.
If your log4j.properties doesn't get picked up, try using log4j.xml. XML config
files get loaded in preference to property config files. Make sure the config
file is in WEB-INF/classes.
Let us know if that helps.
Jake
Quoting AM <gi...@yahoo.it>:
> I'm experiencing the following:
>
> I've a Running Tomcat 5.0 with log4j-1.2.12.jar in $TOMCAT_HOME/shared/lib
>
>
> Wanted functioning:
> I have a library, let's say myLib.jar, which I put in
> $TOMCAT_HOME/shared/lib
> in order to let a few webapplications using it. The myLib library uses log4j
> too for its own logging.
> Moreover I've a few webapplications, let's say MyWebApp_1 and MyWebApp_2,
> deployed as usual in $TOMCAT_HOME/webapps/. Both of them logging and using
> myLib.
>
> What I get is the following.
> myLib can't log as Log4j can't initalize correctly: a ClassLoader exception
> occurs when both the main ClassLoader and webApplications' classloader find
> the
> same classes.
> Tried removing the log4j.jar and using just log4j.properties in the
> webapplication, but in this case, I couldn't get the webappl's log working.
>
> Can't use a different logging library or change the deployment.
> Any hint??
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org