logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philip Kaplan <philip.j.kap...@gmail.com>
Subject Re: Appenders at different log levels for a single logger
Date Thu, 14 Jul 2005 13:34:47 GMT
Your second rootLogger entry is overriding your first.  Keep the root
logger set at debug and place both appenders there...and then set the
threshold values on each of the loggers to DEBUG and ERROR
respectively.

log4j.appender.logfile.Threshold=DEBUG
log4j.appender.errorlog.Threshold=ERROR


pK.





On 7/14/05, Rob van der Leek <rob@ricardis.tudelft.nl> wrote:
> 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
> 
>

---------------------------------------------------------------------
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