Hi all,

 

I had the problem that I wanted to use log4j in a webapp (based on
Spring Webflow), but I didn't want to change from the existing
jdk1.4+JULI logging of the TC server to use log4j.

 

When I put log4j and log4j.properties (but not commons logging) in the
webapp, with a Log4jConfigListener from Spring, I got 'Appender not
configured' messages from Tomcat for its internal classes.

 

I solved this by putting log4j.properties in WEB-INF/classes instead. It
seems to avoid TC's commons logging detecting log4j in the classloaders.
Log4j log lines look as they should and the JULI ones are unchanged,
with no log4j-related errors from the TC core.

 

This was fine until I wanted to precompile my JSP's using the 5.5.9
deployer.

I got NullPointerExceptions for resources that couldn't be found - only
when I deployed log4j with the webapp.

 

After much grief I saw that for some reason the deployer's lib directory
contains commons-logging full, instead of the API only as Tomcat does.

So when Jasper executes, log4j is detected and there are problems
locating resources.

When I put commons-logging-api there instead, all was well.

 

I've seen many questions on the Internet about log4j and
NullPointerExceptions with the deployer. So maybe this will help
somebody.

Maybe someone can even enlighten me as to exactly why all this happens,
and whether there's a better fix?

 

Paul.

 

Reply via email to