On Wed, Jun 10, 2015 at 9:30 AM, Remko Popma <[email protected]> wrote:
> I was lucky to be able to grab a few cycles to contribute to log4j. > Currently totally swamped with work. Sorry for the silence recently, but I > don't expect this to change in the near future... :-( > I am glad you were able to take the time. This is quite a tricky area. I am glad you could help. I hope to see you again here soon! :-) Gary > > On Thu, Jun 11, 2015 at 1:09 AM, Gary Gregory <[email protected]> > wrote: > >> Do you feel like looking for all currentTimeMilis () call sites to check >> if similar fixes can be applied? >> >> Gary >> >> >> -------- Original message -------- >> From: [email protected] >> Date: 06/10/2015 08:32 (GMT-08:00) >> To: [email protected] >> Subject: logging-log4j2 git commit: LOG4J2-1048 FileConfigurationMonitor >> unnecessarily calls System.currentTimeMillis causing high CPU usage. >> >> Repository: logging-log4j2 >> Updated Branches: >> refs/heads/master 1765760ab -> 4c95866dc >> >> >> LOG4J2-1048 FileConfigurationMonitor unnecessarily calls >> System.currentTimeMillis causing high CPU usage. >> >> Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo >> Commit: >> http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/4c95866d >> Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/4c95866d >> Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/4c95866d >> >> Branch: refs/heads/master >> Commit: 4c95866dc3fcfa109730c9843da144c5bf4599ae >> Parents: 1765760 >> Author: rpopma <[email protected]> >> Authored: Thu Jun 11 00:32:14 2015 +0900 >> Committer: rpopma <[email protected]> >> Committed: Thu Jun 11 00:32:14 2015 +0900 >> >> ---------------------------------------------------------------------- >> .../logging/log4j/core/config/FileConfigurationMonitor.java | 4 ++-- >> src/changes/changes.xml | 3 +++ >> 2 files changed, 5 insertions(+), 2 deletions(-) >> ---------------------------------------------------------------------- >> >> >> >> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4c95866d/log4j-core/src/main/java/org/apache/logging/log4j/core/config/FileConfigurationMonitor.java >> ---------------------------------------------------------------------- >> diff --git >> a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/FileConfigurationMonitor.java >> b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/FileConfigurationMonitor.java >> index 38f64cf..f145696 100644 >> --- >> a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/FileConfigurationMonitor.java >> +++ >> b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/FileConfigurationMonitor.java >> @@ -73,8 +73,8 @@ public class FileConfigurationMonitor implements >> ConfigurationMonitor { >> */ >> @Override >> public void checkConfiguration() { >> - final long current = System.currentTimeMillis(); >> - if (((counter.incrementAndGet() & MASK) == 0) && (current >= >> nextCheck)) { >> + final long current; >> + if (((counter.incrementAndGet() & MASK) == 0) && ((current = >> System.currentTimeMillis()) >= nextCheck)) { >> LOCK.lock(); >> try { >> nextCheck = current + intervalSeconds; >> >> >> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/4c95866d/src/changes/changes.xml >> ---------------------------------------------------------------------- >> diff --git a/src/changes/changes.xml b/src/changes/changes.xml >> index eef3aa4..e22441f 100644 >> --- a/src/changes/changes.xml >> +++ b/src/changes/changes.xml >> @@ -24,6 +24,9 @@ >> </properties> >> <body> >> <release version="2.4" date="2015-MM-DD" description="GA Release >> 2.4"> >> + <action issue="LOG4J2-1048" dev="rpopma" type="fix" >> due-to="Nikhil"> >> + FileConfigurationMonitor unnecessarily calls >> System.currentTimeMillis causing high CPU usage. >> + </action> >> <action issue="LOG4J2-1023" dev="ggregory" type="add" >> due-to="Mikael St��ldal"> >> New RewritePolicy for changing level of a log event. >> </action> >> >> > -- E-Mail: [email protected] | [email protected] Java Persistence with Hibernate, Second Edition <http://www.manning.com/bauer3/> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/> Spring Batch in Action <http://www.manning.com/templier/> Blog: http://garygregory.wordpress.com Home: http://garygregory.com/ Tweet! http://twitter.com/GaryGregory
