users@jersey.java.net

Re: [Jersey] log HTTP exchanges

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 10 Aug 2009 16:26:24 +0200

On Aug 9, 2009, at 1:59 PM, Paul Sandoz wrote:

> Hi,
>
> I looked briefly into this and it should be rather easy to modify,
> but i have one question.
>
> Do people think it appropriate log the request and response
> entities? There is no way to stream out the entities, so it requires
> that they are buffered as String instances. For large requests/
> responses this may be problematic but perhaps that is the cost of
> logging? also there could be a feature to turn off entity logging.
>

This is fixed in the trunk (JavaDoc below).

Client side will be fixed tomorrow.

Paul.

/**
  * A logging filter.
  * <p>
  * The request headers, request entity, response headers and response
entity
  * will be logged. By default logging will be output to System.out.
  * <p>
  * When an application is deployed as a Servlet or Filter this Jersey
filter can be
  * registered using the following initialization parameters:
  * <blockquote><pre>
  * &lt;init-param&gt;
  * &lt;param-
name&gt;com.sun.jersey.spi.container.ContainerRequestFilters&lt;/param-
name&gt;
  * &lt;param-
value&gt;com.sun.jersey.api.container.filter.LoggingFilter&lt;/param-
value&gt;
  * &lt;/init-param&gt
  * &lt;init-param&gt
  * &lt;param-
name&gt;com.sun.jersey.spi.container.ContainerResponseFilters&lt;/
param-name&gt;
  * &lt;param-
value&gt;com.sun.jersey.api.container.filter.LoggingFilter&lt;/param-
value&gt;
  * &lt;/init-param&gt;
  * </pre></blockquote>
  * <p>
  * The logging of entities may be disabled by setting the feature
  * {_at_link #FEATURE_LOGGING_DISABLE_ENTITY} to true. When an
application is
  * deployed as a Servlet or Filter this Jersey filter can be
  * registered using the following initialization parameter:
  * <blockquote><pre>
  * &lt;init-param&gt;
  * &lt;param-
name&gt;com.sun.jersey.config.feature.logging.DisableEntitylogging&lt;/
param-name&gt;
  * &lt;param-value&gt;true&lt;/param-value&gt;
  * &lt;/init-param&gt
  * </pre></blockquote>
  *
  * @author Paul.Sandoz_at_Sun.Com
  * @see com.sun.jersey.api.container.filter
  */