Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: chris [...] foote.com.au
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.11



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
Hi Breno, I've submitted a pull request that fixes this - it implements the format() function and just joins the passed-in lines with newline characters. Cheers Brad
Show quoted text
> Changes for version 0.11 > format() warning only once per run (thanks Chris Foote for reporting the issue and Brad Macpherson for the patch)
Unfortunately this still clutters up unit test reports as the warning is printed once for every file. Please give us a way to completely disable this warning. /home/geira/projects/weatherapi3/src/Metno-WeatherAPI/t/nowcast.t ..................... ok /home/geira/projects/weatherapi3/src/Metno-WeatherAPI/t/oceanforecast.t ............... 1/? format() is not properly implemented in MojoX::Log::Log4perl. Please use appenders. at /home/geira/projects/weatherapi3/src/Metno-WeatherAPI/local/lib/perl5/MojoX/Log/Log4perl.pm line 25, <DATA> line 27. /home/geira/projects/weatherapi3/src/Metno-WeatherAPI/t/oceanforecast.t ............... ok /home/geira/projects/weatherapi3/src/Metno-WeatherAPI/t/polarsatellite.t .............. 1/? format() is not properly implemented in MojoX::Log::Log4perl. Please use appenders. at /home/geira/projects/weatherapi3/src/Metno-WeatherAPI/local/lib/perl5/MojoX/Log/Log4perl.pm line 25. /home/geira/projects/weatherapi3/src/Metno-WeatherAPI/t/polarsatellite.t .............. ok /home/geira/projects/weatherapi3/src/Metno-WeatherAPI/t/probabilityforecast.t ......... 1/? format() is not properly implemented in MojoX::Log::Log4perl. Please use appenders. at /home/geira/projects/weatherapi3/src/Metno-WeatherAPI/local/lib/perl5/MojoX/Log/Log4perl.pm line 25. /home/geira/projects/weatherapi3/src/Metno-WeatherAPI/t/probabilityforecast.t ......... ok /home/geira/projects/weatherapi3/src/Metno-WeatherAPI/t/radar.t ....................... 1/? format() is not properly implemented in MojoX::Log::Log4perl. Please use appenders. at /home/geira/projects/weatherapi3/src/Metno-WeatherAPI/local/lib/perl5/MojoX/Log/Log4perl.pm line 25. /home/geira/projects/weatherapi3/src/Metno-WeatherAPI/t/radar.t ....................... ok /home/geira/projects/weatherapi3/src/Metno-WeatherAPI/t/radarlightning.t .............. 1/? format() is not properly implemented in MojoX::Log::Log4perl. Please use appenders. at /home/geira/projects/weatherapi3/src/Metno-WeatherAPI/local/lib/perl5/MojoX/Log/Log4perl.pm line 25. /home/geira/projects/weatherapi3/src/Metno-WeatherAPI/t/radarlightning.t .............. ok /home/geira/projects/weatherapi3/src/Metno-WeatherAPI/t/seaapproachforecast.t ......... ok /home/geira/projects/weatherapi3/src/Metno-WeatherAPI/t/sigmets.t ..................... 1/? format() is not properly implemented in MojoX::Log::Log4perl. Please use appenders. at /home/geira/projects/weatherapi3/src/Metno-WeatherAPI/local/lib/perl5/MojoX/Log/Log4perl.pm line 25. /home/geira/projects/weatherapi3/src/Metno-WeatherAPI/t/sigmets.t ..................... ok /home/geira/projects/weatherapi3/src/Metno-WeatherAPI/t/spotwind.t .................... 1/? format() is not properly implemented in MojoX::Log::Log4perl. Please use appenders. at /home/geira/projects/weatherapi3/src/Metno-WeatherAPI/local/lib/perl5/MojoX/Log/Log4perl.pm line 25. /home/geira/projects/weatherapi3/src/Metno-WeatherAPI/t/spotwind.t .................... ok /home/geira/projects/weatherapi3/src/Metno-WeatherAPI/t/subjectiveforecast.t .......... 1/? format() is not properly implemented in MojoX::Log::Log4perl. Please use appenders. at /home/geira/projects/weatherapi3/src/Metno-WeatherAPI/local/lib/perl5/MojoX/Log/Log4perl.pm line 25. /home/geira/projects/weatherapi3/src/Metno-WeatherAPI/t/subjectiveforecast.t .......... ok /home/geira/projects/weatherapi3/src/Metno-WeatherAPI/t/tafmetar.t .................... 1/? format() is not properly implemented in MojoX::Log::Log4perl. Please use appenders. at /home/geira/projects/weatherapi3/src/Metno-WeatherAPI/local/lib/perl5/MojoX/Log/Log4perl.pm line 25. /home/geira/projects/weatherapi3/src/Metno-WeatherAPI/t/tafmetar.t .................... ok
Any luck with this one? /J
Hi! Just to register that this issue was fixed in 0.11 Thanks! garu On Mon Nov 06 05:44:30 2017, JOHANL wrote: Show quoted text
> Any luck with this one? > > > /J