This is an automated email from the ASF dual-hosted git repository.
swuferhong pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fluss.git
The following commit(s) were added to refs/heads/main by this push:
new 02cc35f4d [hotfix][dist] Disable Log4j shutdown hook in foreground
mode (#3634)
02cc35f4d is described below
commit 02cc35f4de13cae2e16f12ea489b6e7f6ec6ce2f
Author: yunhong <[email protected]>
AuthorDate: Fri Jul 10 13:35:27 2026 +0800
[hotfix][dist] Disable Log4j shutdown hook in foreground mode (#3634)
---
fluss-dist/src/main/resources/bin/fluss-console.sh | 2 +-
.../org/apache/fluss/dist/DistShellScriptTest.java | 56 ++++++++++++++++++++++
2 files changed, 57 insertions(+), 1 deletion(-)
diff --git a/fluss-dist/src/main/resources/bin/fluss-console.sh
b/fluss-dist/src/main/resources/bin/fluss-console.sh
index 902c01e39..f0086a37d 100644
--- a/fluss-dist/src/main/resources/bin/fluss-console.sh
+++ b/fluss-dist/src/main/resources/bin/fluss-console.sh
@@ -81,7 +81,7 @@ log="${FLUSS_LOG_PREFIX}.log"
out="${FLUSS_LOG_PREFIX}.out"
err="${FLUSS_LOG_PREFIX}.err"
-log_setting=("-Dlog.file=${log}"
"-Dlog4j.configuration=file:${FLUSS_CONF_DIR}/log4j-console.properties"
"-Dlog4j.configurationFile=file:${FLUSS_CONF_DIR}/log4j-console.properties"
"-Dlogback.configurationFile=file:${FLUSS_CONF_DIR}/logback-console.xml")
+log_setting=("-Dlog.file=${log}" "-Dlog4j.shutdownHookEnabled=false"
"-Dlog4j.configuration=file:${FLUSS_CONF_DIR}/log4j-console.properties"
"-Dlog4j.configurationFile=file:${FLUSS_CONF_DIR}/log4j-console.properties"
"-Dlogback.configurationFile=file:${FLUSS_CONF_DIR}/logback-console.xml")
echo "Starting $SERVICE as a console application on host $HOSTNAME."
diff --git
a/fluss-dist/src/test/java/org/apache/fluss/dist/DistShellScriptTest.java
b/fluss-dist/src/test/java/org/apache/fluss/dist/DistShellScriptTest.java
new file mode 100644
index 000000000..a5c7405dc
--- /dev/null
+++ b/fluss-dist/src/test/java/org/apache/fluss/dist/DistShellScriptTest.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.fluss.dist;
+
+import org.junit.jupiter.api.Test;
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+final class DistShellScriptTest {
+
+ private static final String LOG4J_SHUTDOWN_HOOK_DISABLED =
"-Dlog4j.shutdownHookEnabled=false";
+
+ @Test
+ void testForegroundAndDaemonDisableLog4jShutdownHook() throws Exception {
+ assertThat(readBinScript("fluss-console.sh"))
+ .contains(LOG4J_SHUTDOWN_HOOK_DISABLED)
+ .contains("log4j-console.properties");
+
+ assertThat(readBinScript("fluss-daemon.sh"))
+ .contains(LOG4J_SHUTDOWN_HOOK_DISABLED)
+ .contains("log4j.properties");
+ }
+
+ private static String readBinScript(String scriptName) throws IOException {
+ Path scriptPath =
+ Paths.get(
+ System.getProperty("project.basedir"),
+ "src",
+ "main",
+ "resources",
+ "bin",
+ scriptName);
+ return new String(Files.readAllBytes(scriptPath),
StandardCharsets.UTF_8);
+ }
+}