[ 
https://issues.apache.org/jira/browse/CAMEL-11896?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen resolved CAMEL-11896.
---------------------------------
    Resolution: Fixed
      Assignee: Claus Ibsen

Thanks for the PR. I had to do a little adjustment and only use -1 for 
unlimited as spring boot assigns the value to 0 by default and we dont want to 
set the global option if so.

> 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
>            Assignee: Claus Ibsen
>            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)

Reply via email to