java - Deleting old log4j files without onstartupriggeringpolicy -
i wondering why log4j2 cant delete old log files without using onstartuptriggeringpolicy.
this 1 log4j configuration works:
<rollingfile name="configlog" append="true" filename="../log/config.log" filepattern="../log/config-%d{yyyy-mm-dd}.log"> <patternlayout pattern="%d %-5p %c{3} [%t]: %m%n" /> <policies> <onstartuptriggeringpolicy/> <timebasedtriggeringpolicy /> <sizebasedtriggeringpolicy size="100 mb" /> </policies> <defaultrolloverstrategy> <delete basepath="../log" maxdepth="1"> <iffilename glob="config-*.log"> <iflastmodified age="30d"/> </iffilename> </delete> </defaultrolloverstrategy> </rollingfile>
but when try without onstartuptriggeringpolicy, doesnt works. here 1 doesnt works.
<rollingfile name="configlog" append="true" filename="../log/config.log" filepattern="../log/config-%d{yyyy-mm-dd}.log"> <patternlayout pattern="%d %-5p %c{3} [%t]: %m%n" /> <policies> <timebasedtriggeringpolicy /> <sizebasedtriggeringpolicy size="100 mb" /> </policies> <defaultrolloverstrategy> <delete basepath="../log" maxdepth="1"> <iffilename glob="config-*.log"> <iflastmodified age="30d"/> </iffilename> </delete> </defaultrolloverstrategy> </rollingfile>
wiki
Comments
Post a Comment