Subject: | Conflicts with new Mojolicious default templates and MojoX::Log::Log4perl::format() in v0.10 |
Date: | Fri, 15 Aug 2014 14:55:53 +0930 |
To: | bug-MojoX-Log-Log4perl [...] rt.cpan.org |
From: | Chris Foote <chris [...] foote.com.au> |
In version 0.10 of MojoX::Log::Log4perl, you introduced the printing of a warning when format() is invoked.
The trouble is, a recent change in Mojolicious[1], along with the default development template[2], results in format() always being called, resulting in lots of warnings being printed.
Example
-------
Mojolicious 5.21
MojoX::Log::Log4perl 0.10
Mojolicious startup() method calls:
$self->log( MojoX::Log::Log4perl->new('/path/to/my/log4perl.conf') ); # see [3] for my log4perl config
or with your default config:
$self->log( MojoX::Log::Log4perl->new() );
Using your default config, 404 errors invoke the development template where format() gets called several times:
ADL-MB025:backend cfoote$ carton exec webapp/bin/reports-backend-webapp daemon
[2014/08/15 14:17:32] [mojo] [INFO] Listening at "http://*:3000".
Server available at http://127.0.0.1:3000.
[2014/08/15 14:17:35] [mojo] [DEBUG] Your secret passphrase needs to be changed!!!
[2014/08/15 14:17:35] [mojo] [DEBUG] GET "/fred".
[2014/08/15 14:17:35] [mojo] [DEBUG] Template "not_found.development.html.ep" not found.
[2014/08/15 14:17:35] [mojo] [DEBUG] Template "not_found.html.ep" not found.
[2014/08/15 14:17:35] [mojo] [DEBUG] Rendering inline template "569839bd27413e47e26c8476bacb2540".
[2014/08/15 14:17:35] [mojo] [DEBUG] Rendering inline template "4fcf2af99f1803a7a26c2e9b04430f8c".
format() is not properly implemented in MojoX::Log::Log4perl. Please use appenders. at /Users/cfoote/GIT/reports-backend/backend/local/lib/perl5/MojoX/Log/Log4perl.pm line 20.
format() is not properly implemented in MojoX::Log::Log4perl. Please use appenders. at /Users/cfoote/GIT/reports-backend/backend/local/lib/perl5/MojoX/Log/Log4perl.pm line 20.
format() is not properly implemented in MojoX::Log::Log4perl. Please use appenders. at /Users/cfoote/GIT/reports-backend/backend/local/lib/perl5/MojoX/Log/Log4perl.pm line 20.
format() is not properly implemented in MojoX::Log::Log4perl. Please use appenders. at /Users/cfoote/GIT/reports-backend/backend/local/lib/perl5/MojoX/Log/Log4perl.pm line 20.
format() is not properly implemented in MojoX::Log::Log4perl. Please use appenders. at /Users/cfoote/GIT/reports-backend/backend/local/lib/perl5/MojoX/Log/Log4perl.pm line 20.
format() is not properly implemented in MojoX::Log::Log4perl. Please use appenders. at /Users/cfoote/GIT/reports-backend/backend/local/lib/perl5/MojoX/Log/Log4perl.pm line 20.
format() is not properly implemented in MojoX::Log::Log4perl. Please use appenders. at /Users/cfoote/GIT/reports-backend/backend/local/lib/perl5/MojoX/Log/Log4perl.pm line 20.
[2014/08/15 14:17:35] [mojo] [DEBUG] 404 Not Found (0.021274s, 47.006/s).
[2014/08/15 14:17:35] [mojo] [DEBUG] GET "/frontend/styles/main.css".
[2014/08/15 14:17:35] [mojo] [DEBUG] Template "not_found.development.html.ep" not found.
[2014/08/15 14:17:35] [mojo] [DEBUG] Template "not_found.html.ep" not found.
[2014/08/15 14:17:35] [mojo] [DEBUG] Rendering cached inline template "569839bd27413e47e26c8476bacb2540".
[2014/08/15 14:17:35] [mojo] [DEBUG] Rendering cached inline template "4fcf2af99f1803a7a26c2e9b04430f8c".
format() is not properly implemented in MojoX::Log::Log4perl. Please use appenders. at /Users/cfoote/GIT/reports-backend/backend/local/lib/perl5/MojoX/Log/Log4perl.pm line 20.
format() is not properly implemented in MojoX::Log::Log4perl. Please use appenders. at /Users/cfoote/GIT/reports-backend/backend/local/lib/perl5/MojoX/Log/Log4perl.pm line 20.
format() is not properly implemented in MojoX::Log::Log4perl. Please use appenders. at /Users/cfoote/GIT/reports-backend/backend/local/lib/perl5/MojoX/Log/Log4perl.pm line 20.
format() is not properly implemented in MojoX::Log::Log4perl. Please use appenders. at /Users/cfoote/GIT/reports-backend/backend/local/lib/perl5/MojoX/Log/Log4perl.pm line 20.
format() is not properly implemented in MojoX::Log::Log4perl. Please use appenders. at /Users/cfoote/GIT/reports-backend/backend/local/lib/perl5/MojoX/Log/Log4perl.pm line 20.
format() is not properly implemented in MojoX::Log::Log4perl. Please use appenders. at /Users/cfoote/GIT/reports-backend/backend/local/lib/perl5/MojoX/Log/Log4perl.pm line 20.
format() is not properly implemented in MojoX::Log::Log4perl. Please use appenders. at /Users/cfoote/GIT/reports-backend/backend/local/lib/perl5/MojoX/Log/Log4perl.pm line 20.
format() is not properly implemented in MojoX::Log::Log4perl. Please use appenders. at /Users/cfoote/GIT/reports-backend/backend/local/lib/perl5/MojoX/Log/Log4perl.pm line 20.
format() is not properly implemented in MojoX::Log::Log4perl. Please use appenders. at /Users/cfoote/GIT/reports-backend/backend/local/lib/perl5/MojoX/Log/Log4perl.pm line 20.
format() is not properly implemented in MojoX::Log::Log4perl. Please use appenders. at /Users/cfoote/GIT/reports-backend/backend/local/lib/perl5/MojoX/Log/Log4perl.pm line 20.
[2014/08/15 14:17:35] [mojo] [DEBUG] 404 Not Found (0.006664s, 150.060/s).
[1] introduction of Customizable log messages via new format() callback: https://github.com/kraih/mojo/commit/f6488e56f23529754af6e34dc7e75cc665cd78a7
[2] Development template invokes format():
bash-3.2$ ack -- '->log->format'
lib/Mojolicious/templates/development.html.ep
301: <pre><%= app->log->format->(@$msg) %></pre>
[3] My log4perl config, which has an appender:
log4perl.rootLogger=DEBUG, FileAppender1
#
# rotating file appender
# ----------------------
log4perl.appender.FileAppender1 = Log::Dispatch::FileRotate
log4perl.appender.FileAppender1.filename = logs/webapp.log
log4perl.appender.FileAppender1.layout = PatternLayout
log4perl.appender.FileAppender1.layout.ConversionPattern = %d %p> %F{1}:%L %M - %m%n
#
# rotating file appender options for rotation by file size (3 x 1MB)
# ------------------------------------------------------------------
log4perl.appender.FileAppender1.mode = append
log4perl.appender.FileAppender1.size = 1048576
log4perl.appender.FileAppender1.max = 3
Sorry, I don't know enough about Log::Log4perl::format to suggest a solution to this issue :-(
Cheers,
Chris