Subject: | Log::Log4perl::Filter::Boolean ignores order of filters in configuration |
I use 2 boolean filters to combine simple regex-ignore filters (and chained them too):
log4perl.filter.AbortUserProtected = sub { m!test a! }
log4perl.filter.AbortUserInactive = sub { m!test b! }
log4perl.filter.AbortProjectInactive = sub { m!test c! }
log4perl.filter.ProblemNewState = sub { m!test d! }
log4perl.filter.ProblemPremiumProject = sub { m!test e! }
log4perl.filter.ProblemInactiveProject = sub { m!test f! }
log4perl.filter.IgnoreTicket6851 = Log::Log4perl::Filter::Boolean
log4perl.filter.IgnoreTicket6851.logic = AbortUserProtected || AbortUserInactive || AbortProjectInactive || ProblemNewState || ProblemPremiumProject || ProblemInactiveProject
log4perl.filter.WrongContentLength = sub { m!test 1! }
log4perl.filter.SessionMismatch = sub { m!test 2! }
log4perl.filter.SessionTooLarge = sub { m!test 3! }
log4perl.filter.InvalidBoundary = sub { m!test 4! }
log4perl.filter.InvalidFieldName = sub { m!test 5! }
log4perl.filter.InvalidUnicode = sub { m!test 6! }
log4perl.filter.IgnoreUnwanted = Log::Log4perl::Filter::Boolean
log4perl.filter.IgnoreUnwanted.logic = !WrongContentLength && !SessionMismatch && !SessionTooLarge && !InvalidBoundary && !InvalidFieldName && !InvalidUnicode && !IgnoreTicket6851
log4perl.appender.PanicApp.Filter = IgnoreUnwanted
----
in ~50% the loading of filters failed due to the folling error:
Use of uninitialized value $filter in concatenation (.) or string at /path/to/Log/Log4perl/Filter/Boolean.pm line 55.
Filter / IgnoreTicket6851 required by Boolean filter, but not defined at /path/to/Log/Log4perl/Filter/Boolean.pm line 55.
After setting `_INTERNAL_DEBUG => 1` in Log::Log4perl::Filter::Boolean i see the problem:
Compiling '!WrongContentLength && !SessionMismatch && !SessionTooLarge && !InvalidBoundary && !InvalidFieldName && !InvalidUnicode && !IgnoreTicket6851'
Use of uninitialized value $filter in concatenation (.) or string at /path/to/Log/Log4perl/Filter/Boolean.pm line 55.
Filter / IgnoreTicket6851 required by Boolean filter, but not defined at /path/to/Log/Log4perl/Filter/Boolean.pm line 55.
VS
Compiling 'AbortUserProtected || AbortUserInactive || AbortProjectInactive || ProblemNewState || ProblemPremiumProject || ProblemInactiveProject'
func= sub {
my($AbortProjectInactive, $AbortUserProtected, $AbortUserInactive, $ProblemNewState, $ProblemPremiumProject, $ProblemInactiveProject) = @_;
&$AbortUserProtected || &$AbortUserInactive || &$AbortProjectInactive || &$ProblemNewState || &$ProblemPremiumProject || &$ProblemInactiveProject;
}
Compiling '!WrongContentLength && !SessionMismatch && !SessionTooLarge && !InvalidBoundary && !InvalidFieldName && !InvalidUnicode && !IgnoreTicket6851'
func= sub {
my($InvalidFieldName, $SessionTooLarge, $WrongContentLength, $IgnoreTicket6851, $SessionMismatch, $InvalidBoundary, $InvalidUnicode) = @_;
!&$WrongContentLength && !&$SessionMismatch && !&$SessionTooLarge && !&$InvalidBoundary && !&$InvalidFieldName && !&$InvalidUnicode && !&$IgnoreTicket6851;
}
----
The order of the boolean filters is not picked from the configuration. It is by random.