Hail, mighty Perlers!
Once again, this bumblin', stumblin', fumblin' (apologies to Chris Berman) Perl wannabe needs help.
I'm trying to use the Log4perl module, but there's something obviously wrong with my code. Here is my test script, run from my home directory:
#!perl; use strict; use warnings; use Log::Log4perl qw(get_logger); Log::Log4perl->init("log.conf"); my $logger = get_logger("logfile.log"); $logger->info("This will get logged\n"); $logger->debug("This will not\n"); print "The quick brown fox jumped over the lazy dogs\n";

Here is my log.conf (filed in my C:\Perl\site\lib\Log\Log4perl directory):
log4perl.rootLogger=INFO, LOGFILE log4perl.appender.LOGFILE=Log::Log4perl::Appender::File log4perl.appender.LOGFILE.filename="c:report\logfile.log" log4perl.appender.LOGFILE.mode=append log4perl.appender.LOGFILE.layout=PatternLayout log4perl.appender.LOGFILE.layout.ConversionPattern=[%r] %F %L c - %m%n

When I try to run the test script, I get this error:
Cannot open config file 'log.conf' at C:/Perl/site/lib/Log/Log4perl/Config.pm line 592.

If it seems that I'm really dense, well, I won't argue that point. I've read Michael Schilli's tutorial, along with the implementaion doc that comes with Log4perl, but I'm still in a fog. Can someone (anyone?) please help?


In reply to Log4perl config problem by yburge

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.