File tree Expand file tree Collapse file tree 3 files changed +43
-2
lines changed
fluss-dist/src/main/resources/bin
fluss-server/src/main/java/org/apache/fluss/server Expand file tree Collapse file tree 3 files changed +43
-2
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ FLUSS_LOG_PREFIX="${FLUSS_LOG_DIR}/fluss-${FLUSS_IDENT_STRING}-${DAEMON}-${id}-$
7979log=" ${FLUSS_LOG_PREFIX} .log"
8080out=" ${FLUSS_LOG_PREFIX} .out"
8181
82- log_setting=(" -Dlog.file=${log} " " -Dlog4j.configuration=file:${FLUSS_CONF_DIR} /log4j.properties" " -Dlog4j.configurationFile=file:${FLUSS_CONF_DIR} /log4j.properties" " -Dlogback.configurationFile=file:${FLUSS_CONF_DIR} /logback.xml" )
82+ log_setting=(" -Dlog.file=${log} " " -Dlog4j.shutdownHookEnabled=false " " -Dlog4j. configuration=file:${FLUSS_CONF_DIR} /log4j.properties" " -Dlog4j.configurationFile=file:${FLUSS_CONF_DIR} /log4j.properties" " -Dlogback.configurationFile=file:${FLUSS_CONF_DIR} /logback.xml" )
8383
8484function guaranteed_kill {
8585 to_stop_pid=$1
Original file line number Diff line number Diff line change 4949import java .util .concurrent .TimeUnit ;
5050import java .util .concurrent .TimeoutException ;
5151
52+ import static org .apache .fluss .server .utils .LogShutdownUtil .shutdownLogIfPossible ;
53+
5254/** An abstract base server class for {@link CoordinatorServer} & {@link TabletServer}. */
5355public abstract class ServerBase implements AutoCloseableAsync , FatalErrorHandler {
5456
@@ -146,7 +148,12 @@ public void start() throws Exception {
146148 private void addShutDownHook () {
147149 shutDownHook =
148150 ShutdownHookUtil .addShutdownHook (
149- () -> this .closeAsync (Result .JVM_SHUTDOWN ).join (), getServerName (), LOG );
151+ () -> {
152+ this .closeAsync (Result .JVM_SHUTDOWN ).join ();
153+ shutdownLogIfPossible ();
154+ },
155+ getServerName (),
156+ LOG );
150157 }
151158
152159 @ Override
Original file line number Diff line number Diff line change 1+ /*
2+ * Licensed to the Apache Software Foundation (ASF) under one or more
3+ * contributor license agreements. See the NOTICE file distributed with
4+ * this work for additional information regarding copyright ownership.
5+ * The ASF licenses this file to You under the Apache License, Version 2.0
6+ * (the "License"); you may not use this file except in compliance with
7+ * the License. You may obtain a copy of the License at
8+ *
9+ * http://www.apache.org/licenses/LICENSE-2.0
10+ *
11+ * Unless required by applicable law or agreed to in writing, software
12+ * distributed under the License is distributed on an "AS IS" BASIS,
13+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+ * See the License for the specific language governing permissions and
15+ * limitations under the License.
16+ */
17+
18+ package org .apache .fluss .server .utils ;
19+
20+ /** Utility class to shut down log system. */
21+ public class LogShutdownUtil {
22+
23+ public static void shutdownLogIfPossible () {
24+ try {
25+ Class <?> logManager = Class .forName ("org.apache.logging.log4j.LogManager" );
26+ logManager .getMethod ("shutdown" ).invoke (null );
27+ } catch (ClassNotFoundException e ) {
28+ System .err .println ("Class org.apache.logging.log4j.LogManager not found" );
29+ } catch (Exception e ) {
30+ System .err .println (
31+ "Error to invoke shutdown method of org.apache.logging.log4j.LogManager" );
32+ }
33+ }
34+ }
You can’t perform that action at this time.
0 commit comments