deadpickle has asked for the wisdom of the Perl Monks concerning the following question:
I really just want to log errors or maybe even warnings so that I can handle them later. I'm sure there is better code out there than what I have. thanks for the help!use Log::Log4perl qw(:easy); Log::Log4perl->easy_init($ERROR); my $logger = get_logger(); # Appenders my $appender = Log::Log4perl::Appender->new( "Log::Dispatch::File", filename => "grruvi.log", mode => 'trunc' ); $logger->add_appender($appender); # Layouts my $layout = Log::Log4perl::Layout::PatternLayout->new("%d %p> %F{1}:% +L %M - %m%n"); $appender->layout($layout); my $timer_log = Glib::Timeout->add(100, \&log); sub log { if (defined $!){ if (length $! != 0 and length $! <= 30){ # $log->error($!) $logger->error($!); } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Adding a Log to a perl2exe file
by bruno (Friar) on Aug 20, 2008 at 05:07 UTC | |
by deadpickle (Pilgrim) on Aug 20, 2008 at 05:59 UTC | |
|
Re: Adding a Log to a perl2exe file
by saintmike (Vicar) on Aug 20, 2008 at 17:03 UTC | |
|
Re: Adding a Log to a perl2exe file
by Anonymous Monk on Aug 20, 2008 at 04:31 UTC |