Don't confuse "not understanding" with "not sufficient". The instructions do 
lead to a correct configuration. However, here it is more explicitly.

Allistair.

Per-webapp logging
==================

1. Add log4j's jar to both your webapp's WEB-INF/lib folders
2. Add log4j.properties to both your webapp's WEB-INF/classes folders. 
*Minimally*, add

log4j.rootCategory=debug, R
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=c:/jakarta-tomcat/logs/webapp-name.log
log4j.appender.R.MaxFileSize=1500KB
log4j.appender.R.MaxBackupIndex=1
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d - %5p (%C:%L) - %m%n

to those log4j.properties files changing the File path appropriately.

Ideally you will pick up the log4j manual and create appenders that map to 
packages.

Tomcat logging with log4j
=========================

I've found the best way is

1. Add log4j jar to common/lib, add commons-logging.jar to common/lib
2. Add log4j.properties to common/classes with content

log4j.rootCategory=error, R
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=c:/jakarta-tomcat/logs/tomcat.log
log4j.appender.R.MaxFileSize=1500KB
log4j.appender.R.MaxBackupIndex=1
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d - %5p (%C:%L) - %m%n

log4j.logger.org.apache.commons.modeler=INFO, R
log4j.logger.org.apache.tomcat.util.digester=ERROR, R
log4j.logger.org.apache.catalina.loader=INFO, R
log4j.logger.org.apache.catalina.session=INFO, R
log4j.logger.org.apache.catalina=DEBUG, R
log4j.logger.org.apache.commons.digester=INFO, R
log4j.logger.org.apache.commons.beanutils=INFO, R
log4j.logger.org.apache.jasper=INFO, R
log4j.additivity.org.apache.catalina=false

Tomcat logging per-webapp
=========================

Add to your webapp's log4j.properties files

log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost][/webappname]=DEBUG,
 R 

> -----Original Message-----
> From: Scott Purcell [mailto:[EMAIL PROTECTED]
> Sent: 02 August 2005 14:22
> To: tomcat-user@jakarta.apache.org
> Subject: Logging With Tomcat 5.5
> 
> 
> Hello,
> 
> I am sure this topic has been beaten to death, but I am 
> having trouble understanding how the Log4J works, and how I 
> can configure it on my localbox.
> 
> First off, I am running Tomcat 5.5 and I have created two 
> webapp contexts. One is a dev site, and the other is a 
> production site. I am using struts (I don't think it matters).
> 
> I would to be able to have two sets of rolling logs. One for 
> dev, and the other for production. I am trying to decipher 
> the readme at 
> "http://jakarta.apache.org/tomcat/tomcat-5.5-doc/logging.html";
>  but I am not truly sure if this is for all webapps, or what 
> this is implying.
> 
> I would like to get all Tomcat messages (errors, etc) and my 
> actual logging all in either one or two files per webapp.
> 
> 
> Can someone please assist me in this? The readme just doesn't 
> cut it, or I am interpreting it wrongly. Or maybe there is an 
> example setup somewhere.
> 
> Any info would be appreciated.
> Sincerely
> Scott
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


<FONT SIZE=1 FACE="VERDANA,ARIAL" COLOR=BLUE> 
-------------------------------------------------------
QAS Ltd.
Registered in England: No 2582055
Registered in Australia: No 082 851 474
-------------------------------------------------------
</FONT>


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

Reply via email to