Different appenders for different loggers?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Different appenders for different loggers?

Steve Kuo-4
Here's what I'm trying to do. Use one appender for a
particular logger (say x.y.z), and another default
appender for everything else.

The default appender is easy:
log4j.rootLogger=ERROR, logFile
log4j.appender.logFile=org.apache.log4j.RollingFileAppender
log4j.appender.logFile.MaxFileSize=1MB
and so on..

What I can't figure out is how to setup an appender
for a particular logger instance?

Thanks, Steve

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: Different appenders for different loggers?

Carson Reinke
I believe you want to do this:

log4j.additivity.x.y.z=false

-----Original Message-----
From: Steve Kuo [mailto:[hidden email]]
Sent: Wednesday, May 04, 2005 1:35 PM
To: [hidden email]
Subject: Different appenders for different loggers?


Here's what I'm trying to do. Use one appender for a
particular logger (say x.y.z), and another default
appender for everything else.

The default appender is easy:
log4j.rootLogger=ERROR, logFile
log4j.appender.logFile=org.apache.log4j.RollingFileAppender
log4j.appender.logFile.MaxFileSize=1MB
and so on..

What I can't figure out is how to setup an appender
for a particular logger instance?

Thanks, Steve

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Different appenders for different loggers?

davep@dpawson.co.uk
In reply to this post by Steve Kuo-4
On Wed, 2005-05-04 at 10:35 -0700, Steve Kuo wrote:

> Here's what I'm trying to do. Use one appender for a
> particular logger (say x.y.z), and another default
> appender for everything else.
>
> The default appender is easy:
> log4j.rootLogger=ERROR, logFile
> log4j.appender.logFile=org.apache.log4j.RollingFileAppender
> log4j.appender.logFile.MaxFileSize=1MB
> and so on..
>
> What I can't figure out is how to setup an appender
> for a particular logger instance?


log4j.<loggerName>=<level> \
|INHERITED| NULL,<appenderName>,<appenderName>...

are my notes. so for logger x.y.z it might be

log4j.x.y.z=DEBUG, a1

where a1 is defined as

log4j.appender.A1=<full appender class Name>
e.g.

log4j.appender.A1=org.apache.log4j.FileAppender

I think that's right.

HTH DaveP.

(Still fighting the book :-)
But making slow progress.

regards DaveP


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]