title: How to get Log4perl rotating my logs daily?
body: <p>I'm reading up on <a href="http://search.cpan.org/~mschilli/Log-Log4perl-1.40/lib/Log/Log4perl.pm" rel="nofollow">Log4perl</a> and want to try and use it for simple log management of my Perl scripts running on a Linux box. I've also read up on <code>newsyslog</code> and <code>logrotate</code> but want to use Log4perl if at all possible.</p>
  
  <p>I'm trying to configure the <code>/etc/log4perl.conf</code> file so that it:</p>
  
  <ul>
  <li>Defines a <code>widget</code> logger (<code>INFO</code> level) that will write all output to <code>/opt/myapp/logs/myapp-&lt;datetime&gt;.log</code>, where <code>&lt;datetime&gt;</code> is a date/time formatted string like <code>2012-12-20</code></li>
  <li>This <code>myapp-&lt;datetime&gt;.log</code> file needs to be rotated daily (preferably at midnight), where the old file is deleted, and a new file is created with <code>&lt;datetime&gt; + 1</code>. For instance, <code>myapp-2012-12-20.log</code> would be replaced with <code>myapp-2012-12-21.log</code>, etc.</li>
  </ul>
  
  <p>Here's my best attempt which I believe is close, but is still missing some configuration:</p>
  
  <pre><code>#####/etc/log4perl.conf############################################################
  log4perl.logger.widget                      = INFO, MyAppLogAppender
  
  log4perl.appender.MyAppLogAppender          = Log::Log4perl::Appender::File
  log4perl.appender.MyAppLogAppender.filename = /opt/myapp/logs/myapp-???.log
  log4perl.appender.MyAppLogAppender.layout   = Log::Log4perl::Layout::SimpleLayout
  ###################################################################################
  </code></pre>
  
  <p><strong>How do I configure <code>log4perl.appender.MyAppLogAppender</code> to rotate once a day, delete the old file, and create a new one with a correct timestamp?</strong> Thanks in advance.</p>