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 d6c4a0a3e7f CAMEL-18790: camel-log - Do not show MEP by default
d6c4a0a3e7f is described below

commit d6c4a0a3e7f1bb9c054e00ef19dd53b85b033df4
Author: Claus Ibsen <[email protected]>
AuthorDate: Fri Dec 2 10:20:19 2022 +0100

    CAMEL-18790: camel-log - Do not show MEP by default
---
 .../generated/resources/org/apache/camel/component/log/log.json    | 2 +-
 .../src/main/java/org/apache/camel/component/log/LogEndpoint.java  | 6 +++---
 .../test/java/org/apache/camel/component/log/LogEndpointTest.java  | 4 ++--
 .../camel/support/processor/DefaultExchangeFormatterTest.java      | 7 +++----
 .../apache/camel/support/processor/DefaultExchangeFormatter.java   | 4 ++--
 .../modules/ROOT/pages/camel-3x-upgrade-guide-3_20.adoc            | 2 ++
 6 files changed, 13 insertions(+), 12 deletions(-)

diff --git 
a/components/camel-log/src/generated/resources/org/apache/camel/component/log/log.json
 
b/components/camel-log/src/generated/resources/org/apache/camel/component/log/log.json
index ba7384688c3..fc2d73c458b 100644
--- 
a/components/camel-log/src/generated/resources/org/apache/camel/component/log/log.json
+++ 
b/components/camel-log/src/generated/resources/org/apache/camel/component/log/log.json
@@ -50,7 +50,7 @@
     "showCaughtException": { "kind": "parameter", "displayName": "Show Caught 
Exception", "group": "formatting", "label": "formatting", "required": false, 
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": false, "description": "If the exchange 
has a caught exception, show the exception message (no stack trace). A caught 
exception is stored as a property on the exchange (using the key 
org.apache.camel.Exchange#EXCEPTION_CAU [...]
     "showException": { "kind": "parameter", "displayName": "Show Exception", 
"group": "formatting", "label": "formatting", "required": false, "type": 
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": false, "description": "If the exchange has an 
exception, show the exception message (no stacktrace)" },
     "showExchangeId": { "kind": "parameter", "displayName": "Show Exchange 
Id", "group": "formatting", "label": "formatting", "required": false, "type": 
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": false, "description": "Show the unique 
exchange ID." },
-    "showExchangePattern": { "kind": "parameter", "displayName": "Show 
Exchange Pattern", "group": "formatting", "label": "formatting", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": true, "description": 
"Shows the Message Exchange Pattern (or MEP for short)." },
+    "showExchangePattern": { "kind": "parameter", "displayName": "Show 
Exchange Pattern", "group": "formatting", "label": "formatting", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": false, "description": 
"Shows the Message Exchange Pattern (or MEP for short)." },
     "showFiles": { "kind": "parameter", "displayName": "Show Files", "group": 
"formatting", "label": "formatting", "required": false, "type": "boolean", 
"javaType": "boolean", "deprecated": false, "autowired": false, "secret": 
false, "defaultValue": false, "description": "If enabled Camel will output 
files" },
     "showFuture": { "kind": "parameter", "displayName": "Show Future", 
"group": "formatting", "label": "formatting", "required": false, "type": 
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": false, "description": "If enabled Camel will 
on Future objects wait for it to complete to obtain the payload to be logged." 
},
     "showHeaders": { "kind": "parameter", "displayName": "Show Headers", 
"group": "formatting", "label": "formatting", "required": false, "type": 
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": false, "description": "Show the message 
headers." },
diff --git 
a/components/camel-log/src/main/java/org/apache/camel/component/log/LogEndpoint.java
 
b/components/camel-log/src/main/java/org/apache/camel/component/log/LogEndpoint.java
index da72b7916b6..f33e0a3c9f3 100644
--- 
a/components/camel-log/src/main/java/org/apache/camel/component/log/LogEndpoint.java
+++ 
b/components/camel-log/src/main/java/org/apache/camel/component/log/LogEndpoint.java
@@ -76,9 +76,9 @@ public class LogEndpoint extends ProcessorEndpoint implements 
LineNumberAware {
     private ExchangeFormatter exchangeFormatter;
     @UriParam(label = "formatting", description = "Show the unique exchange 
ID.")
     private boolean showExchangeId;
-    @UriParam(label = "formatting", defaultValue = "true",
+    @UriParam(label = "formatting",
               description = "Shows the Message Exchange Pattern (or MEP for 
short).")
-    private boolean showExchangePattern = true;
+    private boolean showExchangePattern;
     @UriParam(label = "formatting",
               description = "Show the exchange properties (only custom). Use 
showAllProperties to show both internal and custom properties.")
     private boolean showProperties;
@@ -157,7 +157,7 @@ public class LogEndpoint extends ProcessorEndpoint 
implements LineNumberAware {
         if (this.localFormatter == null) {
 
             // are any options configured if not we can optimize to use shared 
default
-            boolean changed = !showExchangePattern || !skipBodyLineSeparator 
|| !showBody || !showBodyType || maxChars != 10000
+            boolean changed = showExchangePattern || !skipBodyLineSeparator || 
!showBody || !showBodyType || maxChars != 10000
                     || style != DefaultExchangeFormatter.OutputStyle.Default 
|| plain;
             changed |= showExchangeId || showProperties || showAllProperties 
|| showHeaders || showException
                     || showCaughtException
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/component/log/LogEndpointTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/component/log/LogEndpointTest.java
index 38cfe92dba7..4000fe7664d 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/component/log/LogEndpointTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/component/log/LogEndpointTest.java
@@ -96,7 +96,7 @@ public class LogEndpointTest extends ContextTestSupport {
         ex.setProperty(Exchange.EXCEPTION_CAUGHT, new 
RuntimeException("test"));
         template.send("log:testShowCaughtException?showCaughtException=true", 
ex);
         assertEquals(
-                "Exchange[ExchangePattern: InOnly, BodyType: null, Body: [Body 
is null], CaughtExceptionType: java.lang.RuntimeException, 
CaughtExceptionMessage: test]",
+                "Exchange[BodyType: null, Body: [Body is null], 
CaughtExceptionType: java.lang.RuntimeException, CaughtExceptionMessage: test]",
                 logged.get());
     }
 
@@ -108,7 +108,7 @@ public class LogEndpointTest extends ContextTestSupport {
         ex.setException(new RuntimeException("test"));
         template.send("log:testShowException?showException=true", ex);
         assertEquals(
-                "Exchange[ExchangePattern: InOnly, BodyType: null, Body: [Body 
is null], ExceptionType: java.lang.RuntimeException, ExceptionMessage: test]",
+                "Exchange[BodyType: null, Body: [Body is null], ExceptionType: 
java.lang.RuntimeException, ExceptionMessage: test]",
                 logged.get());
     }
 
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/support/processor/DefaultExchangeFormatterTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/support/processor/DefaultExchangeFormatterTest.java
index 2ad76ee160d..9821390034e 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/support/processor/DefaultExchangeFormatterTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/support/processor/DefaultExchangeFormatterTest.java
@@ -49,15 +49,14 @@ public class DefaultExchangeFormatterTest {
 
     @Test
     /*
-     * The formatted exchange without limitation is Exchange[ExchangePattern:
-     * InOnly, BodyType: String, Body: This is the message body] The
-     * "Exchange[", the "...", and the "]" do not count here, but the leading
+     * The formatted exchange without limitation is Exchange[BodyType: String, 
Body: This is the message body]
+     * The "Exchange[", the "...", and the "]" do not count here, but the 
leading
      * ", " that is removed later does count...
      */
     public void testFormatWithMaxCharsParameter() {
         exchangeFormatter.setMaxChars(60);
         String formattedExchange = exchangeFormatter.format(exchange);
-        assertEquals(60 + "Exchange[...]".length() - ", ".length(), 
formattedExchange.length());
+        assertEquals(47 + "Exchange[...]".length() - ", ".length(), 
formattedExchange.length());
     }
 
     @Test
diff --git 
a/core/camel-support/src/main/java/org/apache/camel/support/processor/DefaultExchangeFormatter.java
 
b/core/camel-support/src/main/java/org/apache/camel/support/processor/DefaultExchangeFormatter.java
index 79e0843ee63..aa16d0691fe 100644
--- 
a/core/camel-support/src/main/java/org/apache/camel/support/processor/DefaultExchangeFormatter.java
+++ 
b/core/camel-support/src/main/java/org/apache/camel/support/processor/DefaultExchangeFormatter.java
@@ -50,9 +50,9 @@ public class DefaultExchangeFormatter implements 
ExchangeFormatter {
 
     @UriParam(label = "formatting", description = "Show the unique exchange 
ID.")
     private boolean showExchangeId;
-    @UriParam(label = "formatting", defaultValue = "true",
+    @UriParam(label = "formatting",
               description = "Shows the Message Exchange Pattern (or MEP for 
short).")
-    private boolean showExchangePattern = true;
+    private boolean showExchangePattern;
     @UriParam(label = "formatting", description = "Show the exchange 
properties (only custom).")
     private boolean showProperties;
     @UriParam(label = "formatting", description = "Show all the exchange 
properties (both internal and custom).")
diff --git 
a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_20.adoc 
b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_20.adoc
index f67f7c30f08..a5bbdbf619c 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_20.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_20.adoc
@@ -33,6 +33,8 @@ The log component now shows cached streams 
(`org.apache.camel.StreamCache`) mess
 Camel comes with stream caching enabled out-of-the-box, and therefore using 
the log component you would
 expect to see the message body. Setting `showCachedStreams=false` to use old 
behaviour.
 
+The log component now does not show MEP by default. You can turn this on by 
`showExchangePattern=true`.
+
 === camel-jsonpath
 
 There is a new option `unpackArray` that unpacks a single-element Json array, 
matched by a Jsonpath, into an object. This option is disabled by default (this 
behaviour was enabled by default in previous Camel versions). There is a new 
expression `jsonpathUnpack(String text, Class<?> resultType)` that makes use of 
this new option.

Reply via email to