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 ...

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


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?

Thanks,

Greg

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