text: Q:
  
  Log4j2: TimeBasedTriggeringPolicy strategy max not works
  
  "appender.file-log.strategy" isn't working well. My folder contains over 30 files. Do you have any suggestions? I'd like a maximum of 20 files.
  Log4j2 version: 2.12.1
  This is my code:
  appender.file-log.type=RollingFile
  appender.file-log.name=FileLog
  appender.file-log.fileName=logs/myfolder/daily.log
  appender.file-log.filePattern=logs/myfolder/daily.log.%d{yyyyMMdd}.%i.gz
  appender.file-log.layout.type=PatternLayout
  appender.file-log.layout.pattern=[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n
  appender.file-log.policies.type=Policies
  appender.file-log.policies.date.type=TimeBasedTriggeringPolicy
  appender.file-log.policies.date.interval=1
  appender.file-log.strategy.type=DefaultRolloverStrategy
  appender.file-log.strategy.max=20
  
  A:
  
  I tried with this solution and it seems to work well. I deleted the property 
  appender.file-log.strategy.max=20
  
  and I replaced it with this code (after the appender.filelog.strategy.type):
  appender.file-log.strategy.type=DefaultRolloverStrategy
  appender.file-log.strategy.delete.type=Delete
  appender.file-log.strategy.delete.basePath=logs/myFolder/
  appender.file-log.strategy.delete.maxDepth=1
  appender.file-log.strategy.delete.ifAccumulatedFileCount.type=IfAccumulatedFileCount
  appender.file-log.strategy.delete.ifAccumulatedFileCount.exceeds=20
  
  