Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-11896

camel-spring-boot - set CamelLogDebugBodyMaxChars when 0 or negative

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Patch Info:
      Patch Available
    • Estimated Complexity:
      Unknown
    • Flags:
      Patch

      Description

      According to the camel doc, 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 which only set CamelLogDebugBodyMaxChars when the configuration item is positive.

      if (config.getLogDebugMaxChars() > 0) {
          camelContext.getGlobalOptions().put(Exchange.LOG_DEBUG_BODY_MAX_CHARS, "" + config.getLogDebugMaxChars());
      }
      

      To solve the issue, simply remove the if condition.
      diff for the patch:

      --- 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());
      

        Attachments

          Activity

            People

            • Assignee:
              davsclaus Claus Ibsen
              Reporter:
              sam.ma Sam Ma

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment