Skip to content

Commit

Permalink
Logging error only when exit code is non zero
Browse files Browse the repository at this point in the history
  • Loading branch information
arshadmohammad committed Apr 8, 2022
1 parent 31e124a commit e7e248b
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,12 @@ private ServiceUtils() {
* No-op strategy, useful for tests.
*/
public static final Consumer<Integer> 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 volatile Consumer<Integer> systemExitProcedure = SYSTEM_EXIT;
Expand Down

0 comments on commit e7e248b

Please sign in to comment.