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

Dave Messink commented on LOG4J2-3487:
--------------------------------------

The MBean thing through me off, but it's still the root cause of the issue. The 
Logger MBean says includeLocation = true, while the Logger itself uses the 
logic above and it's requiresLocation field is false.

The problem is that the LoggerConfig processes the LogEvent, and sets the 
event's includeLocation to the LoggerConfig.includeLocation value. This causes 
the LogEvent to walk the stack trace to discover the location - when it should 
not.

LoggerConfig:

private void processLogEvent(final LogEvent event, final LoggerConfigPredicate 
predicate) {   *event.setIncludeLocation(isIncludeLocation());*

  if (predicate.allow(this)) {

    callAppenders(event);

  }

  logParent(event, predicate);

}

> The LoggerConfig includeLocation defaults to true in 2.17.2
> -----------------------------------------------------------
>
>                 Key: LOG4J2-3487
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3487
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Configuration
>    Affects Versions: 2.17.2
>            Reporter: Dave Messink
>            Priority: Major
>
> We've found services running 2.17.2 to be slower than 2.17.1. A heat map 
> indicates a StackWalker in log4j.
> I found that the code that Logger plugin calls into has changed. In 2.17.1 
> the default config for includeLocation is based only on the configured value. 
> In 2.17.2 it's based on the config value if present, but then defaults to 
> !(context instanceof AsyncLoggerContext).
> Since none of our Logger elements declare includeLocation - the default 
> behavior has changed causing all LogEvents to include their location.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to