diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxn.java b/zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxn.java index ed955540e1a..c3f0079c6e9 100644 --- a/zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxn.java +++ b/zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxn.java @@ -1294,10 +1294,11 @@ public void run() { } catch (Throwable e) { if (closing) { // closing so this is expected - LOG.warn( - "An exception was thrown while closing send thread for session 0x{}.", - Long.toHexString(getSessionId()), - e); + if (LOG.isDebugEnabled()) { + LOG.debug( + "An exception was thrown while closing send thread for session 0x{}.", + Long.toHexString(getSessionId()), e); + } break; } else { LOG.warn( diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/util/ServiceUtils.java b/zookeeper-server/src/main/java/org/apache/zookeeper/util/ServiceUtils.java index 68a25ebb487..99cc685b314 100644 --- a/zookeeper-server/src/main/java/org/apache/zookeeper/util/ServiceUtils.java +++ b/zookeeper-server/src/main/java/org/apache/zookeeper/util/ServiceUtils.java @@ -39,7 +39,14 @@ private ServiceUtils() { */ @SuppressFBWarnings("DM_EXIT") public static final Consumer SYSTEM_EXIT = (code) -> { - LOG.error("Exiting JVM with code {}", code); + String msg = "Exiting JVM with code {}"; + if (code == 0) { + // JVM exits normally + LOG.info(msg, code); + } else { + // JVM exits with error + LOG.error(msg, code); + } System.exit(code); }; @@ -47,8 +54,12 @@ private ServiceUtils() { * No-op strategy, useful for tests. */ public static final Consumer LOG_ONLY = (code) -> { - LOG.error("Fatal error, JVM should exit with code {}. " + if (code != 0) { + LOG.error("Fatal error, JVM should exit with code {}. " + "Actually System.exit is disabled", code); + } else { + LOG.info("JVM should exit with code {}. Actually System.exit is disabled", code); + } }; private static Consumer systemExitProcedure = SYSTEM_EXIT;