users@jersey.java.net

[Jersey] Re: Logging HTTP Body of Request

From: Arul Dhesiaseelan <aruld_at_acm.org>
Date: Tue, 22 Jan 2013 18:11:46 -1000

Hi,

It looks like you may have disabled entity logging [1]. By, default it
is enabled.

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

-Arul

[1]
http://jersey.java.net/nonav/apidocs/latest/jersey/com/sun/jersey/api/container/filter/LoggingFilter.html

On Tue, Jan 22, 2013 at 2:27 PM, <justin.phillips_at_locusenergy.com> wrote:

> Hello,
> I'm trying to log the actual json/xml that is sent to my app. I found
> the LoggingFilter and this configuration which I added to my web.xml
>
> <init-param>
>
> <param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param
> -name>
>
> <param-value>com.sun.jersey.api.container.filter.LoggingFilter</param-v
> alue>
> </init-param>
> <init-param>
>
> <param-name>com.sun.jersey.spi.container.ContainerResponseFilters</para
> m-name>
>
> <param-value>com.sun.jersey.api.container.filter.LoggingFilter</param-v
> alue>
> </init-param>
>
> When it deploys, it logs a bunch of stuff, including, the body of the
> response. See below.
>
> 1 > POST http://localhost:4949/api/groups/
> 1 > user-agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0
> OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> 1 > host: localhost:4949
> 1 > accept: application/json
> 1 > content-type: application/json
> 1 > content-length: 685
> 1 >
>
> 1 < 201
> 1 < Location: http://localhost:4949/api/groups/260
> 1 < Content-Type: application/json
> 1 <
> {"success":"true","msg":"Group created with id : 260","id":"260"}
>
>
>
> On POST and PUT though I don't see the body of the request.
> Does anyone know how to log that as well? I thought it would show up on
> the last "1 > " line.
>
> Thanks in advance.
>