Hi

Try this:

Create 3 properties files named log4j_1211.properties or whatever name
you like and in each properties file (you will have 3 properties files
for your 3 application instances) change the path to the log file.

add -Dlog4j.configuration=log4j.properties to your command line pointing
to each properties file
e.g.    java com.sample.MyApp
-Dlog4j.configuration=log4j_1211.properties 1211
        java com.sample.MyApp
-Dlog4j.configuration=log4j_1311.properties 1311
        java com.sample.MyApp
-Dlog4j.configuration=log4j_1411.properties 1411

This tells log4j to use that particular file for its config.

Hope this helps
Graham Renney 

-----Original Message-----
From: Bender Heri [mailto:[EMAIL PROTECTED] 
Sent: Monday 06 March 2006 11:20
To: Log4J Users List
Subject: RE: different log4J log files for same application

This issue was discussed last week extensively. See mail archive.
Heri

> -----Original Message-----
> From: waltz co [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 06, 2006 5:26 AM
> To: [email protected]
> Subject: different log4J log files for same application
> 
> 
> hi, 
>   i have an application that listens to a specific port to do its 
> task.
> this app runs on multiple instances by specifying different ports in 
> the argument.
>    
>   MyApp-1211.bat contains 
>     java com.sample.MyApp 1211
>   
>  
>   MyApp-1311.bat contains 
>    java com.sample.MyApp 1311
>   
>  
>   MyApp-1411.bat contains 
>    java com.sample.MyApp 1411
> 
>      this application logs to a file. the problem is all 3 instances 
> log into a single file, myApp.log. is there a way to tell log4j to use

> different log files, like:
> 
> myApp-port1211.log
> myApp-port1311.log
> myApp-port1411.log
>    
>   can you tell me how do i configure my log4j.properties file to 
> achive this? here's my current configuration file:
>    
> log4j.rootCategory=DEBUG, R
> log4j.logger.com=DEBUG, R
> log4j.logger.com.sample.MyApp=INFO,stdout
> 
> # stdout is console output
> log4j.appender.stdout=org.apache.log4j.ConsoleAppender
> log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
> log4j.appender.stdout.layout.ConversionPattern=%m%n
> 
> # R is set to a log file that rolls over to a new file after the 
> MaxFileSize size.
> # One backup log file is kept
> log4j.appender.R=org.apache.log4j.RollingFileAppender
> log4j.appender.R.File=../../logs/myApp.log
> log4j.appender.R.MaxFileSize=5000KB
> #Keep one backup file
> log4j.appender.R.MaxBackupIndex=3
> log4j.appender.R.layout=org.apache.log4j.PatternLayout
> log4j.appender.R.layout.ConversionPattern=%d~%p~%c~ %m%n
>    
> thanks.
> 
>         
> 
> 
>               
> ---------------------------------
> Yahoo! Mail
> Bring photos to life! New PhotoMail  makes sharing a breeze. 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

This message and any attachments are confidential and intended solely for the 
addressee. If you have received this message in error, please notify Discovery 
immediately, telephone number +27 11 529 2888. Any unauthorised use; alteration 
or dissemination of the contents of this email is strictly prohibited. In no 
event will Discovery or the sender be liable in any manner whatsoever to any 
person for any loss or any direct, indirect, special or consequential damages 
arising from use of this email or any linked website, including, without 
limitation, from any lost profits, business interruption, loss of programmes or 
other data that may be stored on any information handling system or otherwise 
from any assurance that this email is virus free even if Discovery is expressly 
advised of the possibility of such damages. Discovery is an Authorised 
Financial Services Provider.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to