logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Stauffer" <stauffer.ja...@gmail.com>
Subject Re: Logging to multiple appenders with different levels
Date Wed, 29 Nov 2006 04:15:37 GMT
Take a look at using filters (must use XML config).  I think that will work.

On 11/28/06, Adrian Sandor <aditsu@yahoo.com> wrote:
> Yes, I want two levels for the same category. I don't know if it's possible, I looked
at the log4j 1.2.14 source/javadoc and the Category class has addAppender(Appender) and setLevel(Level)
- it looks like it doesn't support multiple levels. But to me it seems like a natural requirement.
> As I already mentioned, I'm using a log4j.properties file. Here's an example:
> log4j.rootCategory=DEBUG, main
> log4j.category.java.sql=WARN, main
> log4j.category.java.sql=DEBUG, db
> log4j.appender.main=...
> log4j.appender.debug=...
> (btw, should I use "logger" rather than "category"?)
> Thanks
> Adrian
> ----- Original Message ----
> From: James Stauffer <stauffer.james@gmail.com>
> To: Log4J Users List <log4j-user@logging.apache.org>
> Sent: Wednesday, November 29, 2006 1:06:56 AM
> Subject: Re: Logging to multiple appenders with different levels
> I am not sure that it would work to do that because you have two
> levels (debug and warn) that you want to use for java.sql.  You may be
> able to do it with customer filters.  Are you using .properties, .xml,
> or code for config?  Please provide an attempt to achieve this any
> maybe we can tweak it to work.
> On 11/27/06, Adrian Sandor <aditsu@yahoo.com> wrote:
> > Hi, I'll try to explain my problem with a simplified example:
> > Let's say I have two appenders: main and db. In main I want to log everything from
the application at debug level, except java.sql stuff which should only log at warn level.
In the db appender, I want to log only java.sql messages at debug level (so warn or higher
levels will go to both appenders). How can I define that in my log4j.properties?
> >
> > Thanks
> > Adrian
> ____________________________________________________________________________________
> Cheap talk?
> Check out Yahoo! Messenger's low PC-to-Phone call rates.
> http://voice.yahoo.com

James Stauffer        http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/

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

View raw message