org.apache.cxf.interceptor

## Class AbstractLoggingInterceptor

- java.lang.Object
- - org.apache.cxf.phase.AbstractPhaseInterceptor<Message>
  - - org.apache.cxf.interceptor.AbstractLoggingInterceptor

- All Implemented Interfaces:
    Interceptor<Message>, PhaseInterceptor<Message>
  Direct Known Subclasses:
    LoggingInInterceptor, LoggingOutInterceptor

      public abstract class AbstractLoggingInterceptor
      extends AbstractPhaseInterceptor<Message>

  A simple logging handler which outputs the bytes of the message to the Logger.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static String` | `BINARY_CONTENT_MESSAGE`
    `static int` | `DEFAULT_LIMIT`
    `protected int` | `limit`
    `protected static String` | `MULTIPART_CONTENT_MESSAGE`
    `protected boolean` | `prettyLogging`
    `protected long` | `threshold`
    `protected PrintWriter` | `writer`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractLoggingInterceptor(String phase)`
    `AbstractLoggingInterceptor(String id, String phase)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `List<String>` | `getBinaryContentMediaTypes()`
    `long` | `getInMemThreshold()`
    `int` | `getLimit()`
    `protected abstract Logger` | `getLogger()`
    `PrintWriter` | `getPrintWriter()`
    `protected boolean` | `isBinaryContent(String contentType)`
    `protected static boolean` | `isLoggingDisabledNow(Message message)`
    `protected boolean` | `isMultipartContent(String contentType)`
    `boolean` | `isPrettyLogging()`
    `boolean` | `isShowBinaryContent()`
    `boolean` | `isShowMultipartContent()`
    `protected void` | `log(Logger logger, String message)`
    `void` | `setBinaryContentMediaTypes(List<String> binaryContentMediaTypes)`
    `void` | `setInMemThreshold(long t)`
    `void` | `setLimit(int lim)`
    `void` | `setOutputLocation(String s)`
    `void` | `setPrettyLogging(boolean flag)`
    `void` | `setPrintWriter(PrintWriter w)`
    `void` | `setShowBinaryContent(boolean showBinaryContent)`
    `void` | `setShowMultipartContent(boolean showMultipartContent)`
    `protected String` | `transform(String originalLogString)` Transform the string before display.
    `protected void` | `writePayload(StringBuilder builder, CachedOutputStream cos, String encoding, String contentType, boolean truncated)`
    `protected void` | `writePayload(StringBuilder builder, StringWriter stringWriter, String contentType)`
    `protected void` | `writePrettyPayload(StringBuilder builder, StringWriter stringWriter, String contentType)`

    - ### Methods inherited from class org.apache.cxf.phase.AbstractPhaseInterceptor

      `addAfter, addAfter, addBefore, addBefore, getAdditionalInterceptors, getAfter, getBefore, getId, getPhase, handleFault, isGET, isRequestor, setAfter, setBefore`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.cxf.interceptor.Interceptor

      `handleMessage`

- - ### Field Detail

    - #### DEFAULT_LIMIT

          public static final int DEFAULT_LIMIT

      See Also:
        Constant Field Values

    - #### BINARY_CONTENT_MESSAGE

          protected static final String BINARY_CONTENT_MESSAGE

      See Also:
        Constant Field Values

    - #### MULTIPART_CONTENT_MESSAGE

          protected static final String MULTIPART_CONTENT_MESSAGE

      See Also:
        Constant Field Values

    - #### limit

          protected int limit

    - #### threshold

          protected long threshold

    - #### writer

          protected PrintWriter writer

    - #### prettyLogging

          protected boolean prettyLogging

  - ### Constructor Detail

    - #### AbstractLoggingInterceptor

          public AbstractLoggingInterceptor(String phase)

    - #### AbstractLoggingInterceptor

          public AbstractLoggingInterceptor(String id,
                                            String phase)

  - ### Method Detail

    - #### isLoggingDisabledNow

          protected static boolean isLoggingDisabledNow(Message message)
                                                 throws Fault

      Throws:
        `Fault`

    - #### getLogger

          protected abstract Logger getLogger()

    - #### setOutputLocation

          public void setOutputLocation(String s)

    - #### setPrintWriter

          public void setPrintWriter(PrintWriter w)

    - #### getPrintWriter

          public PrintWriter getPrintWriter()

    - #### setLimit

          public void setLimit(int lim)

    - #### getLimit

          public int getLimit()

    - #### setPrettyLogging

          public void setPrettyLogging(boolean flag)

    - #### isPrettyLogging

          public boolean isPrettyLogging()

    - #### setInMemThreshold

          public void setInMemThreshold(long t)

    - #### getInMemThreshold

          public long getInMemThreshold()

    - #### writePayload

          protected void writePayload(StringBuilder builder,
                                      CachedOutputStream cos,
                                      String encoding,
                                      String contentType,
                                      boolean truncated)
                               throws Exception

      Throws:
        `Exception`

    - #### writePayload

          protected void writePayload(StringBuilder builder,
                                      StringWriter stringWriter,
                                      String contentType)
                               throws Exception

      Throws:
        `Exception`

    - #### writePrettyPayload

          protected void writePrettyPayload(StringBuilder builder,
                                            StringWriter stringWriter,
                                            String contentType)
                                     throws Exception

      Throws:
        `Exception`

    - #### transform

          protected String transform(String originalLogString)

      Transform the string before display. The implementation in this class does nothing. Override this method if you wish to change the contents of the logged message before it is delivered to the output. For example, you can use this to mask out sensitive information.
      Parameters:
        `originalLogString` - the raw log message.
      Returns:
        transformed data

    - #### log

          protected void log(Logger logger,
                             String message)

    - #### setShowBinaryContent

          public void setShowBinaryContent(boolean showBinaryContent)

    - #### isShowBinaryContent

          public boolean isShowBinaryContent()

    - #### isBinaryContent

          protected boolean isBinaryContent(String contentType)

    - #### isShowMultipartContent

          public boolean isShowMultipartContent()

    - #### setShowMultipartContent

          public void setShowMultipartContent(boolean showMultipartContent)

    - #### isMultipartContent

          protected boolean isMultipartContent(String contentType)

    - #### getBinaryContentMediaTypes

          public List<String> getBinaryContentMediaTypes()

    - #### setBinaryContentMediaTypes

          public void setBinaryContentMediaTypes(List<String> binaryContentMediaTypes)

Apache CXF