From 0c4ab610218ff4b7532cd6483dee150f78c1fd3e Mon Sep 17 00:00:00 2001 From: Daniel Trebbien Date: Mon, 9 Oct 2017 10:14:34 -0500 Subject: 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/ --- server/sonar-process/src/main/java/org/sonar/process/Jmx.java | 2 +- .../src/main/java/org/sonar/process/ProcessEntryPoint.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'server/sonar-process') diff --git a/server/sonar-process/src/main/java/org/sonar/process/Jmx.java b/server/sonar-process/src/main/java/org/sonar/process/Jmx.java index 5324be1955e..ddad31ea7f1 100644 --- a/server/sonar-process/src/main/java/org/sonar/process/Jmx.java +++ b/server/sonar-process/src/main/java/org/sonar/process/Jmx.java @@ -80,7 +80,7 @@ public class Jmx { try { ManagementFactory.getPlatformMBeanServer().unregisterMBean(new ObjectName(name)); } catch (Exception e) { - LoggerFactory.getLogger(Jmx.class).warn("Can not unregister MBean [" + name + "]", e); + LoggerFactory.getLogger(Jmx.class).warn("Can not unregister MBean [{}]", name, e); } } } diff --git a/server/sonar-process/src/main/java/org/sonar/process/ProcessEntryPoint.java b/server/sonar-process/src/main/java/org/sonar/process/ProcessEntryPoint.java index 76b89a007f9..1ee6df0864b 100644 --- a/server/sonar-process/src/main/java/org/sonar/process/ProcessEntryPoint.java +++ b/server/sonar-process/src/main/java/org/sonar/process/ProcessEntryPoint.java @@ -99,14 +99,14 @@ public class ProcessEntryPoint implements Stoppable { try { launch(logger); } catch (Exception e) { - logger.warn("Fail to start " + getKey(), e); + logger.warn("Fail to start {}", getKey(), e); } finally { stop(); } } private void launch(Logger logger) throws InterruptedException { - logger.info("Starting " + getKey()); + logger.info("Starting {}", getKey()); Runtime.getRuntime().addShutdownHook(shutdownHook); stopWatcher.start(); -- cgit v1.2.3