Skip Menu |

This queue is for tickets about the MojoX-Log-Log4perl CPAN distribution.

Report information
The Basics
Id: 78924
Status: resolved
Priority: 0/
Queue: MojoX-Log-Log4perl

People
Owner: Nobody in particular
Requestors: STOCKS [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.04
Fixed in: (no value)



Subject: Increasing log level above debug breaks rendering of actionless routes in Mojolicious
If a Mojolicious application is using automatic rendering without a controller (only a template) and the log-level is set above debug, these actionless routes will throw an error: http://mojolicio.us/perldoc/Mojolicious/Guides/Rendering#Automatic_rendering This is because the "debug" method is returning false when using MojoX::Log::Log4perl and the log level is set above "debug." Specifically it is this line in Mojolicious::Routes that exposes the problem: $c->app->log->debug("$app does not exist, maybe a typo?") and return unless ref $e; MojoX::Log::Log4perl should probably maintain the return values of Mojo::Log and return true in these cases for compatibility purposes. The workaround is to set the logger to DEBUG but bump the level up on appenders. This works around the problem, but isn't ideal.
Hi there! Thanks for the report. As of version 0.05 (should hit cpan in a few minutes) all logging methods return the object itself. Not only should this fix the issue, but it will also allow method chaining and other manipulation. E.g.: $logger->debug('Tons of data')->info('I am here'); Please let me know if there's still an issue and we'll reopen the ticket. Thanks again for the report, and for using MojoX::Log::Log4perl. Cheers! On Sun Aug 12 11:27:03 2012, STOCKS wrote: Show quoted text
> If a Mojolicious application is using automatic rendering without a > controller (only a template) > and the log-level is set above debug, these actionless routes will > throw an error: > >
http://mojolicio.us/perldoc/Mojolicious/Guides/Rendering#Automatic_rendering Show quoted text
> > This is because the "debug" method is returning false when using > MojoX::Log::Log4perl and > the log level is set above "debug." Specifically it is this line in > Mojolicious::Routes that > exposes the problem: > > $c->app->log->debug("$app does not exist, maybe a typo?") and > return > unless ref $e; > > MojoX::Log::Log4perl should probably maintain the return values of > Mojo::Log and return true > in these cases for compatibility purposes. > > The workaround is to set the logger to DEBUG but bump the level up on > appenders. This > works around the problem, but isn't ideal.