title: Delete old Logs with Log4j2.xml is not working
body: <p>Deleting the 7 days old log files with log4j.xml </p>
  
  <p>I am trying to delete old log files by using <code>DefaultRolloverStrategy</code> but its not working.    </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Configuration status="WARN"&gt;
      &lt;Properties&gt;
          &lt;Property name="log-path"&gt;Logs&lt;/Property&gt;
          &lt;Property name="LOG_PATTERN"&gt;
              [%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n
          &lt;/Property&gt;
      &lt;/Properties&gt;
      &lt;Appenders&gt;
          &lt;Console name="ConsoleAppender" target="SYSTEM_OUT"&gt;
              &lt;PatternLayout pattern="${LOG_PATTERN}" /&gt;
          &lt;/Console&gt;
          &lt;RollingFile name="InfoFileAppender" fileName="${log-path}/demo-app.log"
              filePattern="${log-path}/demo-app-%d{yyyy-MM-dd}.log"&gt;
              &lt;PatternLayout&gt;
                  &lt;pattern&gt;
                      [%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n
                  &lt;/pattern&gt;
              &lt;/PatternLayout&gt;
              &lt;Policies&gt;
                  &lt;TimeBasedTriggeringPolicy interval="1"
                      modulate="true" /&gt;
                  &lt;!--&lt;SizeBasedTriggeringPolicy size="10 MB" /&gt; --&gt;
              &lt;/Policies&gt;
              &lt;DefaultRolloverStrategy&gt;
                  &lt;Delete basePath="${log-path}/" maxDepth="1"&gt;
                      &lt;IfFileName glob="demo-app-*.log" /&gt;
                      &lt;IfLastModified age="7d" /&gt;
                  &lt;/Delete&gt;
              &lt;/DefaultRolloverStrategy&gt;
          &lt;/RollingFile&gt;
          &lt;RollingFile name="ErrorFileAppender" fileName="${log-path}/demo-err.log"
              filePattern="${log-path}/demo-err-%d{yyyy-MM-dd}.log"&gt;
              &lt;PatternLayout&gt;
                  &lt;pattern&gt;
                      [%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n
                  &lt;/pattern&gt;
              &lt;/PatternLayout&gt;
              &lt;Policies&gt;
                  &lt;TimeBasedTriggeringPolicy interval="1"
                      modulate="true" /&gt;
                  &lt;!-- &lt;SizeBasedTriggeringPolicy size="5 MB"/&gt; --&gt;
              &lt;/Policies&gt;
              &lt;DefaultRolloverStrategy&gt;
                  &lt;Delete basePath="${log-path}/" maxDepth="1"&gt;
                      &lt;IfFileName glob="demo-err-*.log" /&gt;
                      &lt;IfLastModified age="7d" /&gt;
                  &lt;/Delete&gt;
              &lt;/DefaultRolloverStrategy&gt;
          &lt;/RollingFile&gt;
      &lt;/Appenders&gt;
      &lt;Loggers&gt;
          &lt;Root level="debug"&gt;
              &lt;AppenderRef ref="InfoFileAppender" level="info" /&gt;
              &lt;AppenderRef ref="ConsoleAppender" level="info" /&gt;
              &lt;AppenderRef ref="ErrorFileAppender" level="error" /&gt;
          &lt;/Root&gt;
      &lt;/Loggers&gt;
  &lt;/Configuration&gt;
  </code></pre>
  
  <p>But its working in my computer but its not working on Linux server. Log files storing path in Linux server is <code>/opt/Logs</code>.</p>
  
  <p>can anyone please help on this.</p>