logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject Re: log4j.properties and substition of user properties
Date Mon, 24 Aug 2009 04:33:20 GMT
Are you sure this isn't caused by a forked VM, such as via the <ant/> task for
<junit fork="true"/>?  In those cases, the -D command line param won't be passed
to the forked VM.  You'd have to provide those as params to the tasks invoking the
forked VM.

Jake

On 8/19/2009 3:22 PM, jgarrison wrote:
> I have the following in a log4j.properties
> 
> ...
> log4j.appender.LogFile=org.apache.log4j.FileAppender
> log4j.appender.LogFile.layout=org.apache.log4j.PatternLayout
> log4j.appender.LogFile.layout.ConversionPattern=[%6r] %8c{1} : %m%n
> log4j.appender.LogFile.file=${work.dir}/build.log
> log4j.appender.LogFile.append=false
> ...
> 
> This is being used by an invocation of ANT in which the command line
> contains 
> 
>     ....  -Dwork.dir=/a/valid/directory .....
> 
> The ANT property ${work.dir} is successfully referenced in the ANT
> buildfiles, but log4j resolves it to the null string, attempting to put the
> build.log file in the root, which obviously doesn't work.  I know ANT is
> using the log4j.properties because when I put in an absolute path for
> LogFile.file it works correctly.
> 
> Based on my reading of the docs, I expected this to work, and the fact that
> ${work.dir} gets replaced with a null string tells me that log4j is
> attempting to resolve it, but just doesn't have a value for it.  What do I
> need to do to get the value to log4j?
> 
> If this question is more appropriate for an ANT forum I apologize in
> advance.

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


Mime
View raw message