Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-4963

Unable to set prettyLogging for class extending LoggingOutInterceptor

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Not A Problem
    • Affects Version/s: 2.7.4
    • Fix Version/s: Invalid
    • Component/s: Bus
    • Labels:
      None
    • Environment:

      Ubuntu Linux 12.04 with Java SE 6 / Solaris 5.10 with Java SE 6

    • Estimated Complexity:
      Unknown

      Description

      I'm using the following configuration in cxf.xml:

      [...]

      <bean id="logInbound" class="[...]">
      <property name="prettyLogging" value="true" />
      </bean>

      <bean id="logOutbound" class="[...]">
      <property name="prettyLogging" value="true" />
      </bean>

      <cxf:bus>

      <cxf:inInterceptors>
      <ref bean="logInbound" />
      </cxf:inInterceptors>

      <cxf:outInterceptors>
      <ref bean="logOutbound" />
      </cxf:outInterceptors>

      <cxf:inFaultInterceptors>
      <ref bean="logInbound" />
      </cxf:inFaultInterceptors>

      <cxf:outFaultInterceptors>
      <ref bean="logOutbound" />
      </cxf:outFaultInterceptors>

      <cxf:features>
      <cxf:logging />
      </cxf:features>

      </cxf:bus>

      [...]

      where logInbound and logOutbound are Spring bean instances of classes extending LoggingInInterceptor and LoggingOutInterceptor, respectively (class names are irrelevant).

      After upgrade from version 2.3.2 to 2.7.4 it seems that the prettyLogging value is ignored for intercepted outbound messages.

      From what I could observe during a debugging session, the problem is that there are actually two interceptors, logging outbound messages and sharing the same stream. First one of them is logOutbound. The second one is some internal instance of LoggingOutInterceptor.

      The internal instance is called first and used to format the message. Since it has pretty printing disabled, the message is unformatted. When my instance (logOutbound) is called, it verifies that the message has already been logged into the stream and doesn't repeat this step.

      Finally the cached and unformatted message is logged and the prettyLogging property is effectively ignored.

        Attachments

          Activity

            People

            • Assignee:
              dkulp Daniel Kulp
              Reporter:
              poltarzewski Przemysław Ołtarzewski

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment