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

Ralph Goers commented on LOG4J2-601:
------------------------------------

If the isEnabled returns true that is an indication that the event will be 
passed through the Logger to the LoggerConfig and then to one or more 
Appenders. IMO it would not make sense to check whether the event would be 
logged by any appenders as the overhead of the check would be about the same as 
just invoking the log method.

As for the LoggerConfig, the argument could certainly be made that it should be 
checked as well. Currently, the log level is propagated to the Logger so 
isEnabled will check that, but the other filters are not.

> Log.log and isEnabled react differently for marker filters
> ----------------------------------------------------------
>
>                 Key: LOG4J2-601
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-601
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Filters
>    Affects Versions: 2.0-rc1
>         Environment: OSX 10.8/10.9, Eclipse, Java 1.6/1.7
>            Reporter: Dan Hagberg
>         Attachments: DbMarkers.java, TestLog2.java, 
> console_atConfigLevel.txt, console_atLoggerLevel.txt, console_noFilter.txt, 
> log4j2_atConfigLevel.xml, log4j2_atLoggerLevel.xml, log4j2_nofilter.xml
>
>
> I am trying to determine if a logger exists for a Marker in Log4j 2. The 
> filter works when actually logging. The problem is when checking 
> isEnabled(level, marker). If the MarkerFilters are at the Configuration 
> level, then it works as expected. If at the logger or appender level, then it 
> bypasses the marker and considers only the threshold level.
> Looking at the documentation, it looks like if accepted/denied is at the 
> configuration level, then it will not check any other filters and that status 
> will be honored, so that makes sense that it works here.
> Is this the expected behavior that the isEnabled works only at the 
> configuration level and is not expected to represent whether or not a message 
> will be logged? Or is it that if isEnabled returns true, then the message 
> should be logged?



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to