title: log4cxx does not compress the log file
body: <p>I am developing a C++ application that runs on Windows and uses log4cxx to manage the log file.</p>
  <p>This application is executed often and each time it is executed it generates a new log file that is saved as a compressed file in</p>
  <p>C:\MYLOGSBCK\</p>
  <p>and also the log of the last execution is kept in</p>
  <p>C:\MYLOGS\</p>
  <p>With the name
  APP.log</p>
  <p>The following appender is defined in the log4cxx.mxl file:</p>
  <pre><code>  &lt;appender name=&quot;mylog&quot; class=&quot;org.apache.log4j.rolling.RollingFileAppender&quot;&gt;
      &lt;param name=&quot;file&quot; value=&quot;C:/MYLOGS/APP.log&quot;/&gt;
      &lt;param name=&quot;Threshold&quot; value=&quot;Debug&quot;/&gt;
      &lt;param name=&quot;encoding&quot; value=&quot;UTF-8&quot;/&gt;
      &lt;param name=&quot;append&quot; vale=&quot;true&quot;/&gt;
     
      &lt;rollingPolicy class=&quot;org.apache.log4j.rolling.TimeBasedRollingPolicy&quot;&gt;
        &lt;param name=&quot;activeFileName&quot;  value=&quot;C:/MYLOGS/APP.log&quot;/&gt;
        &lt;param name=&quot;fileNamePattern&quot; value=&quot;C:/MYLOGSBCK/APP_%d{yyyy-MM-dd_HHmmss}.log.gz&quot;/&gt;
      &lt;/rollingPolicy&gt;
      &lt;!--&quot;triggeringPolicy&quot;
       &lt;triggeringPolicy class=&quot;org.apache.log4j.rolling.SizeBasedTriggeringPolicy&quot;&gt;
        &lt;param name=&quot;MaxFileSize&quot; value=&quot;5MB&quot;/&gt;
       &lt;/triggeringPolicy&gt;
      &lt;layout class=&quot;org.apache.log4j.PatternLayout&quot;&gt;
        &lt;param name=&quot;ConversionPattern&quot; value=&quot;[%d{dd/MM/yyyy HH:mm:ss,SSS}][%t][%-5p](%c:%L) - %m%n&quot;/&gt;
      &lt;/layout&gt;
    &lt;/appender&gt;
  </code></pre>
  <p>This is working right, but I need to modify the previous appender so that every time the C++ application is executed, the new log lines are added to the end of the C:\MYLOGS\APP.log file if it already exists.
  Also, when this file reaches a size of 5MB it will be copied compressed to C:\MYLOGSBCK\</p>
  <p>I have tried to modify the appender in this way:</p>
  <pre><code>&lt;appender name=&quot;logDebug&quot; class=&quot;org.apache.log4j.FileAppender&quot;&gt;
      &lt;param name=&quot;file&quot; value=&quot;C:/MYLOGS/APP.log&quot; /&gt;
      &lt;triggeringPolicy class=&quot;org.apache.log4j.rolling.SizeBasedTriggeringPolicy&quot;&gt;
          &lt;param name=&quot;MaxFileSize&quot; value=&quot;5MB&quot;/&gt;
      &lt;/triggeringPolicy&gt;   
      &lt;layout class=&quot;org.apache.log4j.PatternLayout&quot;&gt;
          &lt;param name=&quot;ConversionPattern&quot; value=&quot;[%d{dd/MM/yyyy HH:mm:ss,SSS}][%t][%-5p](%c:%L) - %m%n&quot;/&gt;
      &lt;/layout&gt;
  &lt;/appender&gt;
  </code></pre>
  <p>Now the new log lines are added to the end of the C:/MYLOGS/APP.log file, but when it reaches 5MB in size it is not copied to C:\MYLOGSBCK\ (it does not appear compressed there, as I intended, nor without compress).</p>
  <p>I have then tried to modify the appender again, leaving it like this:</p>
  <pre><code>&lt;appender name=&quot;logDebug&quot; class=&quot;org.apache.log4j.FileAppender&quot;&gt;
      &lt;param name=&quot;file&quot; value=&quot;C:/MYLOGS/APP.log&quot; /&gt;
      &lt;rollingPolicy class=&quot;org.apache.log4j.rolling.TimeBasedRollingPolicy&quot;&gt;
        &lt;param name=&quot;activeFileName&quot;  value=&quot;C:/MYLOGS/APP.log&quot;/&gt;
        &lt;param name=&quot;fileNamePattern&quot; value=&quot;C:/MYLOGSBCK/APP_%d{yyyy-MM-dd_HHmmss}.log.gz&quot;/&gt;
      &lt;/rollingPolicy&gt;
      &lt;triggeringPolicy class=&quot;org.apache.log4j.rolling.SizeBasedTriggeringPolicy&quot;&gt;
          &lt;param name=&quot;MaxFileSize&quot; value=&quot;5MB&quot;/&gt;
      &lt;/triggeringPolicy&gt;   
      &lt;layout class=&quot;org.apache.log4j.PatternLayout&quot;&gt;
          &lt;param name=&quot;ConversionPattern&quot; value=&quot;[%d{dd/MM/yyyy HH:mm:ss,SSS}][%t][%-5p](%c:%L) - %m%n&quot;/&gt;
      &lt;/layout&gt;
  &lt;/appender&gt;
  </code></pre>
  <p>The behavior remains the same as before, so now the new log lines are added to the end of the C:/MYLOGS/APP.log file, but when it reaches 5MB in size it is not copied to C:\MYLOGSBCK \ (not compressed there, as intended, nor uncompressed).</p>
  <p>According to the tutorials I have consulted, I do not see where the error is and any suggestion or help is appreciated.</p>