You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Argyro Kazaki <ak...@eworx.gr> on 2007/03/28 14:57:03 UTC

log4j properties and unit tests

Hello,

within log4j.properties file, I have the following:

log4j.logger.system             =ALL, sys
...
log4j.appender.sys.file=${catalina.home}/logs/foo.log

When the container is up, it works fine. When I run unit tests though, 
${catalina.home} is null and all the logging infos are gone. Is there 
something I can do about it so that I don't have to hardcode the path 
(e.g. log4j.appender.sys.file=C:/Apache/logs/foo.log ) or to change the 
property file every time I want to run the tests??

Thanks,
Argyro Kazaki




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


Re: log4j properties and unit tests

Posted by Jacob Kjome <ho...@visi.com>.
Personally, I use a separate Log4j config file for build-time -vs- run-time. 
But if you must use the same file, you can always set the property when you run
the tests.  For instance, using Ant...

<junit ...>
  <sysproperty
    key="catalina.home"
    value="${path_to_log_dir}"/>
  ...
  ...
  ...
</junit>


Jake

Quoting Argyro Kazaki <ak...@eworx.gr>:

> Hello,
>
> within log4j.properties file, I have the following:
>
> log4j.logger.system             =ALL, sys
> ...
> log4j.appender.sys.file=${catalina.home}/logs/foo.log
>
> When the container is up, it works fine. When I run unit tests though,
> ${catalina.home} is null and all the logging infos are gone. Is there
> something I can do about it so that I don't have to hardcode the path
> (e.g. log4j.appender.sys.file=C:/Apache/logs/foo.log ) or to change the
> property file every time I want to run the tests??
>
> Thanks,
> Argyro Kazaki
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>




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


Re: log4j properties and unit tests

Posted by James Stauffer <st...@gmail.com>.
Set the catalina.home environment variable before running unit tests.

On 3/28/07, Argyro Kazaki <ak...@eworx.gr> wrote:
> Hello,
>
> within log4j.properties file, I have the following:
>
> log4j.logger.system             =ALL, sys
> ...
> log4j.appender.sys.file=${catalina.home}/logs/foo.log
>
> When the container is up, it works fine. When I run unit tests though,
> ${catalina.home} is null and all the logging infos are gone. Is there
> something I can do about it so that I don't have to hardcode the path
> (e.g. log4j.appender.sys.file=C:/Apache/logs/foo.log ) or to change the
> property file every time I want to run the tests??
>
> Thanks,
> Argyro Kazaki
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>


-- 
James Stauffer        http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/

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