This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit f2c51c4f6ce1bf0e76422597fe0387fdcf6803ea Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Fri Jan 29 12:01:09 2021 +0100 CAMEL-16072: camel-main - be less verbose in summary off mode --- .../java/org/apache/camel/StartupSummaryLevel.java | 1 + .../camel/impl/engine/AbstractCamelContext.java | 29 +++++++++++++--------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/core/camel-api/src/main/java/org/apache/camel/StartupSummaryLevel.java b/core/camel-api/src/main/java/org/apache/camel/StartupSummaryLevel.java index 449d803..d025d67 100644 --- a/core/camel-api/src/main/java/org/apache/camel/StartupSummaryLevel.java +++ b/core/camel-api/src/main/java/org/apache/camel/StartupSummaryLevel.java @@ -28,6 +28,7 @@ public enum StartupSummaryLevel { Verbose, Default, Brief, + Oneline, Off } diff --git a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java index 04e225e..6cb184d 100644 --- a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java +++ b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java @@ -2924,7 +2924,8 @@ public abstract class AbstractCamelContext extends BaseService protected void logStartSummary() { // supervising route controller should do their own startup log summary boolean supervised = getRouteController().isSupervising(); - if (!supervised && startupSummaryLevel != StartupSummaryLevel.Off && LOG.isInfoEnabled()) { + if (!supervised && startupSummaryLevel != StartupSummaryLevel.Oneline && startupSummaryLevel != StartupSummaryLevel.Off + && LOG.isInfoEnabled()) { int started = 0; int total = 0; int disabled = 0; @@ -2970,14 +2971,17 @@ public abstract class AbstractCamelContext extends BaseService } } - long taken = stopWatch.taken(); - long max = buildTaken + initTaken + taken; - String total = TimeUtils.printDuration(max); - String start = TimeUtils.printDuration(taken); - String init = TimeUtils.printDuration(initTaken); - String built = TimeUtils.printDuration(buildTaken); - LOG.info("Apache Camel {} ({}) started in {} (build:{} init:{} start:{})", getVersion(), getName(), total, built, init, - start); + if (startupSummaryLevel != StartupSummaryLevel.Off && LOG.isInfoEnabled()) { + long taken = stopWatch.taken(); + long max = buildTaken + initTaken + taken; + String total = TimeUtils.printDuration(max); + String start = TimeUtils.printDuration(taken); + String init = TimeUtils.printDuration(initTaken); + String built = TimeUtils.printDuration(buildTaken); + LOG.info("Apache Camel {} ({}) started in {} (build:{} init:{} start:{})", getVersion(), getName(), total, built, + init, + start); + } } protected void doStartCamel() throws Exception { @@ -3147,7 +3151,7 @@ public abstract class AbstractCamelContext extends BaseService protected void doStop() throws Exception { stopWatch.restart(); - if (startupSummaryLevel != StartupSummaryLevel.Off) { + if (startupSummaryLevel != StartupSummaryLevel.Oneline && startupSummaryLevel != StartupSummaryLevel.Off) { if (shutdownStrategy != null && shutdownStrategy.getTimeUnit() != null) { long timeout = shutdownStrategy.getTimeUnit().toMillis(shutdownStrategy.getTimeout()); String to = TimeUtils.printDuration(timeout); @@ -3196,7 +3200,8 @@ public abstract class AbstractCamelContext extends BaseService } shutdownServices(list, false); - if (startupSummaryLevel != StartupSummaryLevel.Classic && startupSummaryLevel != StartupSummaryLevel.Off) { + if (startupSummaryLevel != StartupSummaryLevel.Classic && startupSummaryLevel != StartupSummaryLevel.Oneline + && startupSummaryLevel != StartupSummaryLevel.Off) { logRouteStopSummary(); } @@ -3286,7 +3291,7 @@ public abstract class AbstractCamelContext extends BaseService LOG.info("Apache Camel {} ({}) is shutdown in {}", getVersion(), getName(), TimeUtils.printDuration(stopWatch.taken())); } - } else { + } else if (startupSummaryLevel != StartupSummaryLevel.Off) { if (LOG.isInfoEnabled()) { String taken = TimeUtils.printDuration(stopWatch.taken()); LOG.info("Apache Camel {} ({}) shutdown in {} (uptime:{})", getVersion(), getName(), taken, getUptime());