You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by David Britton <dp...@hp.com> on 2008/09/02 18:02:45 UTC

Re: single line to diffrent log file

On Sat, Aug 30, 2008 at 05:21:51PM +0000, praveen#123 wrote:
> 
> 
> can any one healp me
>  to log single line to a diffrent log file and all other logs of the same
> class to the other log file

I only know of two straightforward ways to do this:

1) Create two loggers which could then do whatever you want... for
instance:

  com.foo.myclass
  com.foo.myclass.SPECIAL

You could then log the "special" line to it's own log file by attaching
a new appeneder to the special category, and it would also bubble up to
its the real appender if that is so desired.  This would require code
modification, of course.


2) You could potentially do this without modification as well...  If
there is a string in the log message that is unique enough, you can use
a filter:

http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/spi/Filter.html


-- 
David Britton

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