Hi Everyone

Does anyone know how to configure Tomcat such that logging writes to separate log files for each web application? When we deploy several instances of our web application, for some reason, the logging output from all web applications is merged into a single debug.log file. Apparently, Tomcat uses an extended the log4j package (JULI) to support logging across multiple web applications, but we are unsure on how to activate it. I have a feeling we may not be using the right packages/configuration and would appreciate your guidance.

In our example, each web application has its own log4j.properties file stored in WEB-INF/classes. The log4j.properties file specifies an appender with the the location of the debug.log file as follows:

log4j.appender.archivadebug.File=${catalina.home}/logs/debug.log

Even if we specify a different file name for each web application, it only seems to pickup the first one. It combines logging output from all web applications into a single log file. Any ideas on why this might be the same?

Throughout my web application code, I use the following:

import org.apache.log4j.Logger;
..
protected static final Logger logger = Logger.getLogger(Config.class);
..
logger.debug("this is a test log output");

The jar log4j-1.2.14.jar is bundled with the web application and is located in WEB-INF/lib

How does one make it such that each web application will have its own log file? For example, say I had the web applications webapp1, and webapp2 - the debug log file for each could be debug-webapp1.log and debug-webapp2.log, respectively. Do I need to
import catalina's version of log4j? What is the import line?

Many thanks in advance for your guidance

Jamie

PS: My log4.properties file located in WEB-INF/classes currently looks like this:

# logging levels
log4j.logger.com.stimulus.archiva.audit=info,archivaaudit
log4j.logger.com.stimulus=DEBUG, archivadebug
#log4j.rootLogger=INFO,archivadebug
#log4j.logger.com.stimulus=warn, mail
#log4j.logger.org.apache.struts=INFO, tomcat
#log4j.logger.org.apache.struts.action=INFO, tomcat
#log4j.logger.org.apache=INFO, tomcat
#log4j.logger.org.apache.commons.digester.Digester= INFO, tomcat
#log4j.logger.org.subethamail.smtp=debug,archivadebug

# debug log
log4j.appender.archivadebug=org.apache.log4j.RollingFileAppender
log4j.appender.archivadebug.File=${catalina.home}/logs/debug.log
log4j.appender.archivadebug.MaxFileSize=200480KB
log4j.appender.archivadebug.layout=org.apache.log4j.PatternLayout
log4j.appender.archivadebug.layout.ConversionPattern=%5p %d{MMM/dd HH:mm:ss} - %m%n
log4j.appender.archivaaudit.MaxBackupIndex=7

# audit log
log4j.appender.archivaaudit=org.apache.log4j.DailyRollingFileAppender
log4j.appender.archivaaudit.File=${catalina.home}/logs/audit.log
log4j.appender.archivaaudit.layout=org.apache.log4j.PatternLayout
log4j.appender.archivaaudit.layout.ConversionPattern=%5p %d{MMM/dd HH:mm:ss} - %m%n
log4j.appender.archivaaudit.DatePattern=.yyyy-MM-dd
log4j.appender.archivaaudit.MaxBackupIndex=10000

# tomcat log
log4j.appender.tomcat=org.apache.log4j.RollingFileAppender
log4j.appender.tomcat.File=${catalina.home}/logs/tomcat.log
log4j.appender.tomcat.MaxFileSize=10000KB
log4j.appender.tomcat.layout=org.apache.log4j.PatternLayout
log4j.appender.tomcat.layout.ConversionPattern=%5p %d{MMM/dd HH:mm:ss} - %m%n


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to