[
https://issues.apache.org/jira/browse/LOG4J2-2792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17087469#comment-17087469
]
Ralph Goers commented on LOG4J2-2792:
-------------------------------------
Looking at your logging configuration I can see why you are being impacted.
Your root logger is configured at trace level so all the log level checks are
going to succeed. Logging in general is going to be mush more expensive then it
should because Log4J needs to create Log Events because they pass the initial
check before they get thrown away by the filtering that follows. It is
unfortunate that you chose to use a custom level instead of a marker for
auditing as you would not have been impacted by this as your root logger could
have been set to info as all audit events could have been accepted by a global
marker filter. This is exactly how Log4J-Audit works by the way.
Due to this, Log4J is then going to calculate the location before evaluating
the levels in the appender references. That is what is causing the performance
hit you are seeing. Given that it is unlikely you can change your audit logging
to use markers quickly, the way to address this is to add
includeLocation=“false” to the root Logger.
I should also point out that changing the value you chose for your custom Audit
level would also improve things. If you decrease its value to be below info you
could change the level of the root logger to info and not set includeLocation
to false. That should actually give you better performance than you have with
2.11.0.
> Performance issue in log4j 2.12.1 and log4j 2.13.0
> --------------------------------------------------
>
> Key: LOG4J2-2792
> URL: https://issues.apache.org/jira/browse/LOG4J2-2792
> Project: Log4j 2
> Issue Type: Bug
> Components: API, Core
> Affects Versions: 2.12.1, 2.13.0
> Environment: System configuration: Redhat Linux 7,12-core,16Gb RAM
> Application server: Apache tomcat 9.0.16
> Reporter: Riya Reji
> Priority: Blocker
> Attachments: 24-jstack-2020-02-23-173500.zip, log4j2.xml,
> log4j_2_13_CPU_SPIKE.PNG
>
>
> Hi,
> When log4j2 was upgraded from 2.11.0 to 2.12.1 or 2.13.0,the cpu utilization
> was spiking to 100 %. When 2.11.0 version was used the CPU utilization was
> below 40%.
>
> PFA image of CPU utilization when 2.13.0 was used
--
This message was sent by Atlassian Jira
(v8.3.4#803005)