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

CxfEndpoint could use loggingSizeLimit = -1 for no size limit

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 2.15.3
    • Fix Version/s: 2.16.0
    • Component/s: camel-cxf, camel-cxfrs
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      When creating a CxfEndpoint, setting a loggingSizeLimit -1 to disable limiting payload logging cause no effect due to the code bellow. CXF own LoggingIn/OutInterceptor code accept -1 as unlimited.

      org.apache.camel.component.cxf.CxfEndpoint

      if (getLoggingSizeLimit() > 0) {
          sfb.getFeatures().add(new LoggingFeature(getLoggingSizeLimit()));
      } else {
          sfb.getFeatures().add(new LoggingFeature());
      }
      

      org.apache.cxf.feature.LoggingFeature

      private static final int DEFAULT_LIMIT = AbstractLoggingInterceptor.DEFAULT_LIMIT;
      private static final LoggingInInterceptor IN = new LoggingInInterceptor(DEFAULT_LIMIT);
      private static final LoggingOutInterceptor OUT = new LoggingOutInterceptor(DEFAULT_LIMIT);
      int limit = DEFAULT_LIMIT;
      
      public LoggingFeature() {}
      
      protected void initializeProvider(InterceptorProvider provider, Bus bus) {
          if (limit == DEFAULT_LIMIT && inLocation == null && outLocation == null && !prettyLogging) {
              provider.getInInterceptors().add(IN);
              provider.getInFaultInterceptors().add(IN);
              provider.getOutInterceptors().add(OUT);
              provider.getOutFaultInterceptors().add(OUT);
          } else {
                 //Creates and uses new Interceptors with specified limit
          }
      

      org.apache.cxf.interceptor.LoggingInInterceptor

      public LoggingInInterceptor(int lim) {
          this();
          limit = lim;
      }
      
      protected void logInputStream(Message message, InputStream is, LoggingMessage buffer, String encoding, String ct) {
      (...)
          //only copy up to the limit since that's all we need to log
          //we can stream the rest
          IOUtils.copyAtLeast(bis, bos, limit == -1 ? Integer.MAX_VALUE : limit);
      

        Attachments

          Activity

            People

            • Assignee:
              davsclaus Claus Ibsen
              Reporter:
              opendulo Bruno Marco Visioli
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: