You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Piotr Karwasz (Jira)" <ji...@apache.org> on 2022/07/23 06:42:00 UTC
[jira] [Commented] (LOG4J2-3560) Logger$PrivateConfig.filter(Level, Marker, String) allocates empty varargs array
[ https://issues.apache.org/jira/browse/LOG4J2-3560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17570250#comment-17570250 ]
Piotr Karwasz commented on LOG4J2-3560:
---------------------------------------
[~schlosna],
Nice catch! I think the {{Filter}} interface is missing a couple of methods: {{filter(Logger, Level, Marker, String, Throwable)}} and {{filter(Logger, Level, Marker, CharSequence, Throwable)}}. Adding these will allow {{Filter}}s "filter" method to have all the possible signatures of the {{ExtendedLogger}} "isEnabled" methods.
> Logger$PrivateConfig.filter(Level, Marker, String) allocates empty varargs array
> --------------------------------------------------------------------------------
>
> Key: LOG4J2-3560
> URL: https://issues.apache.org/jira/browse/LOG4J2-3560
> Project: Log4j 2
> Issue Type: Improvement
> Components: Core
> Reporter: David Schlosnagle
> Priority: Major
>
> While reviewing some JFR profiles, I notice significant allocations of {{Object[]}} due to use of some {{isEnabled}} conditions that ends up using empty varargs invoking {{org.apache.logging.log4j.core.Filter#filter(Logger, Level, Marker, String, Object...)}}, for example the following call trace:
> {code}
> at org.apache.logging.log4j.core.Logger$PrivateConfig.filter(Level, Marker, String)
> at org.apache.logging.log4j.core.Logger.isEnabled(Level, Marker, String)
> {code}
> We can avoid allocation on this hot path when invoking {{Filter#filter(Logger, Level, Marker, String, Object...)}} by reusing an empty object array for the varargs.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)