logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Curt Arnold <carn...@apache.org>
Subject Re: Simultaneous output at different levels
Date Fri, 23 Jan 2009 19:06:02 GMT

On Jan 23, 2009, at 7:02 AM, DOUTCH GARETH-GDO003 wrote:

> How can I configure a logger to log to two appenders simultaneously at
> different levels, i.e. file at debug (+ higher) and socket at info (+
> higher)?
>
> This is my properties file:
>
> log4j.logger.myapp=debug, ROLLING_FILE, CHAINSAW_CLIENT
>
> log4j.appender.CHAINSAW_CLIENT=org.apache.log4j.net.SocketAppender
> log4j.appender.CHAINSAW_CLIENT.RemoteHost=localhost
> log4j.appender.CHAINSAW_CLIENT.Port=4445
> log4j.appender.CHAINSAW_CLIENT.LocationInfo=true
>
>
> log4j.appender.ROLLING_FILE=org.apache.log4j.RollingFileAppender
> log4j.appender.ROLLING_FILE.File=C:\\workdir\\log4j.csv
> log4j.appender.ROLLING_FILE.MaxFileSize=200KB
> log4j.appender.ROLLING_FILE.MaxBackupIndex=10
> log4j.appender.ROLLING_FILE.layout=org.apache.log4j.PatternLayout
> log4j.appender.ROLLING_FILE.layout.ConversionPattern=%d{dd MMM yyyy
> HH:mm:ss} -- %p -- %m%n
>
> Thanks

Set the logger level at the lowest level of all the attached appenders  
and set the threshold of the appenders to suppress undesired levels.

Basically, add a

log4j.appender.CHAINSAW_CLIENT.threshold=INFO

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