You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dan Allen <da...@mojavelinux.com> on 2003/04/03 00:04:54 UTC

[OT] log4j file path issue

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

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, <da...@mojavelinux.com>
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Windows: where do you want your data to disappear to today?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: [OT] log4j file path issue

Posted by Dan Allen <da...@mojavelinux.com>.
> Sounds like a good question for the Log4J user list :-).
True true, but sometimes I through in an [OT] just not to have to join
yet another mailinglist to post a question.  I am already on like 12
mailinglists and sometimes it is a bit of a barrier to asking a
question to have to join and setup the mail filters.  I guess such
is life because of spammers.  Security sux sometimes.

Dan

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, <da...@mojavelinux.com>
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Windows: where do you want your data to disappear to today?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: [OT] log4j file path issue

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Wed, 2 Apr 2003, Dan Allen wrote:

> Date: Wed, 2 Apr 2003 16:04:54 -0600
> From: Dan Allen <da...@mojavelinux.com>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: Struts-User List <st...@jakarta.apache.org>
> Subject: [OT] log4j file path issue
>
> 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.
>

Sounds like a good question for the Log4J user list :-).

> Dan
>

Craig

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: [OT] log4j file path issue

Posted by apachep2 <ap...@hotmail.com>.
I use ${catalina.home} and now I can get rid of my extra
log4j.unix.properties. Thx, Tim.

-----Original Message-----
From: Tim Shadel [mailto:tim@zserve.com] 
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/log4j-user@jakarta.apache.org/msg08056.html
http://www.mail-archive.com/log4j-user@jakarta.apache.org/msg06026.html

This one seems to be the most interesting:

http://www.mail-archive.com/log4j-user@jakarta.apache.org/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: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: [OT] log4j file path issue

Posted by Tim Shadel <ti...@zserve.com>.
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/log4j-user@jakarta.apache.org/msg08056.html
http://www.mail-archive.com/log4j-user@jakarta.apache.org/msg06026.html

This one seems to be the most interesting:

http://www.mail-archive.com/log4j-user@jakarta.apache.org/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: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: [OT] log4j file path issue

Posted by Dan Allen <da...@mojavelinux.com>.
apachep2 (apachep2@hotmail.com) wrote:

> I want to know too. Currently I use 2 properties files, one for win32,
> one for linux. When I build my app, I let ant detect which to use.

That was one solution I was thinking of but seems pretty lame to
have to do.  Unfortunately my JSP developer isn't building anything
(just editing jsp files) so he won't be running ant at all.

Dan

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, <da...@mojavelinux.com>
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
"I used to herd dairy cows.  Now I herd linux users.  Apart 
from the isolation, I think I preferred the cows.  They were 
better in conversation, easier to milk, and if they annoyed me 
enough, I could shoot them and eat them."
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: [OT] log4j file path issue

Posted by apachep2 <ap...@hotmail.com>.
I want to know too. Currently I use 2 properties files, one for win32,
one for linux. When I build my app, I let ant detect which to use.

-----Original Message-----
From: Dan Allen [mailto:dan@mojavelinux.com] 
Sent: April 2, 2003 5:05 PM
To: Struts-User List
Subject: [OT] log4j file path issue

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

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, <da...@mojavelinux.com>
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Windows: where do you want your data to disappear to today?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org