HookTask: Reduce amount of INFO logging emitted when running hooks Reduce the log level of the hook's exit code and output to debug. Change-Id: I80b6569696407296843eb4ae1d85e53301511d97
diff --git a/src/main/java/com/googlesource/gerrit/plugins/hooks/HookTask.java b/src/main/java/com/googlesource/gerrit/plugins/hooks/HookTask.java index 83d4b66..20bb088 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/hooks/HookTask.java +++ b/src/main/java/com/googlesource/gerrit/plugins/hooks/HookTask.java
@@ -118,19 +118,14 @@ log.error("Error running hook " + hook.toAbsolutePath(), err); } - if (result != null) { - int exitValue = result.getExitValue(); - if (exitValue == 0) { - log.debug("hook[" + getName() + "] exitValue:" + exitValue); - } else { - log.info("hook[" + getName() + "] exitValue:" + exitValue); - } + if (result != null && log.isDebugEnabled()) { + log.debug(String.format("hook[%s] exitValue: %d", name, result.getExitValue())); BufferedReader br = new BufferedReader(new StringReader(result.getOutput())); try { String line; while ((line = br.readLine()) != null) { - log.info("hook[" + getName() + "] output: " + line); + log.debug(String.format("hook[%s] output: %s", name, line)); } } catch (IOException iox) { log.error("Error writing hook output", iox);