Skip to content

Commit

Permalink
ZOOKEEPER-4515: ZK Cli quit command always logs error
Browse files Browse the repository at this point in the history
1. For connection closing state scenario, changed the log level to debug
2. When JVM exiting with code 0, then logging info instead of error
  • Loading branch information
arshadmohammad committed Apr 8, 2022
1 parent 54cb5c3 commit 31e124a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1284,10 +1284,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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,14 @@ private ServiceUtils() {
*/
@SuppressFBWarnings("DM_EXIT")
public static final Consumer<Integer> 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);
};

Expand Down

0 comments on commit 31e124a

Please sign in to comment.