logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bob Dill <rd...@cameron.edu>
Subject Log Rotation Not Workig
Date Tue, 17 Jul 2018 14:28:42 GMT
Hi All,


I have a CAS server that uses log4j2 to manage its log files. I tried to configure log rotation
by following the examples, but was unable to. Can anyone see why the old files are not deleted?


        <RollingFile name="file" fileName="${sys:cas.log.dir}/cas.log" append="true"
                     filePattern="${sys:cas.log.dir}/cas-%d{yyyy-MM-dd-HH}-%i.log">
            <PatternLayout pattern="%d %p [%c] - &lt;%m&gt;%n"/>
            <Policies>
                <OnStartupTriggeringPolicy />
                <SizeBasedTriggeringPolicy size="10 MB"/>
                <TimeBasedTriggeringPolicy />
            </Policies>
            <DefaultRolloverStrategy>
                <Delete basePath="${sys:cas.log.dir}" maxDepth="2">
                    <IfFileName glob="*/cas-*.log" />
                    <IfLastModified age="10d" />
                </Delete>
            </DefaultRolloverStrategy>
        </RollingFile>


Obviously, I could create a script and add it to crontab, but I would rather use this.


~ Bob

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