title: To configure log4j2 2.16.0
body: <p>I want to configure log4j2.properties file in a that way where my swapi.log entries delete all previous logs written, for example if we want to delete log entry for upto 30 entries, once it reaches to 30, it automatically gets deleted. Because we don't to occupy server memory.</p>
  <p>So, far I tried this as given below and its working fine in console and appending in log file. But I badly stuck to figure out that how to delete all previous log entries. Any help would be highly appreciated.</p>
  <pre><code>name=PropertiesConfig
  appenders = console, file
  
  appender.console.type = Console
  appender.console.name = STDOUT
  appender.console.layout.type = PatternLayout
  appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
  
  appender.file.type = File
  appender.file.name = LOGFILE
  appender.file.fileName=C:\\SWAPILogs\\swapi.log
  appender.file.layout.type=PatternLayout
  appender.file.layout.pattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
  
  loggers=file
  logger.file.name=com.gds.service
  logger.file.level = debug
  logger.file.appenderRefs = file
  logger.file.appenderRef.file.ref = LOGFILE
  
  rootLogger.level = debug
  rootLogger.appenderRefs = STDOUT
  rootLogger.appenderRef.stdout.ref = STDOUT
  </code></pre>