Apache Log4cxx Version 1.0.0
|
The LocationInfoFilter allows filtering against the location in the file that the log statement was made. Location information must not be disabled in order for this filter to be effective. Location information is disabled with the LOG4CXX_DISABLE_LOCATION_INFO
macro.
Parameter Name | Type | Description |
---|---|---|
Operator | LogString | If the operator is AND then all the parts of the location(line number and method name) must match. If set to OR then only one needs to match. The default value is OR . |
AcceptOnMatch | bool | If true , accept the message when it matches the parameters. If false , deny the message when it matches the parameters. |
LineNumber | int | The line number to match on. The default line number is -1. |
Method | LogString | The method to match on. The method name may be compiler-specific. On GCC, the method name will look like Class::methodName |
Assume that our code looks something like the following:
For various reasons, we may want to know that we are about to do something, but we don't want to know each iteration of the loop. In order to filter out this one message we can create a LocationInfoFilter in order to specifiy the line number that this message is on in order to filter it out:
Doing this allows us to still see the "About to do something!" message, but ignore each iteration of the loop.