Pawandeep Singh Bhatti created LOG4J2-3569:
----------------------------------------------

             Summary: Incorrect logic/code or comment for 
AbstractFilterable.isFiltered method 
                 Key: LOG4J2-3569
                 URL: https://issues.apache.org/jira/browse/LOG4J2-3569
             Project: Log4j 2
          Issue Type: Bug
          Components: Filters
    Affects Versions: 2.17.2
         Environment: All Enviroments
            Reporter: Pawandeep Singh Bhatti


Hello,

 

This is my first issue ever for an open source project.

 

I was going through Log4j2 source code and stumbled upon following method:
{code:java}
/**
 * Determine if the LogEvent should be processed or ignored.
 * @param event The LogEvent.
 * @return true if the LogEvent should be processed.
 */
@Override
public boolean isFiltered(final LogEvent event) {
    return filter != null && filter.filter(event) == Filter.Result.DENY;
} {code}
 

 

Here is a link to the code on github:
[Link|https://github.com/apache/logging-log4j2/blob/40214e87c46c9534abcd8c5abf2b154f4c561002/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/AbstractFilterable.java#L153]

Either the java doc is incorrect - which says @return true if the LogEvent 
should be processed.



Or this line is wrong,

return filter != null && filter.filter(event) == Filter.Result.DENY;

 

Please check.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to