| Catalyst-Plugin-Log4perl-Simple documentation | Contained in the Catalyst-Plugin-Log4perl-Simple distribution. |
Catalyst::Plugin::Log4perl::Simple - Simple Log4perl setup for Catalyst application
version 0.004
use Catalyst qw/ ... Log4Perl::Simple /;
$c->log->warn("Now we're logging through Log4perl");
This is a trivial Catalyst plugin that searches for a log4perl configuration file and uses it to configure Catalyst::Log::Log4perl as the logger for your application. If no configuration is found, a sensible default is provided.
For an application My::App, the following locations are searched:
Called by Catalyst to set up the plugin. You should not need to call this yourself.
There is no test suite.
Catalyst::Log::Log4perl
Peter Corlett <abuse@cabal.org.uk>
This software is copyright (c) 2011 by Peter Corlett.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
| Catalyst-Plugin-Log4perl-Simple documentation | Contained in the Catalyst-Plugin-Log4perl-Simple distribution. |
package Catalyst::Plugin::Log4perl::Simple; BEGIN { $Catalyst::Plugin::Log4perl::Simple::DIST = 'Catalyst-Plugin-Log4perl-Simple'; } BEGIN { $Catalyst::Plugin::Log4perl::Simple::VERSION = '0.004'; } # ABSTRACT: Simple Log4perl setup for Catalyst application use Moose; use namespace::autoclean; use List::Util qw( first ); use Catalyst::Log::Log4perl; sub setup { my $package = shift; my $pkgname = ref $package || $package; my $confname = lc $pkgname; $confname =~ s/::/_/g; my $logpath = first { -s $_ } ( "${confname}_log.conf", "log.conf", "../${confname}_log.conf", "../log.conf", "/etc/${confname}_log.conf", "/etc/$confname/log.conf" ); if (defined $logpath) { $package->log(Catalyst::Log::Log4perl->new($logpath)); } else { $package->log(Catalyst::Log::Log4perl->new()); $package->log->warn('no log4perl configuration found'); } $package->maybe::next::method(@_); } __PACKAGE__->meta->make_immutable; 1; __END__