users@jersey.java.net

[Jersey] Logging HTTP Body of Request

From: <justin.phillips_at_locusenergy.com>
Date: Wed, 23 Jan 2013 00:27:55 +0000 (GMT)

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.