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: [email protected]
For additional commands, e-mail: [email protected]