Hi all - 

Please forgive me if this has been asked a thousand times before.  I've
searched high and low around the net and on both the tomcat-user and the
log4j-user lists.  I've also ordered the full log4j manual but it hasn't
arrived yet.  My question lies (I think) somewhere between the servlet
specification, the tomcat implementation, and the way the log4j.properties
file is loaded.  I'm using Tomcat 5.0.28 in linux and win xp and I'm running
with sdk 1.4.2_05 for now. 

I'm wondering if it is possible to place your logfiles using an external
property (as below) without using the -D option when invoking tomcat.  My
operations team is concerned about setting the property externally at the
user level when we start Tomcat because they do not want to run a
non-standard implementation.  I have tried a number of things that I thought
might work including setting the property through the web.xml's
context-param tag and setting it in the <context> at the server.xml level
but always without success.

When I attempt to start tomcat (without the -Dts.home=/path_to_logs) I get
the following abbreviated stack trace:

log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: \logs\logfile.log (The system cannot find the
path specified)
        at java.io.FileOutputStream.openAppend(Native Method)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:177)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:102)
        at org.apache.log4j.FileAppender.setFile(FileAppender.java:272)
        at
org.apache.log4j.FileAppender.activateOptions(FileAppender.java:151)
        at
org.apache.log4j.DailyRollingFileAppender.activateOptions(DailyRollingFileAp
pender.java:206)
        at
org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:247)
        at
org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:123
)
        at
org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:87)
        ...

For all three appenders so it appears that the ${ts.home} reference is being
ignored.

My log4j.properties file resides in my webapp's WEB-INF/classes directory
and it looks like this:

log4j.additivity.auditor=false
log4j.additivity.vpnlog=false
log4j.rootLogger=INFO, fileout

log4j.category.vpnlog=DEBUG, vpn
log4j.category.auditor=DEBUG, audit

log4j.appender.fileout=org.apache.log4j.DailyRollingFileAppender
log4j.appender.fileout.DatePattern='.'yyyy-MM-dd
log4j.appender.fileout.File=${ts.home}/logs/logfile.log
log4j.appender.fileout.layout=org.apache.log4j.PatternLayout
log4j.appender.fileout.layout.ConversionPattern=%5p %d{dd MMM HH:mm:ss} [%t]
%c - %m%n


log4j.appender.audit=org.apache.log4j.DailyRollingFileAppender
log4j.appender.audit.DatePattern='.'yyyy-MM-dd
log4j.appender.audit.File=${ts.home}/logs/audit.log
log4j.appender.audit.layout=org.apache.log4j.PatternLayout
log4j.appender.audit.layout.ConversionPattern=%d{dd MMM HH:mm:ss} [%t] -
%m%n


log4j.appender.vpn=org.apache.log4j.DailyRollingFileAppender
log4j.appender.vpn.DatePattern='.'yyyy-MM-dd
log4j.appender.vpn.File=${ts.home}/logs/vpn.log
log4j.appender.vpn.layout=org.apache.log4j.PatternLayout
log4j.appender.vpn.layout.ConversionPattern=%5p %d{dd MMM HH:mm:ss} [%t] %c
- %m%n


I really appreciate any advice that anyone can offer.  Thanks and have a
nice weekend.


William

PS - Congrats to Scott on the new son!



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to