You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Brad Balmer <bb...@peapod.com> on 2003/01/08 15:02:16 UTC

Multiple log files

I am very new to log4j and have only been able to get simple logging
applications up and running.
 
We have multiple web applications running and all of the applications
have all of their logging done by a single class with different
functions (i.e. writeDebug calls log.debug(), writeError calls
log.error(), etc).
 
I would like to have all of the errors go to one file, while all of the
info go to another and all of the debug go to another (I realize that
debug will get info and error logs).  With my properties file as it
stands, all of the logs go to the console and the only file that gets
created is the info log (NOT the error log).
 
Anyway, my log4j.properties file looks like:       
 
log4j.logger.com.webapp.app.SAM=DEBUG, debugLog, sqlLog, errorLog
log4j.additivity.com.webapp.app.SAM=false
 
log4j.appender.debugLog.Threshold=FATAL
log4j.appender.debugLog=org.apache.log4j.ConsoleAppender
log4j.appender.debugLog.layout=org.apache.log4j.PatternLayout
log4j.appender.debugLog.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
 
#Setting this to FATAL will stop the sqlLog from being printed to the
file
log4j.appender.sqlLog.Threshold=INFO
log4j.appender.sqlLog=org.apache.log4j.DailyRollingFileAppender
log4j.appender.sqlLog.DatePattern='.'yyyy-MM-dd
log4j.appender.sqlLog.File=WebBaseSQLLog.log
log4j.appender.sqlLog.layout=org.apache.log4j.PatternLayout
log4j.appender.sqlLog.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
 
#Setting this to FATAL will stop the errorLog from being printed to the
file
log4j.appender.errorLog.Threshold=ERROR
log4j.appender.errorLog=org.apache.log4j.DailyRollingFileAppender
log4j.appender.errorLog.DatePattern='.'yyyy-MM-dd
log4j.appender.errorLog.File=WebBaseSQLLog.log
log4j.appender.errorLog.layout=org.apache.log4j.PatternLayout
log4j.appender.errorLog.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n

 
 
Does anyone see what I'm doing wrong here?!?

Re: Multiple log files

Posted by Rick Reumann <ma...@reumann.net>.

On Wednesday, January 8, 2003, 9:02:16 AM, Brad wrote:


BB> #Setting this to FATAL will stop the sqlLog from being printed to the
BB> file
BB> log4j.appender.sqlLog.Threshold=INFO
BB> log4j.appender.sqlLog=org.apache.log4j.DailyRollingFileAppender
BB> log4j.appender.sqlLog.DatePattern='.'yyyy-MM-dd
BB> log4j.appender.sqlLog.File=WebBaseSQLLog.log
BB> log4j.appender.sqlLog.layout=org.apache.log4j.PatternLayout
BB> log4j.appender.sqlLog.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
 
BB> #Setting this to FATAL will stop the errorLog from being printed to the
BB> file
BB> log4j.appender.errorLog.Threshold=ERROR
BB> log4j.appender.errorLog=org.apache.log4j.DailyRollingFileAppender
BB> log4j.appender.errorLog.DatePattern='.'yyyy-MM-dd
BB> log4j.appender.errorLog.File=WebBaseSQLLog.log
BB> log4j.appender.errorLog.layout=org.apache.log4j.PatternLayout
BB> log4j.appender.errorLog.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n

BB> Does anyone see what I'm doing wrong here?!?

I'm new to using log4j as well but from a quick glance it looks like you are using the
same file name "WebBaseSQLLog.log" for both ERROR and INFO. I thought
you wanted each to go to a different file. If so did you try using two
different file names?

-- 

Rick
mailto:maillist@reumann.net


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>