I’m trying to configure correctly log4j2 but it’s not working properly.
I want to create a RollingFile appender that create 10 historic log files and the current log file all with 10MB max size. But now with my appender only create the current log file and the log file with the number 10 contat.
What I’m doing wrong? This is my RollingFile appender declaratio.
<RollingFile name="F1" fileName="${logPath}/cob.log" filepattern="${logPath}/cob.log.%i" append="true" > <LevelRangeFilter minLevel="ERROR" maxLevel="DEBUG" onMatch="ACCEPT" onMismatch="DENY"/> <PatternLayout pattern="[%t] %d{yyyy-MM-dd HH:mm:ss.SSS} %5L %-5p %c{2} %M - %m%n"/> <Policies> <SizeBasedTriggeringPolicy size="10MB" /> </Policies> <DefaultRolloverStrategy max="10"> <Delete basePath="${baseDir}"> <IfAccumulatedFileCount exceeds="10" /> </Delete> </DefaultRolloverStrategy> </RollingFile>
I’m trying to configure correctly RollingFile appender in log4j2