I use ${catalina.home} and now I can get rid of my extra
log4j.unix.properties. Thx, Tim.

-----Original Message-----
From: Tim Shadel [mailto:[EMAIL PROTECTED] 
Sent: April 2, 2003 11:03 PM
To: Struts Users Mailing List
Subject: Re: [OT] log4j file path issue

I think this works.

A quick look at the Log4j list (like Craig suggested) turned up these 
threads:

These seem to hit the suggestions already offered:

http://www.mail-archive.com/[EMAIL PROTECTED]/msg08056.html
http://www.mail-archive.com/[EMAIL PROTECTED]/msg06026.html

This one seems to be the most interesting:

http://www.mail-archive.com/[EMAIL PROTECTED]/msg05432.html

It appears that you can use ${some-system-property} in your config 
files.  We do something similar to you, so I just tried this on our 
setup and it worked:

log4j.appender.A1=org.apache.log4j.DailyRollingFileAppender
log4j.appender.A1.DatePattern='-'yyyy-MM-dd
log4j.appender.A1.File=${catalina.base}/logs/my.log

I took advantage of the "-Dcatalina.base" property already defined in 
the catalina.sh file used to start Tomcat.  If you'd like to use a 
custom System property this URL

http://jakarta.apache.org/log4j/docs/manual.html#defaultInit

describes how to set log4j properties using the CATALINA_OPTS 
environment variable, though I'm sure there are sources that give more 
direct instructions for setting System properties for Tomcat.

Hope that helps,

Tim

P.S.  I suppose this should get posted to Log4j's list too; but I'm also

too lazy to go through the signup process and setup mail filters. :-)

Dan Allen wrote:
> *This message was transferred with a trial version of CommuniGate(tm)
Pro*
> I am working with a jsp developer who uses windows, where I use
> linux.  When he checks out a copy of the application in the revision
> system, the log4j.properties file is not playing fair.  I have in it
> 
> log4j.appender.default.File=/var/tomcat4/logs/struts.log
> 
> But his path to tomcat is not the same.  If I try to do
> 
> log4j.appender.default.File=struts.log
> 
> then in linux it tries to make the file in / and doesn't understand
> relative paths. (Note: I am initializing log4j.properties in a init
> servlet like suggested in the manual).
> 
> How do I specify that I want the log file in the "logs" directory of
> the tomcat installation.  Even if I have to set something in the
> init servlet, I will do that, but HOW HOW HOW???  argh...apart from
> having 2 log4j.properties files.
> 
> Dan
> 



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


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

Reply via email to