[
https://issues.apache.org/jira/browse/LOG4J2-1048?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14579850#comment-14579850
]
Nikhil edited comment on LOG4J2-1048 at 6/10/15 1:58 AM:
---------------------------------------------------------
I have attached the diff file of the proposed change. Will the refactoring to
redo this feature happen in v2.4? If not, can you please apply this patch in
2.4.
We deploy Log4j2 in servlet container's lib directory rather then bundle them
in individual wars, and we got several containers running different set of
wars. Creating a File Watch will require me to deploy a dedicated service to
each current and future containers we may add.
was (Author: iconnj):
diff file of the proposed change
> FileConfigurationMonitor - High CPU usage
> -----------------------------------------
>
> Key: LOG4J2-1048
> URL: https://issues.apache.org/jira/browse/LOG4J2-1048
> Project: Log4j 2
> Issue Type: Bug
> Components: Configurators, Core
> Affects Versions: 2.3
> Reporter: Nikhil
> Attachments: LOG4J2-1048
>
>
> I am observing some high system CPU usage as a result of high number of calls
> to System.currentTimeMillis() in
> FileConfigurationMonitor.checkConfiguration() method.
> The checkConfiguration() method is called as part of Logger's every
> log/logIfEnabled and isEnabled method, therefore getting called thousands of
> times in my application when under moderate load. Each one of these calls
> therefore results in calling System.currentTimeMillis().
> The following code change, where the currentTimeMillis() is called only when
> required seemed to reduce the cpu load
> -final long current = System.currentTimeMillis();-
> -if(((counter.incrementAndGet() & MASK) == 0) && (current >= nextCheck))-
> Fixed as
> {code}
> final long current;
> if (((counter.incrementAndGet() & MASK) == 0) && ((current =
> System.currentTimeMillis()) >= nextCheck)) {
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]