You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2019/11/24 10:30:28 UTC

[camel] branch master updated: Disable tracing fix (#3361)

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


The following commit(s) were added to refs/heads/master by this push:
     new 409529f  Disable tracing fix (#3361)
409529f is described below

commit 409529fd3f60d2978d86927b062f551aa55066d7
Author: Federico Valeri <fv...@users.noreply.github.com>
AuthorDate: Sun Nov 24 11:30:03 2019 +0100

    Disable tracing fix (#3361)
    
    Even if tracing is disabled using 'camel.main.tracing = false', it may be re-enabled by some other property (i.e. camel.context.tracer.exchange-formatter.show-headers). The problem shows up regardless of the value of the *.tracer.* property.
---
 .../src/main/java/org/apache/camel/main/BaseMainSupport.java |  5 +++++
 .../src/test/java/org/apache/camel/main/MainTest.java        | 12 ++++++++++++
 core/camel-main/src/test/resources/application.properties    |  5 ++++-
 3 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java b/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java
index c1c8825..01799ec 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java
@@ -530,6 +530,11 @@ public abstract class BaseMainSupport extends ServiceSupport {
             autoConfigurationFromProperties(camelContext, autoConfiguredProperties);
         }
 
+        // tracing may be enabled by some other property (i.e. camel.context.tracer.exchange-formatter.show-headers)
+        if (camelContext.isTracing() && !mainConfigurationProperties.isTracing()) {
+            camelContext.setTracing(Boolean.FALSE);
+        }
+
         // log summary of configurations
         if (mainConfigurationProperties.isAutoConfigurationLogSummary() && !autoConfiguredProperties.isEmpty()) {
             LOG.info("Auto-configuration summary:");
diff --git a/core/camel-main/src/test/java/org/apache/camel/main/MainTest.java b/core/camel-main/src/test/java/org/apache/camel/main/MainTest.java
index d60c43a..b5e95ae 100644
--- a/core/camel-main/src/test/java/org/apache/camel/main/MainTest.java
+++ b/core/camel-main/src/test/java/org/apache/camel/main/MainTest.java
@@ -104,6 +104,18 @@ public class MainTest extends Assert {
         main.stop();
     }
 
+    @Test
+    public void testDisableTracing() throws Exception {
+        Main main = new Main();
+        main.addRoutesBuilder(new MyRouteBuilder());
+        main.start();
+
+        CamelContext camelContext = main.getCamelContext();
+        assertFalse("Tracing should be disabled", camelContext.isTracing());
+
+        main.stop();
+    }
+
     public static class MyRouteBuilder extends RouteBuilder {
         @Override
         public void configure() throws Exception {
diff --git a/core/camel-main/src/test/resources/application.properties b/core/camel-main/src/test/resources/application.properties
index 8d8fba7..616da1e 100644
--- a/core/camel-main/src/test/resources/application.properties
+++ b/core/camel-main/src/test/resources/application.properties
@@ -18,4 +18,7 @@ hello=World
 
 camel.component.seda.concurrent-consumers=2
 camel.component.seda.queueSize=500
-camel.component.direct.timeout=1234
\ No newline at end of file
+camel.component.direct.timeout=1234
+
+camel.main.tracing = false
+camel.context.tracer.exchange-formatter.show-headers = true