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 Kumar_maniranjan <Ku...@infy.com> on 2002/04/30 11:52:04 UTC

How to log into two different files using single props file ??

Wanted to LOG some performance related messages into one file
PERFORMANCE.LOG and generic logiing to be done into 
GENERIC.LOG .... 
But not able to do it with one properties file... 

Is there neway ??

Rgds,
Mani

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: How to log into two different files using single props file ??

Posted by Ashwin Bangalore <ar...@statestreet.com>.
Mani,
You can define multiple appenders for multiple categories
and all these appenders being of type FileAppender.
I am not adding much to what Laith said in the earlier post but
here's a small chunk of what your properties file might look like.

log4j.appender.PERF=org.apache.log4j.FileAppender
log4j.appender.GENERIC=org.apache.log4j.MyFileAppender
log4j.appender.PERF.File=perf.log
log4j.appender.GENERIC.File=generic.log
<define patterns>
<define categories and assign priorities and appenders>
<DEFINITELY specify additivity properties and set them to false>

HTH.
Ashwin.

-----Original Message-----
From: Kumar_maniranjan [mailto:Kumar_maniranjan@infy.com]
Sent: Tuesday, April 30, 2002 5:52 AM
To: Log4J Users List
Subject: How to log into two different files using single props file ??


Wanted to LOG some performance related messages into one file
PERFORMANCE.LOG and generic logiing to be done into 
GENERIC.LOG .... 
But not able to do it with one properties file... 

Is there neway ??

Rgds,
Mani

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>

Re: How to log into two different files using single props file ??

Posted by Laith Al-Khateeb <lk...@yahoo.com>.
Hi Mani,
Define a logger (or category) in your code, say "perf"
that you would use for logging performance info and
another logger for the generic logs.
In your properties file, define the loggers:

log4j.logger.perf=DEBUG, PERFORMANCE
and set its aditivity to false so that you don't get
the other logs into this file
log4j.logger.perf.additivity=false

for the generic logger, you can use the root logger
appender or define its own appender same way as for
the perf logger above.

Regards,
Laith

--- Kumar_maniranjan <Ku...@infy.com>
wrote:
> Wanted to LOG some performance related messages into
> one file
> PERFORMANCE.LOG and generic logiing to be done into 
> GENERIC.LOG .... 
> But not able to do it with one properties file... 
> 
> Is there neway ??
> 
> Rgds,
> Mani
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>