[
https://issues.apache.org/jira/browse/CAMEL-11896?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16205347#comment-16205347
]
ASF GitHub Bot commented on CAMEL-11896:
----------------------------------------
GitHub user sam-ma opened a pull request:
https://github.com/apache/camel/pull/2040
CAMEL-11896: set CamelLogDebugBodyMaxChars when 0 or negative
[CAMEL-11896](https://issues.apache.org/jira/browse/CAMEL-11896): set
CamelLogDebugBodyMaxChars when 0 or negative
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/sam-ma/camel CAMEL-11896
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/camel/pull/2040.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #2040
----
commit 4cd45a26b43bc82709149c1d18e9922ffc789c2e
Author: Sam Ma <[email protected]>
Date: 2017-10-15T23:34:07Z
CAMEL-11896: set CamelLogDebugBodyMaxChars when 0 or negative
----
> 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
> Fix For: 2.19.4, 2.20.1, 2.21.0
>
> Attachments: CAMEL-11896.diff
>
>
> 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)