I'm trying to add a log file using Log4perl to a final script. I'm packaging the script using perl2exe and when I go to run the file I get the error:
undefined value provided for log level at PERL2EXE_STORAGE/Log/Log4perl/Appender .pm line 77
Not sure where the error is happening. Here is the logger code:
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($!); } } }
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!

In reply to Adding a Log to a perl2exe file by deadpickle

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.