My experience of how to avoid problems with log4j in webapps on TC 5.5.9

2005-09-11 Thread Paul ANDERSON
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.

 



Re: My experience of how to avoid problems with log4j in webapps on TC 5.5.9

2005-09-11 Thread Dov Rosenberg
I ran into a problem on Jboss when I configured the root.logger. Jboss likes
to suck in the System.out and .err, I was trying to log out my own errors
separately. My logger stole away the System.out from Jboss. By not
configuring the root.logger I avoided the problem

HTH




On 9/11/05 11:29 AM, Paul ANDERSON [EMAIL PROTECTED]
wrote:

 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.
 
  
 

-- 
Dov Rosenberg
Conviveon/Inquira
Knowledge Management Experts
http://www.conviveon.com
http://www.inquira.com




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]