title: Log4j configuration: How to create a new folder for each day?
body: <p>So, we are using Log4j's <code>DailyRollingFileAppender</code> to create our log files.  This is really nice as it can create a new file for each day or hour.  We'd like the appender to create a new folder based on the day, then new log files based on the hour.  Is this possible?</p>
  
  <p>Here is our current configuration... currently set up to dump ALL log files (created hourly) into <code>someFolder</code>.  I'd guess we can do something fancy in the "File" param to do what we want:</p>
  
  <pre><code>    &lt;appender name="PlainFileAppender" class="org.apache.log4j.DailyRollingFileAppender"&gt;
          &lt;param name="File" value="someFolder/someFileName_plain.log" /&gt;
          &lt;param name="DatePattern" value=".yyyy-MM-dd-HH" /&gt;
              &lt;param name="ImmediateFlush" value="true" /&gt;
              &lt;layout class="org.apache.log4j.PatternLayout"&gt;
              &lt;param name="ConversionPattern"
                  value="%d %-5p [%t] %c{1}: %m%n" /&gt;
          &lt;/layout&gt; 
              &lt;filter class="com.trgr.cobalt.infrastructure.logging.ClassFilter"&gt;
                  &lt;param name="classNameFilter" value="com.trgr.cobalt.infrastructure.logging.LogRecord" /&gt;
                  &lt;param name="acceptOnMatch" value="false" /&gt; 
                  &lt;param name="neutrality" value="true" /&gt;
              &lt;/filter&gt;
      &lt;/appender&gt;
  </code></pre>