Apache Log4cxx
Version 1.3.0
|
A Filter that operates on the current thread's MDC map. More...
#include <mapfilter.h>
Public Member Functions | |
MapFilter () | |
~MapFilter () | |
void | setOption (const LogString &option, const LogString &value) override |
Set option to value . | |
void | setKeyValue (const LogString &strKey, const LogString &strValue) |
const LogString & | getValue (const LogString &strKey) const |
void | setAcceptOnMatch (bool acceptOnMatch1) |
bool | getAcceptOnMatch () const |
bool | getMustMatchAll () const |
void | setMustMatchAll (bool mustMatchAll1) |
FilterDecision | decide (const spi::LoggingEventPtr &event) const override |
Returns NEUTRAL is there is no string match. | |
Public Member Functions inherited from log4cxx::spi::Filter | |
Filter () | |
Filter (std::unique_ptr< FilterPrivate > priv) | |
virtual | ~Filter () |
log4cxx::spi::FilterPtr | getNext () const |
void | setNext (const log4cxx::spi::FilterPtr &newNext) |
void | activateOptions (helpers::Pool &p) override |
Activate the options that were previously set with calls to option setters. | |
void | setOption (const LogString &option, const LogString &value) override |
Set option to value . | |
virtual FilterDecision | decide (const LoggingEventPtr &event) const =0 |
Public Member Functions inherited from log4cxx::spi::OptionHandler | |
virtual | ~OptionHandler () |
virtual void | activateOptions (helpers::Pool &p)=0 |
Activate the options that were previously set with calls to option setters. | |
virtual void | setOption (const LogString &option, const LogString &value)=0 |
Set option to value . | |
Public Member Functions inherited from log4cxx::helpers::Object | |
virtual | ~Object () |
virtual const helpers::Class & | getClass () const =0 |
virtual bool | instanceof (const Class &clazz) const =0 |
virtual const void * | cast (const Class &clazz) const =0 |
Additional Inherited Members | |
Public Types inherited from log4cxx::spi::Filter | |
enum | FilterDecision { DENY = -1 , NEUTRAL = 0 , ACCEPT = 1 } |
A Filter that operates on the current thread's MDC map.
For example, to exclude entries from the log where the context has "user.name" set to "test2" and "user.ip" is "127.0.0.1":
<filter class="MapFilter"> <param name="user.ip" value="127.0.0.1" /> <param name="user.name" value="test2" /> <param name="Operator" value="AND" /> <param name="AcceptOnMatch" value="false" /> </filter>
log4cxx::filter::MapFilter::MapFilter | ( | ) |
log4cxx::filter::MapFilter::~MapFilter | ( | ) |
|
overridevirtual |
Returns NEUTRAL
is there is no string match.
Implements log4cxx::spi::Filter.
bool log4cxx::filter::MapFilter::getAcceptOnMatch | ( | ) | const |
bool log4cxx::filter::MapFilter::getMustMatchAll | ( | ) | const |
void log4cxx::filter::MapFilter::setAcceptOnMatch | ( | bool | acceptOnMatch1 | ) |
void log4cxx::filter::MapFilter::setKeyValue | ( | const LogString & | strKey, |
const LogString & | strValue | ||
) |
void log4cxx::filter::MapFilter::setMustMatchAll | ( | bool | mustMatchAll1 | ) |
|
overridevirtual |
Set option
to value
.
Supported options | Supported values | Default value |
---|---|---|
Operator | (1) | Or |
AcceptOnMatch | True,False | True |
{anyKey} | {anyValue} | - |
(1) If "And", the MDC must contain all configured key-value pairs, otherwise only one configured key-value pair needs to match.
Implements log4cxx::spi::OptionHandler.