Acme-CPANModulesBundle-Import-PerlDancerAdvent-2018

 view release on metacpan or  search on metacpan

devdata/http_advent.perldancer.org_2018_19  view on Meta::CPAN

to name a few), and a couple of them even include appenders for Log4perl. In looking at our own
needs, however, they all seemed to be overkill.</p>
<p>At <code>$work</code>, everything is based on Log4perl (and, in our client-facing Java apps, Log4j), so 
there has never been need for another logger. We'd been happily using <code>Dancer::Logger::Log4perl</code>
for years, and wanted to continue to use something familar to us. Before investing some time in
writing our own Log4perl plugin for Dancer2, we expanded our search beyond metacpan, and were
rewarded in doing so.</p>
<p>We stumbled across a project from Ryan Larscheidt and Jon Miner at the University of Wisconsin.
They wrote a Log4perl plugin for Dancer2 with the intent of releasing it, but as their priorities
and projects shifted, it never made its way to CPAN. I used to go to MadMongers (Madison Perl Mongers),
so before long, I was able to track them down and they gave me their blessing to release it.</p>
<p>A little packaging and a few tests later, <code>Dancer2::Logger::Log4perl</code> was on its way to CPAN!</p>
<h2><a name="configuration"></a>Configuration</h2>

<p>First, we need to create a basic Log4perl configuration. Create a new Dancer2 application (I'll call
mine <code>TestLog4perl</code>), and in the application directory create a <i>log4perl.conf</i> file with the following:</p>
<pre class="prettyprint">log4perl.rootLogger              = DEBUG, LOG1

log4perl.appender.LOG1           = Log::Log4perl::Appender::File
log4perl.appender.LOG1.filename  = logs/mylog.log
log4perl.appender.LOG1.mode      = append



( run in 1.471 second using v1.01-cache-2.11-cpan-de7293f3b23 )