Subject: | Using log4perl category (or logger) keyword on a module named trigger fails |
Date: | Wed, 14 Oct 2009 11:42:21 -0400 |
To: | bug-Log-Log4perl [...] rt.cpan.org |
From: | Olivier Bilodeau <obilodeau [...] inverse.ca> |
Experienced on 1.18 but I've read the Changes file and it looks like it
applies to 1.25 (latest as I report this).
In our codebase we have a module named pf::trigger.
Using:
log4perl.category.pf.trigger = DEBUG
fails with:
Use of uninitialized value in pattern match (m//) at
/usr/lib/perl5/site_perl/5.8.8/Log/Log4perl/Config.pm line 788 (#1)
(W uninitialized) An undefined value was used as if it were already
defined. It was interpreted as a "" or a 0, but maybe it was a
mistake.
To suppress this warning assign a defined value to your variables.
To help you figure out what was undefined, perl tells you what
operation
you used the undefined value in. Note, however, that perl
optimizes your
program and the operation displayed in the warning may not necessarily
appear literally in your program. For example, "that $foo" is
usually optimized into "that " . $foo, and the warning will refer to
the concatenation (.) operator, even though there is no . in your
program.
Use of uninitialized value in pattern match (m//) at
/usr/lib/perl5/site_perl/5.8.8/Log/Log4perl/Config.pm line 789 (#1)
Use of uninitialized value in split at
/usr/lib/perl5/site_perl/5.8.8/Log/Log4perl/Config.pm line 275 (#1)
Use of uninitialized value in exists at
/usr/lib/perl5/site_perl/5.8.8/Log/Log4perl/Level.pm line 110 (#1)
Use of uninitialized value in concatenation (.) or string at
/usr/lib/perl5/site_perl/5.8.8/Log/Log4perl/Level.pm line 113 (#1)
Uncaught exception from user code:
level '' is not a valid error level
(DEBUG|INFO|WARN|ERROR|FATAL|TRACE|ALL|OFF) at
/usr/lib/perl5/site_perl/5.8.8/Log/Log4perl/Config.pm line 277
I think its because of Log::Log4perl::Config::PropertyConfigurator
because trigger is a keyword in there:
# for triggers, we want to compile them but not run them
# (is this worth putting into metadata somewhere?)
if ($key =~ /\.trigger$/ ){
$val = compile_if_perl($val)
}elsif ( $key !~ /\.(cspec\.)|warp_message|filter/){
$val = eval_if_perl($val)
}
So the special behaviour is triggered by using .trigger in the config
file. I think that a way to workaround special keywords like that should
be documented in the FAQ. I've used:
log4perl.category.pf::trigger = DEBUG
instead and it worked
--
Olivier Bilodeau
obilodeau@inverse.ca :: +1.514.447.4918 x115 :: www.inverse.ca
Inverse inc. :: Leaders behind SOGo (www.scalableogo.org) and
PacketFence (www.packetfence.org)