## com.sun.jersey.api.container.filter
Class LoggingFilter

    java.lang.Object
      com.sun.jersey.api.container.filter.LoggingFilter

All Implemented Interfaces:
  ContainerRequestFilter, ContainerResponseFilter

    public class LoggingFilter

extends java.lang.Object
implements ContainerRequestFilter, ContainerResponseFilter

A logging filter.

The request headers, request entity, response headers and response entity will be logged. By default logging will be output to System.out.

When an application is deployed as a Servlet or Filter this Jersey filter can be registered using the following initialization parameters:

>          <init-param>
>              <param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>
>              <param-value>com.sun.jersey.api.container.filter.LoggingFilter</param-value>
>          </init-param>
>          <init-param>
>              <param-name>com.sun.jersey.spi.container.ContainerResponseFilters</param-name>
>              <param-value>com.sun.jersey.api.container.filter.LoggingFilter</param-value>
>          </init-param>

The logging of entities may be disabled by setting the feature `FEATURE_LOGGING_DISABLE_ENTITY` to true. When an application is deployed as a Servlet or Filter this feature can be registered using the following initialization parameter:

>          <init-param>
>              <param-name>com.sun.jersey.config.feature.logging.DisableEntitylogging</param-name>
>              <param-value>true</param-value>
>          </init-param>

Author:
  Paul.Sandoz@Sun.Com
See Also:
  `com.sun.jersey.api.container.filter`

Field Summary
`static java.lang.String` | `FEATURE_LOGGING_DISABLE_ENTITY` If true the request and response entities (if present) will not be logged.

Constructor Summary
`LoggingFilter()` Create a logging filter logging the request and response to a default JDK logger, named as the fully qualified class name of this class.
`LoggingFilter(java.util.logging.Logger logger)` Create a logging filter logging the request and response to a JDK logger.

Method Summary
`ContainerRequest` | `filter(ContainerRequest request)` Filter the request.
`ContainerResponse` | `filter(ContainerRequest request, ContainerResponse response)` Filter the response.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### FEATURE_LOGGING_DISABLE_ENTITY

    public static final java.lang.String FEATURE_LOGGING_DISABLE_ENTITY

  If true the request and response entities (if present) will not be logged. If false the request and response entities will be logged.

  The default value is false.

  See Also:
    Constant Field Values

Constructor Detail

### LoggingFilter

    public LoggingFilter()

  Create a logging filter logging the request and response to a default JDK logger, named as the fully qualified class name of this class.

### LoggingFilter

    public LoggingFilter(java.util.logging.Logger logger)

  Create a logging filter logging the request and response to a JDK logger.

  Parameters:
    `logger` - the logger to log requests and responses.

Method Detail

### filter

    public ContainerRequest filter(ContainerRequest request)

  Description copied from interface: `ContainerRequestFilter`
  Filter the request.

  An implementation may modify the state of the request or create a new instance.

  Specified by:
    `filter` in interface `ContainerRequestFilter`
  Parameters:
    `request` - the request.
  Returns:
    the request.

### filter

    public ContainerResponse filter(ContainerRequest request,
                                    ContainerResponse response)

  Description copied from interface: `ContainerResponseFilter`
  Filter the response.

  An implementation may modify the state of the response or return a new instance.

  Specified by:
    `filter` in interface `ContainerResponseFilter`
  Parameters:
    `request` - the request.
    `response` - the response.
  Returns:
    the response.

Copyright © 2017 Oracle Corporation. All Rights Reserved.