logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Curt Arnold <carn...@apache.org>
Subject Re: dailyrollingfileappender file location
Date Sat, 20 Mar 2010 02:11:22 GMT
Not sure exactly what you mean by start path, but you use do

<param name="file" value="${user.dir}/filename.log"/>

which would evaluate to the current working directory when the configuration is read or you
could use your own property (set on command line or using System.setProperty() before configuration)
instead of user.dir.

Otherwise, you would need to find the appender, likely by getting a known logger and then
querying its attached appenders, cast the appender to a specific appender class, call the
setFile() and activateOptions method.  Would be a lot messier.


On Mar 19, 2010, at 9:05 AM, AcidDragon wrote:

> I use an xml file to configure my logger, how can I change the
> dailyrollingfileappender file path from my java program?
> 
> The reason I want to change it is that the program may be installed in
> various paths for different deployments, so I do not want to hardcode the
> location of the log file in my log4j.xml, I want to change it to the start
> path of my java class file. I already get the start path so I just need to
> understand how to reconfigure the file path.
> 
> Thanks
> 
> Hendry


---------------------------------------------------------------------
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