[Catalyst] Configuration of $c->log with Catalyst::Log::Log4perl
Jochen Luig
skirnir at gmx.net
Thu May 8 15:42:49 BST 2008
Hi,
I'm trying to replace Catalyst's default logger with
Catalyst::Log::Log4perl.
Here's the relevant part of MyApp.pm:
package MyApp;
use strict;
use warnings;
use Catalyst::Runtime '5.70';
use Catalyst::Log::Log4perl;
use Catalyst qw/
-Debug
ConfigLoader
Static::Simple
StackTrace
Authentication
Authentication::Store::DBIC
Authentication::Credential::Password
Authorization::Roles
Authorization::ACL
Session
Session::Store::FastMmap
Session::State::Cookie
FormValidator
FillInForm
I18N
Unicode
Email
/;
use Sys::Hostname;
our $VERSION = '0.01';
__PACKAGE__->config( name => 'MyApp' );
__PACKAGE__->log( Catalyst::Log::Log4perl->new('myapp_logger.conf'));
__PACKAGE__->setup;
This is myapp_logger.conf:
log4perl.rootLogger=DEBUG, SCREEN
log4perl.appender.SCREEN=Log::Log4perl::Appender::Screen
log4perl.appender.SCREEN.mode=append
log4perl.appender.SCREEN.layout=PatternLayout
log4perl.appender.SCREEN.layout.ConversionPattern=[%d] %C <%p> - %m%n
After starting, the Conversion Pattern the logger actually uses looks like:
%d
Trying to find a minimal App producing the problem, I set up a Test
Application and provided
the same config file. There the logger works as expected.
Next I went through the logger configuration in the debugger with both
Apps up to:
Log::Log4perl::Config::BaseConfigurator::text(/usr/lib/perl5/vendor_perl/5.8.8/Log/Log4perl/Config/BaseConfigurator.pm:29):
29: $self->{text} = $text;
there I dumped $text which contained an array ref containing the lines
of the above cited config file (I saved both dumps to files, and diff
told me they were the same except for the numeric parts of the array
refs). Thus I think I can be quite sure that the logger is initialized
with the same config in both Apps.
Still, my original App comes up with the "%d" ConversionPattern.
So, can anyone tell me where I should continue looking for the error?
Can anyone think of a scenario where the logger config gets messed up
after initial configuration?
Thanks,
Jochen
More information about the Catalyst
mailing list