mschilli/log4perl — pull request #48 by fgeueke (2014-07-21 16:10:13+00:00)
Title: Updated Boolean.pm to evaluate filter in a single eval.

In using the Boolean filter I noticed that it wasn't shortcutting in evaluating the logic parameter. It is hoped that with this update the boolean logic will be evaluated once instead of in pieces (where all pieces get evaluated).

A simple test conf:

log4perl.category.test = DEBUG, Screen

log4perl.filter.Debug = Log::Log4perl::Filter::LevelMatch
log4perl.filter.Debug.LevelToMatch = DEBUG
log4perl.filter.Debug.AcceptOnMatch = true

log4perl.filter.Info = Log::Log4perl::Filter::LevelMatch
log4perl.filter.Info.LevelToMatch = INFO
log4perl.filter.Info.AcceptOnMatch = true

log4perl.filter.Boolean = Log::Log4perl::Filter::Boolean
log4perl.filter.Boolean.logic = Debug && Info

log4perl.appender.Screen = Log::Log4perl::Appender::Screen
log4perl.appender.Screen.layout = Log::Log4perl::Layout::SimpleLayout
log4perl.appender.Screen.Filter = Boolean

With this revision $logger->info() will hit LevelMatch::ok() once where previously it would've hit it twice (even though the logic should prevent the second call from happening.