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:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to