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.