how to configure log4j path to work both in Tomcat and from the CLI?

2010-03-02 Thread fred basset
Hi All,

I use log4j, I'm trying to configure it so that log4j uses a non
hardcoded path, and it resolves the path both when running under
tomcat and running my unit tests from the CLI with ant.

Here's the relevant line from log4j.properties:

log4j.appender.R.File=${catalina.home}/logs/myapp.log


This works fine when I'm running my app. under Tomcat, but when I try
to run my unit tests from ant, log4j tries to log to /logs/myapp.log
(i.e. resolves ${catalina.home} to nothing).
The CATALINA_HOME environment variable is set correctly.

Thanks if anyone can help me on this.

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: how to configure log4j path to work both in Tomcat and from the CLI?

2010-03-02 Thread Jon Brisbin
On Mar 2, 2010, at 4:10 PM, fred basset wrote:

 Hi All,
 
 I use log4j, I'm trying to configure it so that log4j uses a non
 hardcoded path, and it resolves the path both when running under
 tomcat and running my unit tests from the CLI with ant.
 
 Here's the relevant line from log4j.properties:
 
 log4j.appender.R.File=${catalina.home}/logs/myapp.log
 
 
 This works fine when I'm running my app. under Tomcat, but when I try
 to run my unit tests from ant, log4j tries to log to /logs/myapp.log
 (i.e. resolves ${catalina.home} to nothing).
 The CATALINA_HOME environment variable is set correctly.


Run your ant script with a -D defined for catalina.home (or any other 
properties that exist in your webapp's environment...ant -h is always helpful 
here ;). e.g.:

ant -Dcatalina.home=/opt/tomcat-6

Jon Brisbin
Portal Webmaster
NPC International, Inc.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org