You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Carter Kozak (Jira)" <ji...@apache.org> on 2022/07/27 18:03:00 UTC

[jira] [Updated] (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:all-tabpanel ]

Carter Kozak updated LOG4J2-3560:
---------------------------------
        Fix Version/s: 2.18.1
    Affects Version/s: 2.18.0

> 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
>    Affects Versions: 2.18.0
>            Reporter: David Schlosnagle
>            Assignee: Carter Kozak
>            Priority: Major
>             Fix For: 2.18.1
>
>
> 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)