Hi,
I'm trying to get to grips with log4perl, and am falling at the second
hurdle. I can get the :easy configuration working OK, but anything beyond
that has me stumped. I should add that I'm a relative PERL-newbie.
I have a test script like this:
--------------------------------------
#!/usr/bin/perl
#testing
require MainConfig;
use Log::Log4perl qw(get_logger :levels);
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
use HTML::Template;
#use DBIWrapper;
Log::Log4perl::init( "log.conf" );
my $logger = get_logger( "rootlogger" );
$logger -> level(INFO);
$logger->info("test.pl starting on ", scalar localtime);
------------------------------------------
log.conf is thus:
-----------------------------------------
log4perl.rootlogger = ERROR, LOGFILE
log4perl.appender.LOGFILE = Log::Log4perl::Appender::File
log4perl.appender.LOGFILE.filename = error.log
log4perl.appender.LOGFILE.mode = append
log4perl.appender.LOGFILE.layout = PatternLayout
log4perl.appender.LOGFILE.layout.ConversionPattern = [%r] %F %L %c - %m%n
----------------------------------------------
Running the script produces:
[tony@tony-lx rutland_members]$ ./test.pl
[Tue Sep 26 11:21:11 2006] test.pl: Log::Log4perl configuration looks
suspicious: No appenders defined at
/usr/lib/perl5/site_perl/5.8.7/Log/Log4perl/Config.pm line 295.
I've scanned the FAQ and the mail archive, both to no avail. Can someone
please give me a nudge in the right direction?
--
Tony van der Hoff | mailto:to...@va...
Buckinghamshire, England
|