logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob van der Leek <...@ricardis.tudelft.nl>
Subject Appenders at different log levels for a single logger
Date Thu, 14 Jul 2005 09:08:51 GMT
Hi list,

How can I define appenders at different log levels for the same logger?  
For instance, what if I want to route all ERROR-level messages to an 
error logfile and all other messages to a different logfile.

I'd hoped something like this would be possible:

log4j.rootLogger=DEBUG, logfile
log4j.rootLogger=ERROR, errorlog

log4j.appender.logfile=org.apache.log4j.RollingFileAppender 
log4j.appender.logfile.File=logfile.log 
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout 
log4j.appender.logfile.layout.ConversionPattern=%d [%t:%L] %-6p %c - %m%n 

log4j.appender.errorlog=org.apache.log4j.RollingFileAppender 
log4j.appender.errorlog.File=error.log 
log4j.appender.errorlog.layout=org.apache.log4j.PatternLayout 
log4j.appender.errorlog.layout.ConversionPattern=%d [%t:%L] %-6p %c - 
%m%n 

Unfortunately it seems that this configuration only routes ERROR-level 
messages to the errorlog and discards all other messages.

Best regards,
-- 
Rob van der Leek                |     rob(at)ricardis(dot)tudelft(dot)nl

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


Mime
View raw message