logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bender Heri <hben...@ergonomics.ch>
Subject RE: is it possible to have different log level for same package
Date Mon, 23 May 2011 08:39:27 GMT
I am not sure about properties configuration. But with xml configuration I would do:

- define one logger (your package name, level debug)
- assign two appenders to this logger:
    - appender1: with level range filter error and higher
    - appender2: without level range filter

Heri

> -----Original Message-----
> From: Nitin Kumar Gupta [mailto:nitinkumargupta@gmail.com] 
> Sent: Tuesday, May 17, 2011 5:33 PM
> To: log4j-user@logging.apache.org
> Subject: is it possible to have different log level for same package
> 
> 
> suppose I have a package com.foo.hello ,
> 
> can I define log level and appender such that error logs goes 
> to one file and all other (even including error, if possible) 
> goes to another file.
> 
> I tried as follows, but last one is always overwriting first one
> 
> log4j.logger.com.foo.hello=ERROR, FOO_1
> log4j.logger.com.foo.hello=DEBUG, FOO_2
> 
> and appender as 
> 
> log4j.appender.FOO_1=org.apache.log4j.RollingFileAppender
> log4j.appender.FOO_1.File=../log/foo_error.log
> &
> log4j.appender.FOO_2=org.apache.log4j.RollingFileAppender
> log4j.appender.FOO_2.File=../log/foo_all.log
> 
> Can someone please help me on that?
> 
> Thanks a ton
> Nitin
> 
> --
> View this message in context: 
> http://old.nabble.com/is-it-possible-to-have-different-log-lev
> el-for-same-package-tp31638492p31638492.html
> Sent from the Log4j - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
---------------------------------------------------------------------
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