title: How do I get Jersey 2.5.1 on tomcat to log request/response including entities (request/response body)
body: <p>I have a Jersey 2.5.1 application deployed on tomcat.  I have added following config in my web.xml:</p>
  
  <pre><code>&lt;init-param&gt;
    &lt;param-name&gt;jersey.config.server.provider.classnames&lt;/param-name&gt;
    &lt;param-value&gt;org.glassfish.jersey.filter.LoggingFilter&lt;/param-value&gt;
  &lt;/init-param&gt;
  </code></pre>
  
  <p>It's printing request and response headers.  However, it's not printing the request/response entities/bodies in the response.</p>
  
  <p>I tried playing with different params but no luck, like:</p>
  
  <pre><code>INFO: 1 * Server has received a request on thread http-bio-8080-exec-3
  1 &gt; accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
  1 &gt; accept-encoding: gzip,deflate,sdch
  1 &gt; accept-language: en-US,en;q=0.8
  1 &gt; cache-control: no-cache
  1 &gt; connection: keep-alive
  1 &gt; cookie: JSESSIONID=1F5CCACA7DF2EABA9475C270A95C91B2
  1 &gt; host: localhost:8080
  1 &gt; pragma: no-cache
  1 &gt; user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36
  
  
  Jan 24, 2014 1:01:31 AM org.glassfish.jersey.filter.LoggingFilter log
  INFO: 1 * Server responded with a response on thread http-bio-8080-exec-3
  1 &lt; 200
  1 &lt; Content-Type: application/json
  </code></pre>
  
  <hr>
  
  <p>Thanks for your answer. looks like i pasted a wrong config above. here is what i have in my web.xml:</p>
  
  <pre><code>  &lt;servlet&gt;
      &lt;servlet-name&gt;jersey-servlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.glassfish.jersey.servlet.ServletContainer&lt;/servlet-class&gt;
      &lt;init-param&gt;
        &lt;param-name&gt;jersey.config.server.provider.packages&lt;/param-name&gt;
        &lt;param-value&gt;com.my.package.web.resources;org.codehaus.jackson.jaxrs&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;jersey.config.server.provider.classnames&lt;/param-name&gt;
          &lt;param-value&gt;org.glassfish.jersey.filter.LoggingFilter&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;jersey.config.server.tracing&lt;/param-name&gt;
          &lt;param-value&gt;ALL&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;jersey-servlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>It logs the headers. but it does not log the entities. here is what i see in my logs:</p>
  
  <pre><code>Jan 28, 2014 2:36:38 PM org.glassfish.jersey.filter.LoggingFilter log
  INFO: 5 * Server has received a request on thread http-bio-8080-exec-10
  5 &gt; GET http://localhost:8080/sample/api/foo
  5 &gt; accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
  5 &gt; accept-encoding: gzip,deflate,sdch
  5 &gt; accept-language: en-US,en;q=0.8
  5 &gt; cache-control: max-age=0
  5 &gt; connection: keep-alive
  5 &gt; cookie: JSESSIONID=1F5CCACA7DF2EABA9475C270A95C91B2
  5 &gt; host: localhost:8080
  5 &gt; user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36
  
  Jan 28, 2014 2:36:38 PM Jan 28, 2014 2:36:38 PM org.glassfish.jersey.filter.LoggingFilter log
  INFO: 5 * Server responded with a response on thread http-bio-8080-exec-10
  5 &lt; 200
  5 &lt; Content-Type: application/json
  </code></pre>
  
  <p>My Jersey application is deployed on Tomcat 7_50 server.</p>
  
  <p>if i have tracing and loggingfilter configured using init-param in my web.xml. do i still need to register it using Recource Config?</p>
  
  <p>public class MyApplication extends ResourceConfig as below: </p>
  
  <pre><code>    public MyApplication() {
          // Register resources and providers using package-scanning.
          packages("my.package");
  
          // Register my custom provider - not needed if it's in my.package.
          register(SecurityRequestFilter.class);
          // Register an instance of LoggingFilter.
          register(new LoggingFilter(LOGGER, true));
  
          // Enable Tracing support.
          property(ServerProperties.TRACING, "ALL");
      }
  }
  </code></pre>