Set the logger's level to the lower level and one of the appenders to a higher level. The event will get pass the check on the logger and will pass the check on one of the appenders and not the other.
log4j.logger.com.foo.hello=DEBUG,FOO_1,FOO_2 log4j.appender.FOO_1.threshold=ERROR On May 17, 2011, at 10:33 AM, Nitin Kumar Gupta wrote: > > 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-level-for-same-package-tp31638492p31638492.html > Sent from the Log4j - Users mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org > For additional commands, e-mail: log4j-user-h...@logging.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org