Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How do I specify the location of log4j.log?

807589Sep 18 2008 — edited Sep 18 2008
I want to create the log4j.log file in "C:\TEMP\" for Windows and "/tmp/" for linux. Is there anyway that I can do to that?
Here is what I currently have for my log4j.properties:
# SET ROOT CATEGORY PRIORITY TO DEBUG AND ONLY APPENDER TO A1, C1, R
log4j.rootCategory=DEBUG, C1, R

log4j.appender.C1=org.apache.log4j.ConsoleAppender
log4j.appender.C1.layout=org.apache.log4j.PatternLayout
log4j.appender.C1.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n

log4j.appender.R=org.apache.log4j.RollingFileAppender
#Create the file in Windows
#log4j.appender.R.File=C://TEMP//log4j.log
#Create the file in Linux
log4j.appender.R.File=/tmp/log4j.log
log4j.appender.R.MaxFileSize=15000KB
# KEEP FIVE BACKUP FILES
log4j.appender.R.MaxBackupIndex=5
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n
#log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
Thank You,
Chris

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Oct 16 2008
Added on Sep 18 2008
7 comments
6,639 views