logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Thomas <greg.d.tho...@gmail.com>
Subject Triggering a purge programatically
Date Tue, 16 Aug 2016 13:53:28 GMT
Is it possible to programatically trigger a purge?

I've got an XML configured appender along the lines of ...

    <RollingFile name="rfappender" fileName="../logs/output.log"
            <pattern>%d %-5p [%c{1}] %X - %m%n</pattern>
            <OnStartupTriggeringPolicy />
            <SizeBasedTriggeringPolicy size="100 MB"/>

i.e. create new log file on startup, and when the current one reaches
100MB. There is no "max" number of files to keep

I've also got, in code, something that adds a DefaultRolloverStrategy with
the maximum number of files to keep. However, because we already created a
new file (appender.log.nn.zip) on startup, we've probably already exceeded
that number, so I'd like to purge it immediately.

I can't see a way to do that - any ideas?



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message