After plunking (actually, single-stepping in the debugger) around the
marvel of appender wrappers, appenders, closures, levels, thresholds,
and priorities that is Log4perl, I noticed the following.

As the Log4perl doc says, under "Access Defined Appenders":

"The previously mentioned method appender_by_name() returns a reference
to the real appender object. If you want access to the wrapper class
(e.g. if you want to modify the appender's threshold), use the hash
$Log::Log4perl::Logger::APPENDER_BY_NAME{...} instead, which holds
references to all appender wrapper objects."

Okay.  But when your application does:

  my $wrapper = $Log::Log4perl::Logger::APPENDER_BY_NAME{'somename'};
  $wrapper->threshold ('INFO');

what you get is the wrapper object's "level" field set to the... um,
priority of the 'INFO' level you passed in.  And that works, as
subsequently the appender does not log anything of higher... um, or
maybe lower, level... um, priority than INFO.  Yeah, that's it.

But it does leave the actual appender object's "Threshold" field
unchanged.  So if that field were already 'DEBUG', what you get is a
wrapper saying one thing about level, while it contains an appender
saying another thing about Threshold.

The effect turns out correct, but only because the appender's
"Threshold" is actually the wrapper's "level", and the two values need
not agree, since one of them seems to be ignored past initialization.
Ugh.

In the end, it seems like the threshold() routine ought to set (or
perhaps just delete) the appender's Threshold field when it sets the
wrapper's level field.

==========
Rob Retter


------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
log4perl-devel mailing list
log4perl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/log4perl-devel

Reply via email to