You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Sam Ma (JIRA)" <ji...@apache.org> on 2017/10/12 03:58:00 UTC

[jira] [Created] (CAMEL-11896) camel-spring-boot - set CamelLogDebugBodyMaxChars when 0 or negative

Sam Ma created CAMEL-11896:
------------------------------

             Summary: camel-spring-boot - set CamelLogDebugBodyMaxChars when 0 or negative
                 Key: CAMEL-11896
                 URL: https://issues.apache.org/jira/browse/CAMEL-11896
             Project: Camel
          Issue Type: Bug
          Components: camel-spring-boot
    Affects Versions: 2.19.3
            Reporter: Sam Ma
            Priority: Minor


According to the [camel doc|http://camel.apache.org/how-do-i-set-the-max-chars-when-debug-logging-messages-in-camel.html], the value of _CamelLogDebugBodyMaxChars_ could be 0 or negative which allows entire body to be shown in the debug log.

I noticed the following code in [CamelAutoConfiguration.java|https://github.com/apache/camel/blob/55b0124379ce4e58890c71917fb6e12b30396780/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java#L143] which only set _CamelLogDebugBodyMaxChars_ when the configuration item is positive.
{code:java}
if (config.getLogDebugMaxChars() > 0) {
    camelContext.getGlobalOptions().put(Exchange.LOG_DEBUG_BODY_MAX_CHARS, "" + config.getLogDebugMaxChars());
}
{code}

To solve the issue, simply remove the if condition.
diff for the patch:
{code:none}
--- CamelAutoConfiguration.java.old	2017-10-12 14:32:42.000000000 +1100
+++ CamelAutoConfiguration.java	2017-10-12 14:32:57.000000000 +1100
@@ -140,9 +140,7 @@
         camelContext.getShutdownStrategy().setShutdownRoutesInReverseOrder(config.isShutdownRoutesInReverseOrder());
         camelContext.getShutdownStrategy().setLogInflightExchangesOnTimeout(config.isShutdownLogInflightExchangesOnTimeout());
 
-        if (config.getLogDebugMaxChars() > 0) {
-            camelContext.getGlobalOptions().put(Exchange.LOG_DEBUG_BODY_MAX_CHARS, "" + config.getLogDebugMaxChars());
-        }
+        camelContext.getGlobalOptions().put(Exchange.LOG_DEBUG_BODY_MAX_CHARS, "" + config.getLogDebugMaxChars());
 
         // stream caching
         camelContext.setStreamCaching(config.isStreamCachingEnabled());
{code}




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)