This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 5933d2e1980 CAMEL-18025: camel-jbang - Terminating running app with
ctrl + c then has little to no logging output
5933d2e1980 is described below
commit 5933d2e19809439985e0d12d13a76fa74a2b57f4
Author: Claus Ibsen <[email protected]>
AuthorDate: Fri Apr 29 16:45:59 2022 +0200
CAMEL-18025: camel-jbang - Terminating running app with ctrl + c then has
little to no logging output
---
.../camel/main/DefaultMainShutdownStrategy.java | 4 ++++
.../camel/dsl/jbang/core/common/RuntimeUtil.java | 1 +
.../src/main/resources/log4j2.component.properties | 19 +++++++++++++++++++
3 files changed, 24 insertions(+)
diff --git
a/core/camel-main/src/main/java/org/apache/camel/main/DefaultMainShutdownStrategy.java
b/core/camel-main/src/main/java/org/apache/camel/main/DefaultMainShutdownStrategy.java
index 5c73c05b9b6..878f6f95744 100644
---
a/core/camel-main/src/main/java/org/apache/camel/main/DefaultMainShutdownStrategy.java
+++
b/core/camel-main/src/main/java/org/apache/camel/main/DefaultMainShutdownStrategy.java
@@ -112,6 +112,10 @@ public class DefaultMainShutdownStrategy extends
SimpleMainShutdownStrategy {
// ignore
}
}
+ boolean success = main.getCamelContext().isStopped();
+ if (!success) {
+ LOG.warn("CamelContext not yet shutdown completely after:
{}. Forcing shutdown.", TimeUtils.printDuration(watch.taken()));
+ }
tracker.close();
}
LOG.trace("OnShutdown complete");
diff --git
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/RuntimeUtil.java
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/RuntimeUtil.java
index 27c04604d64..2c2c2f19244 100644
---
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/RuntimeUtil.java
+++
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/RuntimeUtil.java
@@ -18,6 +18,7 @@ package org.apache.camel.dsl.jbang.core.common;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.core.config.Configurator;
+import org.apache.logging.log4j.core.util.Constants;
import org.slf4j.LoggerFactory;
public final class RuntimeUtil {
diff --git
a/dsl/camel-jbang/camel-jbang-core/src/main/resources/log4j2.component.properties
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/log4j2.component.properties
new file mode 100644
index 00000000000..6bd22731cd7
--- /dev/null
+++
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/log4j2.component.properties
@@ -0,0 +1,19 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+# camel-jbang handled JVM shutdown so disable log4j hook
+log4j.shutdownHookEnabled = false
\ No newline at end of file