Unit tests - log4j
Hi,
I am using log4j and this is a fragment from my log4j.properties file:
log4j.appender.gen.file=${catalina.home}/logs/foo.log
When the container is up, ${catalina.home} is interpreted to the correct path. How about when running unit tests though? Is there any configuration so ${catalina.home} can be recognized as a global variable even if the server is not running?
Thanks
[461 byte] By [
ar.kaza] at [2007-11-26 21:55:02]

> Hi,
>
> I am using log4j and this is a fragment from my
> log4j.properties file:
>
> > log4j.appender.gen.file=${catalina.home}/logs/foo.log
>
>
> When the container is up, ${catalina.home} is
> interpreted to the correct path. How about when
> running unit tests though? Is there any configuration
> so ${catalina.home} can be recognized as a global
> variable even if the server is not running?
>
> Thanks
Well if it is a Unit test can you not hard code the value? this isn't perfect but it is hardly criminal either.
> Is there any configuration so ${catalina.home}
> can be recognized as a global variable even if
> the server is not running?
>
> Thanks
Is it an environment variable? If it is, you could just add it as a -D argument to the JVM:
java -Dcatalina.home="/usr/blah/..."