1Filter::Boolean(3)    User Contributed Perl Documentation   Filter::Boolean(3)
2
3
4

NAME

6       Log::Log4perl::Filter::Boolean - Special filter to combine the results
7       of others
8

SYNOPSIS

10           log4perl.logger = WARN, AppWarn, AppError
11
12           log4perl.filter.Match1       = sub { /let this through/ }
13           log4perl.filter.Match2       = sub { /and that, too/ }
14           log4perl.filter.MyBoolean       = Log::Log4perl::Filter::Boolean
15           log4perl.filter.MyBoolean.logic = Match1 || Match2
16
17           log4perl.appender.Screen        = Log::Dispatch::Screen
18           log4perl.appender.Screen.Filter = MyBoolean
19           log4perl.appender.Screen.layout = Log::Log4perl::Layout::SimpleLayout
20

DESCRIPTION

22       Sometimes, it's useful to combine the output of various filters to
23       arrive at a log/no log decision. While Log4j, Log4perl's mother ship,
24       chose to implement this feature as a filter chain, similar to Linux' IP
25       chains, Log4perl tries a different approach.
26
27       Typically, filter results will not need to be passed along in chains
28       but combined in a programmatic manner using boolean logic. "Log if this
29       filter says 'yes' and that filter says 'no'" is a fairly common
30       requirement but hard to implement as a chain.
31
32       "Log::Log4perl::Filter::Boolean" is a special predefined custom filter
33       for Log4perl which combines the results of other custom filters in
34       arbitrary ways, using boolean expressions:
35
36           log4perl.logger = WARN, AppWarn, AppError
37
38           log4perl.filter.Match1       = sub { /let this through/ }
39           log4perl.filter.Match2       = sub { /and that, too/ }
40           log4perl.filter.MyBoolean       = Log::Log4perl::Filter::Boolean
41           log4perl.filter.MyBoolean.logic = Match1 || Match2
42
43           log4perl.appender.Screen        = Log::Dispatch::Screen
44           log4perl.appender.Screen.Filter = MyBoolean
45           log4perl.appender.Screen.layout = Log::Log4perl::Layout::SimpleLayout
46
47       "Log::Log4perl::Filter::Boolean"'s boolean expressions allow for
48       combining different appenders by name using AND (&& or &), OR (|| or |)
49       and NOT (!) as logical expressions. Parentheses are used for grouping.
50       Precedence follows standard Perl. Here's a bunch of examples:
51
52           Match1 && !Match2            # Match1 and not Match2
53           !(Match1 || Match2)          # Neither Match1 nor Match2
54           (Match1 && Match2) || Match3 # Both Match1 and Match2 or Match3
55

SEE ALSO

57       Log::Log4perl::Filter, Log::Log4perl::Filter::LevelMatch,
58       Log::Log4perl::Filter::LevelRange, Log::Log4perl::Filter::MDC,
59       Log::Log4perl::Filter::StringRange
60

LICENSE

62       Copyright 2002-2013 by Mike Schilli <m@perlmeister.com> and Kevin Goess
63       <cpan@goess.org>.
64
65       This library is free software; you can redistribute it and/or modify it
66       under the same terms as Perl itself.
67

AUTHOR

69       Please contribute patches to the project on Github:
70
71           http://github.com/mschilli/log4perl
72
73       Send bug reports or requests for enhancements to the authors via our
74
75       MAILING LIST (questions, bug reports, suggestions/patches):
76       log4perl-devel@lists.sourceforge.net
77
78       Authors (please contact them via the list above, not directly): Mike
79       Schilli <m@perlmeister.com>, Kevin Goess <cpan@goess.org>
80
81       Contributors (in alphabetical order): Ateeq Altaf, Cory Bennett, Jens
82       Berthold, Jeremy Bopp, Hutton Davidson, Chris R. Donnelly, Matisse
83       Enzer, Hugh Esco, Anthony Foiani, James FitzGibbon, Carl Franks, Dennis
84       Gregorovic, Andy Grundman, Paul Harrington, Alexander Hartmaier  David
85       Hull, Robert Jacobson, Jason Kohles, Jeff Macdonald, Markus Peter,
86       Brett Rann, Peter Rabbitson, Erik Selberg, Aaron Straup Cope, Lars
87       Thegler, David Viner, Mac Yang.
88
89
90
91perl v5.38.0                      2023-07-20                Filter::Boolean(3)
Impressum