title: RollingFileAppender set RollingPolicy programmatically
body: <p>For reasons I won't get into I'm forced to configure a log4j appender programmatically.</p>
  
  <p>I want to use a RollingFileAppender so I can control the maximum number of files that are kept around.</p>
  
  <p>Also I want to set this appender to use a TimeBasedRollingPolicy as that will automatically take care of compressing the rolled files.</p>
  
  <p>Problem is I can't see a way to set this through code. When setting up a RollingFileAppender normally through a properties file you would have:</p>
  
  <pre><code>log4j.appender.LOGFILE.RollingPolicy=org.apache.log4j.rolling.TimeBasedRollingPolicy
  </code></pre>
  
  <p>There must be a way of setting this .... ? Can anyone shed some light, digging through the javadoc and the basic eclipse-reflection of the classes methods hasn't revealed the solution :(</p>