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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to