This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Other Open Source Projects and the fly likes log4j property file issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "log4j property file issue" Watch "log4j property file issue" New topic
Author

log4j property file issue

bill zhang
Greenhorn

Joined: Jul 08, 2009
Posts: 8
I have an ear file deployed on Websphere Application Server. This ear file has plenty of debug statement. WAS uses log4j-1.2.8.jar.
In order to make things easy, I only have one entry in my log4j property file. The content looks like:

log4j.rootLogger=DEBUG, toFile

# Setup for the file output for use with the tracing methods
log4j.appender.toFile=org.apache.log4j.RollingFileAppender
log4j.appender.toFile.File=HECOEES.log
log4j.appender.toFile.MaxFileSize=50MB
log4j.appender.toFile.MaxBackupIndex=5
log4j.appender.toFile.Append=true
log4j.appender.toFile.layout=org.apache.log4j.PatternLayout
log4j.appender.toFile.layout.ConversionPattern=%d{[dd-MM-yy HH:mm:ss:SSS]} [%t] - %m%n

My question is related to log4j.appender.toFile.File setting.

1. (WAS is deployed on a windows box) If I set it to 'HECOEES.log', after WAS gets restarted I can see contents in HECOEES.log.
2. (same environment) If I set it to 'C:/WebSphere/AppServer/logs/HECOEES.log', after WAS gets restarted I didn't see anything in the log. I thought it might be related to using Unix's format '/' in Windows env. Therefore I did test 3.
3. (same environment) If I set it to 'C:\WebSphere\AppServer\logs\HECOEES.log', after WAS gets restarted I still didn't see anything in the log.
4. (WAS is deployed on a Unix box) If I set it to 'logs/HECOEES.log', after WAS gets restarted I can see contents in HECOEES.log.
I haven't done a test with 'logs\HECOEES.log' on Unix box yet.

SO, can someone explain why test2 and test 3 failed? And do absolute/relative path affect log4j? Do Windows/Unix require different setting?
(since test 1 worked, log4j's setting in WAS and ear file are correct.)
Thank you.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19679
    
  18

Moving to Other Open Source Projects


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
wood burning stoves
 
subject: log4j property file issue