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 Available
    • Unknown
    • 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

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            davsclaus Claus Ibsen
            sam.ma Sam Ma
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment