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 ____________________________________________________________________________________ Do you Yahoo!? Everyone is raving about the all-new Yahoo! Mail beta. http://new.mail.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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
