"Start logging"? :)
Well, I checked the docs and some other stuff I found on the net, and I think I 
solved the problem.
I wrote my own LoggerLevelFilter that rejects events that match the logger but 
have a lower level, and is neutral for the rest. And, of course, I used an xml 
configuration.
I used equals and startsWith on strings to match the logger name, I wonder if 
there is a better way. But at least it works :)

Thanks for the assistance!

----- Original Message ----
From: James Stauffer <[EMAIL PROTECTED]>
To: Log4J Users List <[email protected]>
Sent: Wednesday, November 29, 2006 1:04:33 PM
Subject: Re: Logging to multiple appenders with different levels

Yes it does work in 1.2.x and start logging in the javadocs for
org.apache.log4j.spi.Filter

On 11/28/06, Adrian Sandor <[EMAIL PROTECTED]> wrote:
> Thanks; where can I find some documentation about filters, and examples?
> Do they work with 1.2.14?
>
> ----- Original Message ----
> From: James Stauffer <[EMAIL PROTECTED]>
> To: Log4J Users List <[email protected]>
> Sent: Wednesday, November 29, 2006 12:15:37 PM
> Subject: Re: Logging to multiple appenders with different levels
>
> Take a look at using filters (must use XML config).  I think that will work.
>
> On 11/28/06, Adrian Sandor <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]>
> > To: Log4J Users List <[email protected]>
> > 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 <[EMAIL PROTECTED]> 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

Reply via email to