You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Charlie Toohey <ct...@pacbell.net> on 2003/04/10 01:21:59 UTC

Logger strangeness, using log4j

I have a mysterious situation with a Logger in server.xml. 

Tomcat is started with stdout and stderr redirected to the catalina.out file. 
But I have defined a Context element for one of my webapps, and within that I 
have defined a Logger element, configured with 
class="org.apache.catalina.logger.FileLogger", and specifying a 
webapp-specific logging file.

javax.servlet.ServletContext.log statements are properly going into this 
webapp specific logging file. 

The problem comes because I am using log4j, not ServletContext.log, to log 
everything. 

On webapp startup, all of my log4j logging statements are correctly being 
logged to my webapp-specific log file (i.e. I am implementing the 
ServletContextListener interface and have webapp initialization code in the 
contextInitialized, which calls log4j).

However, after the webapp is loaded and Tomcat has fully started, when the 
first page is requested, the log4j logging statement output suddently starts 
going into catalina.out, and no longer into my webapp-specific log file. I 
have no idea why this is happening. It is like my Context Logger is suddenly 
redefining itself to use org.apache.catalina.logger.SystemOutLogger. Or 
something crazy is happening.

Any ideas ? 

- Charlie

p.s. by the way, I am using the org.apache.log4j.ConsoleAppender, running 
Tomcat 4.1.9 on Linux ---- pretty standard configuration. 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org