java - Log4j2 rc 1 DefaultRolloverStrategy overwrites after 7 files -


i using lo4j2 rc1 rollingfile holding timebasedtriggeringpolicy, sizebasedtriggeringpolicy , defaultrolloverstrategy having max files 50. rolled files overwritten after 7 files. below configuration

<appenders>     <routing name="serverlogs">         <routes pattern="$${ctx:logrouter}/">             <route>                 <rollingfile name="serverlogs" immediateflush="false" append="false"                     filename="${loghome}/${ctx:logrouter}/serverlogs.log"                     filepattern="${loghome}/${ctx:logrouter}/%d{dd-mm-yyyy}-serverlogs-%i.log.gz">                     <patternlayout>                         <pattern>%d %p %-40c{1.} [%t] %m %ex%n</pattern>                     </patternlayout>                     <policies>                         <timebasedtriggeringpolicy interval="1"                             modulate="true" />                         <sizebasedtriggeringpolicy size="4 mb" />                         <defaultrolloverstrategy max="50"/>                     </policies>                 </rollingfile>             </route>         </routes>     </routing> </appenders>  <loggers>     <asynclogger name="asyncserverlogs" level="trace" includelocation="false">         <appenderref ref="serverlogs"/>     </asynclogger>           <root level="debug"  includelocation="false">         <appenderref ref="serverlogs" level="trace" />     </root> </loggers> 

am missing configuration?

your <defaultrolloverstrategy max="50"/> element in wrong place.

it's not policy, doesn't belong in <policies> element. in fact, may see following in logs:

error policies has no parameter matches element defaultrolloverstrategy 

move level it's direct child of <rollingfile> element.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -