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 "Wm.A.Stafford" <st...@marine.rutgers.edu> on 2007/03/30 15:04:43 UTC

Two separate log files

I would like to programatically select between two log files, is this 
possible?  One file is the typical log file and the other is used for 
traffic analysis and will be logged to by interceptors that are 
analyzing URL.  Could someone point me to an example of how this is done?

Thanks,
-=bill

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


Re: Two separate log files

Posted by "Wm.A.Stafford" <st...@marine.rutgers.edu>.
Quinn,

    Thanks for the info, you described exactly what I need to do!

    -=bill

Cheung, Quinn wrote:
> I do something similar and the way I do it is by configuring the logger in the Log4J properties file. For example, make "LOGGER_1" use one file appender that writes to "c:\log1.txt". Then use Logger.getLogger( "LOGGER_1" ).error("message") to write to that file. All other loggers can be configured (by configuring the root logger) to an appender that writes to "c:\log2.txt". Then any other logger other than "LOGGER_1" will append to log2.txt.
>
>
>
> -----Original Message-----
> From: Wm.A.Stafford [mailto:stafford@marine.rutgers.edu]
> Sent: March 30, 2007 9:05 AM
> To: log4j-user@logging.apache.org
> Subject: Two separate log files
>
>
> I would like to programatically select between two log files, is this 
> possible?  One file is the typical log file and the other is used for 
> traffic analysis and will be logged to by interceptors that are 
> analyzing URL.  Could someone point me to an example of how this is done?
>
> Thanks,
> -=bill
>
> ---------------------------------------------------------------------
> 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
>
>   


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


RE: Two separate log files

Posted by "Cheung, Quinn" <QC...@rheinmetall.ca>.
I do something similar and the way I do it is by configuring the logger in the Log4J properties file. For example, make "LOGGER_1" use one file appender that writes to "c:\log1.txt". Then use Logger.getLogger( "LOGGER_1" ).error("message") to write to that file. All other loggers can be configured (by configuring the root logger) to an appender that writes to "c:\log2.txt". Then any other logger other than "LOGGER_1" will append to log2.txt.



-----Original Message-----
From: Wm.A.Stafford [mailto:stafford@marine.rutgers.edu]
Sent: March 30, 2007 9:05 AM
To: log4j-user@logging.apache.org
Subject: Two separate log files


I would like to programatically select between two log files, is this 
possible?  One file is the typical log file and the other is used for 
traffic analysis and will be logged to by interceptors that are 
analyzing URL.  Could someone point me to an example of how this is done?

Thanks,
-=bill

---------------------------------------------------------------------
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