Jerry Chin created LOG4J2-1911:
----------------------------------
Summary: DynamicThresholdFilter defaultThreshold is not used to
compare against event's level when there'e no matching key found.
Key: LOG4J2-1911
URL: https://issues.apache.org/jira/browse/LOG4J2-1911
Project: Log4j 2
Issue Type: Bug
Components: Filters
Affects Versions: 2.8.2
Reporter: Jerry Chin
Priority: Minor
The {{defaultThreshold}} property is not honored as documented :
{quote}
defaultThreshold Level of messages to be filtered. If there is no
matching key in the key/value pairs then this level will be compared against
the event's level.
{quote}
after carefully examining the source code, I found the following:
{code:title=DynamicThresholdFilter.java|borderStyle=solid}
String value = (String)contextMap.getValue(this.key);
if(value != null) {
Level ctxLevel = (Level)this.levelMap.get(value);
if(ctxLevel == null) {
ctxLevel = this.defaultThreshold;
}
return
level.isMoreSpecificThan(ctxLevel)?this.onMatch:this.onMismatch;
} else {
return Result.NEUTRAL;
}
{code}
where level is the event's level, when there's no matching key found
{{contextMap}}, {{Result.NEUTRAL}} is mistakenly returned, instead of against
{{this.defaultThreshold}}.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)