Skip to content

Commit ad352a9

Browse files
rdhabaliatisonkun
andauthored
[fix][cli] Fix logging noise while admin tool exit (#19884)
Co-authored-by: tison <wander4096@gmail.com>
1 parent fff5e39 commit ad352a9

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/PulsarAdminTool.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ private static void exit(int code) {
306306
if (allowSystemExit) {
307307
// we are using halt and not System.exit, we do not mind about shutdown hooks
308308
// they are only slowing down the tool
309-
ShutdownUtil.triggerImmediateForcefulShutdown(code);
309+
ShutdownUtil.triggerImmediateForcefulShutdown(code, false);
310310
} else {
311311
System.out.println("Exit code is " + code + " (System.exit not called, as we are in test mode)");
312312
}

pulsar-common/src/main/java/org/apache/pulsar/common/util/ShutdownUtil.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,11 @@ public class ShutdownUtil {
4747
* @see Runtime#halt(int)
4848
*/
4949
public static void triggerImmediateForcefulShutdown(int status) {
50+
triggerImmediateForcefulShutdown(status, true);
51+
}
52+
public static void triggerImmediateForcefulShutdown(int status, boolean logging) {
5053
try {
51-
if (status != 0) {
54+
if (status != 0 && logging) {
5255
log.warn("Triggering immediate shutdown of current process with status {}", status,
5356
new Exception("Stacktrace for immediate shutdown"));
5457
}

0 commit comments

Comments
 (0)