[
https://issues.apache.org/jira/browse/LOG4J2-3647?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17676949#comment-17676949
]
Piotr Karwasz commented on LOG4J2-3647:
---------------------------------------
[~rgoers],
Yes, {{isEnabled}} is called in both cases, but with a different set of
parameters. Calling:
{code:java}
logger.isEnabled(level);
logger.isEnabled(level, marker, message, throwable);
{code}
can give different results. The test I put in the PR uses a `MarkerFilter` that
accepts messages with a certain marker and returns {{NEUTRAL}} for all others.
Calling {{isEnabled(Level.INFO)}} is the same as having *no* marker and
messages less specific than {{INFO}} are rejected.
> Equivalence of `LogBuilder` and `Logger` calls
> ----------------------------------------------
>
> Key: LOG4J2-3647
> URL: https://issues.apache.org/jira/browse/LOG4J2-3647
> Project: Log4j 2
> Issue Type: Bug
> Components: Core
> Reporter: Piotr Karwasz
> Priority: Major
>
> The following two calls should behave in the same way:
> {code:java}
> logger.info(marker, "Hello Log4j2 Core!");
> logger.atInfo().withMarker(marker).log("Hello Log4j2 Core!");
> {code}
> If we use global filters and the filter returns {{ACCEPT}}, the first call
> will log a message even if the logger's level is lower than {{INFO}}. The
> second call will not log anything.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)