[
https://issues.apache.org/jira/browse/LOG4J2-3487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17527247#comment-17527247
]
Ralph Goers commented on LOG4J2-3487:
-------------------------------------
The default isn't that simple. AbstractLogger has a requiresLocation() method
that defaults to false. However, the default isn't particularly meaningful as
it ends up referring to the requiresLocation value for the LoggerConfig
associated with the Logger. This ends up doing:
{code:java}
public boolean requiresLocation() {
if (!includeLocation) {
return false;
}
AppenderControl[] controls = appenders.get();
LoggerConfig loggerConfig = this;
while (loggerConfig != null) {
for (AppenderControl control : controls) {
Appender appender = control.getAppender();
if (appender instanceof LocationAware && ((LocationAware)
appender).requiresLocation()) {
return true;
}
}
if (loggerConfig.additive) {
loggerConfig = loggerConfig.parent;
if (loggerConfig != null) {
controls = loggerConfig.appenders.get();
}
} else {
break;
}
}
return false;
} {code}
The Appender requiresLocation will check to see if the Layout or any other
elements associated with the Appender require location information. If the
LoggerConfig is additive it will check those as well. Note that the default for
includeLocation is true. It is only set to false when something explicitly sets
it to false. This has been the behavior since 2.12.1. If something was
modified to indicate it now requires location information or your configuration
was updated to use something that requires location information then that would
cause this behavior.
> 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)