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 waltz co <wa...@yahoo.com> on 2006/03/06 05:25:46 UTC
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.