Apache Log4cxx  Version 1.3.0
Loading...
Searching...
No Matches
log4cxx::filter::LocationInfoFilter Class Reference

When location information is available, individual log statements can be turned on or off depending on their source location. More...

#include <locationinfofilter.h>

Inheritance diagram for log4cxx::filter::LocationInfoFilter:
log4cxx::spi::Filter log4cxx::spi::OptionHandler log4cxx::helpers::Object

Public Member Functions

 LocationInfoFilter ()
 
 ~LocationInfoFilter ()
 
void setOption (const LogString &option, const LogString &value) override
 Set option to value.
 
void setLineNumber (int lineNum)
 
void setMethodName (const LogString &methodName)
 
void setAcceptOnMatch (bool acceptOnMatch1)
 
bool getAcceptOnMatch () const
 
bool getMustMatchAll () const
 
void setMustMatchAll (bool mustMatchAll1)
 
FilterDecision decide (const spi::LoggingEventPtr &event) const override
 If this event does not already contain location information, evaluate the event against the expression.
 
- 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::ClassgetClass () 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 }
 

Detailed Description

When location information is available, individual log statements can be turned on or off depending on their source location.

This filter allows for filtering messages based off of either the line number of the message, or the name of the method that the log mesage is in. The 'operator' parameter may be used to determine if both the method name and line number must match. If 'operator' is set to 'AND', then both the line number and method name must match, otherwise only one needs to match. By default, 'operator' is set to 'OR'.

If location information is not available, this filter does nothing.

Constructor & Destructor Documentation

◆ LocationInfoFilter()

log4cxx::filter::LocationInfoFilter::LocationInfoFilter ( )

◆ ~LocationInfoFilter()

log4cxx::filter::LocationInfoFilter::~LocationInfoFilter ( )

Member Function Documentation

◆ decide()

FilterDecision log4cxx::filter::LocationInfoFilter::decide ( const spi::LoggingEventPtr event) const
overridevirtual

If this event does not already contain location information, evaluate the event against the expression.

If the expression evaluates to true, generate a LocationInfo instance by creating an exception and set this LocationInfo on the event.

Returns log4cxx::spi::Filter#NEUTRAL

Implements log4cxx::spi::Filter.

◆ getAcceptOnMatch()

bool log4cxx::filter::LocationInfoFilter::getAcceptOnMatch ( ) const

◆ getMustMatchAll()

bool log4cxx::filter::LocationInfoFilter::getMustMatchAll ( ) const

◆ setAcceptOnMatch()

void log4cxx::filter::LocationInfoFilter::setAcceptOnMatch ( bool  acceptOnMatch1)

◆ setLineNumber()

void log4cxx::filter::LocationInfoFilter::setLineNumber ( int  lineNum)

◆ setMethodName()

void log4cxx::filter::LocationInfoFilter::setMethodName ( const LogString methodName)

◆ setMustMatchAll()

void log4cxx::filter::LocationInfoFilter::setMustMatchAll ( bool  mustMatchAll1)

◆ setOption()

void log4cxx::filter::LocationInfoFilter::setOption ( const LogString option,
const LogString value 
)
overridevirtual

Set option to value.

Supported options Supported values Default value
Method {any} -
LineNumber {int} -
Operator (1) Or
AcceptOnMatch True,False True

(1) If "And", both method name and line number must match, otherwise either method name or line number match.

Implements log4cxx::spi::OptionHandler.


The documentation for this class was generated from the following file: