title: log4j.xml Rolling Appender based on size
body: <p>Please find below my log4.xml configuration for rolling file appender</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"&gt;
  
  &lt;log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'&gt;
  
  
      &lt;appender name="instrumentationAppender" class="org.apache.log4j.RollingFileAppender"&gt;
         &lt;param name="file" value="C:\\Users\\Test\\Downloads\\Testlogs\\instrumentation.log"/&gt;
          &lt;param name="Append" value="true" /&gt;
          &lt;param name="Encoding" value="UTF-8" /&gt;
          &lt;param name="MaxFileSize" value="100KB"/&gt;
          &lt;param name="MaxBackupIndex" value="10"/&gt;
          &lt;layout class="org.apache.log4j.PatternLayout"&gt;
              &lt;param name="ConversionPattern" value="%d %-5p [%t] (%C:%L) - %m%n"/&gt;
          &lt;/layout&gt;
            &lt;filter class="org.apache.log4j.varia.LevelRangeFilter"&gt;
              &lt;param name="LevelMin" value="INFO" /&gt;
              &lt;param name="LevelMax" value="INFO" /&gt;
              &lt;param name="AcceptOnMatch" value="true" /&gt;
          &lt;/filter&gt;
      &lt;/appender&gt;
  
  
      &lt;appender name="debugAppender" class="org.apache.log4j.RollingFileAppender"&gt;
         &lt;param name="file" value="C:\\Users\\Test\\Downloads\\Testlogs\\Test.log"/&gt;
          &lt;param name="Append" value="true" /&gt;
          &lt;param name="Encoding" value="UTF-8" /&gt;
          &lt;param name="MaxFileSize" value="100KB"/&gt;
          &lt;param name="MaxBackupIndex" value="10"/&gt;
          &lt;layout class="org.apache.log4j.PatternLayout"&gt;
              &lt;param name="ConversionPattern" value="%d %-5p [%t] (%C:%L) - %m%n"/&gt;
          &lt;/layout&gt;
          &lt;param name="ImmediateFlush" value="true" /&gt;
            &lt;filter class="org.apache.log4j.varia.LevelRangeFilter"&gt;
              &lt;param name="LevelMin" value="DEBUG" /&gt;
              &lt;param name="LevelMax" value="DEBUG" /&gt;
              &lt;param name="AcceptOnMatch" value="true" /&gt;
          &lt;/filter&gt;
      &lt;/appender&gt;
  
        &lt;appender name="errorAppender" class="org.apache.log4j.RollingFileAppender"&gt;
         &lt;param name="file" value="C:\\Users\\Test\\Downloads\\Testlogs\\Test.log"/&gt;
          &lt;param name="Append" value="true" /&gt;
          &lt;param name="Encoding" value="UTF-8" /&gt;
          &lt;param name="MaxFileSize" value="100KB"/&gt;
          &lt;param name="MaxBackupIndex" value="10"/&gt;
          &lt;layout class="org.apache.log4j.PatternLayout"&gt;
              &lt;param name="ConversionPattern" value="%d %-5p [%t] (%C:%L) - %m%n"/&gt;
          &lt;/layout&gt;
            &lt;filter class="org.apache.log4j.varia.LevelRangeFilter"&gt;
              &lt;param name="LevelMin" value="ERROR" /&gt;
              &lt;param name="LevelMax" value="FATAL" /&gt;
              &lt;param name="AcceptOnMatch" value="true" /&gt;
          &lt;/filter&gt;
      &lt;/appender&gt;
  
      &lt;category name="com.practice.Test" additivity="false"&gt;
          &lt;priority value="DEBUG"/&gt;
          &lt;appender-ref ref="instrumentationAppender" /&gt;
          &lt;appender-ref ref="debugAppender" /&gt;
          &lt;appender-ref ref="errorAppender" /&gt;
      &lt;/category&gt;
  </code></pre>
  
  <p></p>
  
  <p>The issue is instrumentationAppender,debugAppender and errorAppender are refered by com.practice pakaage as defined in above category. In all the appenders maxFileSize is 100kb and configured for Test.log file. The issue Test.log file does not get rollover after 100kb of size. All logs just get appended to same Test.log file. How do configure RollingAppender based on size?</p>
  
  <p>Thanks in advance for the help.</p>