• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

log4j property file issue

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to Other Open Source Projects
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic