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 Ramesh RGVS <ra...@yahoo.com> on 2004/01/13 07:19:37 UTC
How to set 2 file names in log4j.properties
Hi All
I am using log4j in my applications.
i have a problem in directing the logs to different
files.
For examples i have 2 java programs and i wanted to
direct the messages to different files.
i have created 2 appenders in log4j.property file as
below
log4j.rootCategory=DEBUG, R,R1, stdout
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.append=true
log4j.appender.R.file=TestLog.log
log4j.appender.R.maximumFileSize=10240000
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.conversionPattern=%d [%t] %-5p
%c %M.%L %x -%m%n
log4j.appender.R1=org.apache.log4j.RollingFileAppender
log4j.appender.R1.append=true
log4j.appender.R1.file=TestLog1.log
log4j.appender.R1.maximumFileSize=10240000
log4j.appender.R1.layout=org.apache.log4j.PatternLayout
log4j.appender.R1.layout.conversionPattern=%d [%t]
%-5p %c %M.%L %x -%m%n
I want to know how to associate in my java program.
Currently my both java programs are writing messages
into same file though i declared 2 appenders.
In my java programs i am creating a handle for
catagory class as below and uding
static Category cat =
Category.getInstance(TestLogging.class.getName());
Please let me know how would i associate the appenders
to java programs and direct the log to different files
Regards
Ramesh
__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org