FAQ

[Catalyst] Annoyance with Static::Simple and Log4Perl on Catalyst 5.9

Kieren Diment
Nov 3, 2011 at 8:37 pm
I came across this bug after a recent upgrade to Catalyst 5.9. Static content served by Static::Simple is logged in apps which use Log4Perl for logging.

There was a suggestion that using $c->log->_flush would prevent this (which leaves the question of how to detect a development environment to automate this in development).

To confirm this I wrote a minimal test case, but I'm not sure where to take it from here. Any ideas?

The minimal test case is below:


package StaticTest::Controller::Root;
use Moose;
use namespace::autoclean;
BEGIN { extends 'Catalyst::Controller' }
__PACKAGE__->config(namespace => '');
sub default :Path {
my ( $self, $c ) = @_;
$c->response->body( $c->welcome_message );
}
sub end : ActionClass('RenderView') {
my ($self, $c) = @_;
$c->log->_flush; # doesn't suppress static logging
}
__PACKAGE__->meta->make_immutable;
1;


package StaticTest;
use Moose;
use namespace::autoclean;
use Log::Log4perl::Catalyst;
use Catalyst::Runtime 5.80;
use Catalyst qw/
-Debug
ConfigLoader
Static::Simple
/;
extends 'Catalyst';
our $VERSION = '0.01';
# doesn't suppress logging of static content
after 'finalize' => sub {
my ($self) = @_;
$self->log->_flush;
};
__PACKAGE__->log(Log::Log4perl::Catalyst->new());
__PACKAGE__->config(
name => 'StaticTest',
disable_component_resolution_regex_fallback => 1,
);
__PACKAGE__->setup();
1;



Kieren Diment
PhD Candidate
Health Informatics Research Lab,
Faculty of Informatics,
University of Wollongong
Tel: +61 4221 3952
reply

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 1 | next ›

1 user in discussion

Kieren Diment: 1 post