diff options
author | Daniel Trebbien <dtrebbien@gmail.com> | 2017-10-09 10:14:34 -0500 |
---|---|---|
committer | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2017-10-10 13:28:44 +0200 |
commit | 0c4ab610218ff4b7532cd6483dee150f78c1fd3e (patch) | |
tree | 4a30a5b3c92702544b09ac7e909e566f988710cc /server/sonar-main | |
parent | 1719abc62d33568dfc1a1d8d90262062211c5f39 (diff) | |
download | sonarqube-0c4ab610218ff4b7532cd6483dee150f78c1fd3e.tar.gz sonarqube-0c4ab610218ff4b7532cd6483dee150f78c1fd3e.zip |
Utilize parameterized logging
As suggested in the SLF4J FAQ:
https://www.slf4j.org/faq.html#logging_performance
.. parameterized logging can improve the efficiency of logger calls when
logging at the specified level is disabled.
In addition, per the FAQ: https://www.slf4j.org/faq.html#paramException
since SLF4J 1.6.0 it is possible to use parameterized logging and also
log an exception/throwable.
These changes were suggested by SLF4J Helper for NetBeans IDE:
http://plugins.netbeans.org/plugin/72557/
Diffstat (limited to 'server/sonar-main')
3 files changed, 3 insertions, 3 deletions
diff --git a/server/sonar-main/src/main/java/org/sonar/application/SchedulerImpl.java b/server/sonar-main/src/main/java/org/sonar/application/SchedulerImpl.java index 943f5de6efa..abe37386b64 100644 --- a/server/sonar-main/src/main/java/org/sonar/application/SchedulerImpl.java +++ b/server/sonar-main/src/main/java/org/sonar/application/SchedulerImpl.java @@ -130,7 +130,7 @@ public class SchedulerImpl implements Scheduler, ProcessEventListener, ProcessLi } else { Optional<String> leader = appState.getLeaderHostName(); if (leader.isPresent()) { - LOG.info("Waiting for initialization from " + leader.get()); + LOG.info("Waiting for initialization from {}", leader.get()); } else { LOG.error("Initialization failed. All nodes must be restarted"); } diff --git a/server/sonar-main/src/main/java/org/sonar/application/process/ProcessLauncherImpl.java b/server/sonar-main/src/main/java/org/sonar/application/process/ProcessLauncherImpl.java index 802d53bdf16..f067cc15c76 100644 --- a/server/sonar-main/src/main/java/org/sonar/application/process/ProcessLauncherImpl.java +++ b/server/sonar-main/src/main/java/org/sonar/application/process/ProcessLauncherImpl.java @@ -98,7 +98,7 @@ public class ProcessLauncherImpl implements ProcessLauncher { try { FileUtils.deleteDirectory(outdatedDir); } catch (IOException e) { - LOG.info("Failed to delete outdated search index data directory " + outdatedDir.getAbsolutePath(), e); + LOG.info("Failed to delete outdated search index data directory {}", outdatedDir.getAbsolutePath(), e); } } }); diff --git a/server/sonar-main/src/main/java/org/sonar/application/process/SQProcess.java b/server/sonar-main/src/main/java/org/sonar/application/process/SQProcess.java index 6aa7a29bac1..18f6d192d6c 100644 --- a/server/sonar-main/src/main/java/org/sonar/application/process/SQProcess.java +++ b/server/sonar-main/src/main/java/org/sonar/application/process/SQProcess.java @@ -134,7 +134,7 @@ public class SQProcess { LOG.warn(format("Interrupted while stopping process %s", processId), e); Thread.currentThread().interrupt(); } catch (Throwable e) { - LOG.error("Can not ask for graceful stop of process " + processId, e); + LOG.error("Can not ask for graceful stop of process {}", processId, e); } } |