- Log::Log4perl
Log::Log4perl easy
examples/advanced-perl/log4perl_easy.pl
use strict; use warnings; use 5.010; use My::EasyApp; use Log::Log4perl qw(:easy); Log::Log4perl->easy_init($WARN); FATAL "This is", " fatal"; ERROR "This is error"; WARN "This is warn"; INFO "This is info"; DEBUG "This is debug"; TRACE "This is trace"; my $app = My::EasyApp->new; $app->run;
examples/advanced-perl/My/EasyApp.pm
package My::EasyApp; use strict; use warnings; use Log::Log4perl; #qw(get_logger); sub new { bless {}, shift; } sub run { my $logger = Log::Log4perl->get_logger(); $logger->fatal("FATAL from EasyApp"); $logger->debug("DEBUG from EasyApp"); } 1;
2014/08/24 08:02:52 This is fatal 2014/08/24 08:02:52 This is error 2014/08/24 08:02:52 This is warn 2014/08/24 08:02:52 FATAL from EasyApp