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 Is...@ny.frb.org on 2002/07/24 16:27:20 UTC
Can anyone explain this?
Hi.
I need to dynamically define the name of my RollingFileAppender (We have
amny environments and I don't want to have to keep on changing the config
file). Since I also don't want the headache of maintaining system
properties I decided on doing it via the code as follows:
System.setProperty("logFile.name", getServletContext().getRealPath
("/WEB-INF/logs") + "\\test.log");
The config file looks like this:
<appender name="A2" class="org.apache.log4j.DailyRollingFileAppender">
<param name="Append" value="true"/>
<param name="File" value="${logFile.name}"/>
....
This works because all our environments conform to the Servlets 2.1
directory specs.
What's wierd is that even though I define the "Append" attribute to "true",
log4j still truncates the file each time the servlet engine is bounced. If
I hard-code the file name in the config file it works fine (even if I
hard-code the absolute path).
Can anyone explain this?
Thank you.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Can anyone explain this?
Posted by Ceki Gülcü <ce...@qos.ch>.
At 10:27 24.07.2002 -0400, you wrote:
>Hi.
>
>I need to dynamically define the name of my RollingFileAppender (We have
>amny environments and I don't want to have to keep on changing the config
>file). Since I also don't want the headache of maintaining system
>properties I decided on doing it via the code as follows:
>
>System.setProperty("logFile.name", getServletContext().getRealPath
>("/WEB-INF/logs") + "\\test.log");
>
>The config file looks like this:
>
><appender name="A2" class="org.apache.log4j.DailyRollingFileAppender">
> <param name="Append" value="true"/>
> <param name="File" value="${logFile.name}"/>
>....
>
>This works because all our environments conform to the Servlets 2.1
>directory specs.
>
>What's wierd is that even though I define the "Append" attribute to "true",
>log4j still truncates the file each time the servlet engine is bounced. If
>I hard-code the file name in the config file it works fine (even if I
>hard-code the absolute path).
>
>Can anyone explain this?
>
>Thank you.
What do you mean exactly by "when the servlet engine is bounced"?
--
Ceki
For complete log4j documentation please refer to http://qos.ch/log4jBook.html
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>