You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Matt Sicker (JIRA)" <ji...@apache.org> on 2016/03/08 18:02:41 UTC

[jira] [Commented] (LOG4J2-1154) Javadoc for AbstractFilter wrong?

    [ https://issues.apache.org/jira/browse/LOG4J2-1154?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15185243#comment-15185243 ] 

Matt Sicker commented on LOG4J2-1154:
-------------------------------------

filter(LogEvent) is used at the appender level (technically on AppenderControl), while the other filter methods are applied at the logger level (technically on Logger.PrivateConfig). At least that's what I gather from the source. I have no idea what "Context Filter" means.

> Javadoc for AbstractFilter wrong?
> ---------------------------------
>
>                 Key: LOG4J2-1154
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1154
>             Project: Log4j 2
>          Issue Type: Documentation
>          Components: Filters
>    Affects Versions: 2.4
>            Reporter: Philipp Knobel
>
> The class org.apache.logging.log4j.core.Filter has as javadoc for the filter methods just the description: *Filter an event.* 
> The org.apache.logging.log4j.core.filter.AbstractFilter has as description for three of the filter methods:
> * Appender Filter method. The default returns NEUTRAL.*
> could you clarify when each of these will be called?
> And the last one *filter(LogEvent)* has as decription *Context Filter method. The default returns NEUTRAL.*
> But this method isn't called, when I configure the filter as context filter.
> My config looks like:
> {code}
> <configuration name="test" packages="my.package">
>     <MyFilter/>
>     <Appenders>
>         <Console name="Console" target="SYSTEM_OUT">
>             <PatternLayout
>                     pattern="m%n"
>                     charset="UTF-8"/>
>         </Console>
>     </Appenders>
>     <Loggers>
>         <root level="DEBUG">
>             <AppenderRef ref="Console"/>
>         </root>
>     </Loggers>
> </configuration>
> {code}
> And btw., do I understand it correctly that each logger calls all Context Filter as well? So that the only benefit of a context filter is that it's shared acrossed Logger, but not actually allowing reducing the invocation count of the filter as if it was defined for each Logger?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org