On Wed, 17 Aug 2011, Richard Thomas wrote:

Do you know if anyone has had any success with using Log4perl in
Strawberry Perl?

Yes, it works with Strawberry Perl.

The reason I ask is that I'm using Strawberry Perl for the first time
and a script that normally works in Activestate Perl is not working in
Strawberry Perl.

You're using a 3rd party appender, Log::Dispatch::FileRotate appender,
which isn't part of Log4perl.

While I know that Log4perl works with Strawberry Perl, I don't know
about 3rd party appenders.

Can you give it a try using Log::Log4perl::Appender::File instead? Also,
make sure you're using the latest Log4perl from CPAN.

--
-- Mike

Mike Schilli
m...@perlmeister.com



The error I get is "undefined value provided for log level at
C:/strawberry/perl/site/lib/Log/Log4perl/Appender.pm line 80".

I've extracted some lines on my script below, so you can see how I setup and use
Log4perl.

Please could you let me know if you can think of anything I can try to get this
working.

Thanks,

Richard.




use strict;
use warnings;

use Date::Manip;
use Log::Log4perl;

use Storable;

use String::Parity;
use String::Parity qw(:DEFAULT /show/);

use IO::Socket;
use Time::HiRes qw(time);
<snip>
my $log_conf1 = q/
log4perl.category                                    = INFO, Logfile, Logscreen
log4perl.appender.Logfile                            = Log::Dispatch::FileRotate
log4perl.appender.Logfile.filename                   = /;

my $log_conf2 = q/
log4perl.appender.Logfile.mode                       = append
log4perl.appender.Logfile.DatePattern                = yyyy-mm-dd
log4perl.appender.Logfile.TZ                         = GMT0BST
log4perl.appender.Logfile.layout                     =
Log::Log4perl::Layout::PatternLayout
log4perl.appender.Logfile.layout.ConversionPattern   = %d %m %n

log4perl.appender.Logscreen                          =
Log::Log4perl::Appender::Screen
log4perl.appender.Logscreen.str                      = 0
log4perl.appender.Logscreen.layout                   =
Log::Log4perl::Layout::PatternLayout
log4perl.appender.Logscreen.layout.ConversionPattern = %m %n

/;

my$log_conf=sprintf("%s%s.%s.log\n%s",$log_conf1,$ScriptNoExt,$dateformat,$log_conf
2);

Log::Log4perl::init( \$log_conf );

my $logger = Log::Log4perl::get_logger();
<snip>

------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
log4perl-devel mailing list
log4perl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/log4perl-devel

Reply via email to