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 "Chapman, Carol" <Ca...@mdx.com> on 2003/06/05 18:01:06 UTC
how to overwrite log4j file EVERY time you write to it?
I've just discovered this group, so my apologies if this has been posted
before. I looked through the archives but did not see this situation
previously addressed. I've ordered a manual, but it will be awhile before it
arrives.
I inherited a log4j properties file that is in xml format. One of my
appenders is described as follows:
<!-- A time/date based rolling appender for TPF Martindale Report Messages
-->
<appender name="TPFMartindaleReport"
class="org.jboss.logging.appender.DailyRollingFileAppender">
<param name="File"
value="$\{cms.path\}/log/Martindale/tpfMartindale.report"/>
<param name="Append" value="false"/>
<param name="Threshold" value="DEBUG"/>
<!-- Rollover at midnight each day -->
<param name="DatePattern" value="'.'yyyy-MM-dd"/>
<layout class="org.apache.log4j.PatternLayout">
<!-- The full pattern: Date MS Priority [Category] (Thread:NDC)
Message\\n -->
<param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x)
%m%n"/>
</layout>
</appender>
We have an application that can run for days and uses this report to store
accumulated status information. With this particular report, every time I
log to it I would like to completely overwrite anything that might already
be in the file with the most current status. If I don't do this, I will be
repeating information. As you can see, I already have <param name="Append"
value="false"/>, but this only takes care of cases where the application is
restarted. Do you know of a way to overwrite a file EVERY TIME you log to it
without restarting your application?
Thank you for your help,
carol
Carol Chapman
Thomson Healthcare Inc.
Tel. 303-486-9199 (internal = ext. 6199)
Email: carol.chapman@mdx.com