You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Derek Merren <de...@gmail.com> on 2005/08/18 16:41:46 UTC

Log4j writing to the same log file for different webapps

Hi,

I have a problem with Log4j. I have several webapps running on Tomcat.
They all use Log4j. The problem is that they all log to the same file.
The file they log to depends on which app is used first. It seems to
be picking up the settings from the log4j.properties file of the app
that is run first and using those settings for all the other apps.

I have the Log4j.properties file for each application in the location
-->  "tomcat/webapps/aplication1/WEB-INF/classes/"

Here is an example of one of the log4j.properties files -->

log4j.rootCategory=DEBUG, vote
log4j.appender.vote=org.apache.log4j.ConsoleAppender
log4j.appender.vote.layout=org.apache.log4j.PatternLayout
log4j.appender.vote.layout.ConversionPattern=%d{dd MMM yyyy
HH:mm:ss,SSS} %5p [%t] (%F:%L) - %m%n
log4j.appender.vote=org.apache.log4j.RollingFileAppender
log4j.appender.vote.File=/opt/tomcat/logs/vote.log
log4j.appender.vote.MaxFileSize=100KB
log4j.appender.vote.MaxBackupIndex=10


An example of the code in the app is -->

        //Create logger
	protected static Logger logger = Logger.getLogger("voteLogger");

	/**
	 * Constructor for the DataAccessObject 
	 */
	public DataAccessObject() throws SQLException, NamingException {
		logger.info("DataAccessObject() start constructor method");
		initialise();		
	}

Any help would be very much appreciated.

Best Regards,
  Derek

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