title: How do I get Jersey 2.2 (JAX-RS) to generate log output, including Json request bodies
body: <p>I'm running a Jersey 2.2 Servlet inside Jetty 9.0.4 in order to serve REST requests. </p>
  
  <p>Mostly everything is good and requests get served, but I have never seen <strong>ANY</strong> log from Jersey classes. And I can't find any doco indicating what chickens I need to sacrifice to make that happen with Jersey 2.2</p>
  
  <p>So my first question is - what do I need to do to get Jersey to generate some log.</p>
  
  <p>When a request does run awry (eg because the Json request body can't be parsed) Jersey will throw a ContainerException with message like "Can not deserialize instance of java.util.ArrayList out of START_OBJECT token" etc. At that point it would be <strong>really</strong> lovely to have logged the incoming request body so I can inspect the Json. Again I can't find anything in the current doco outlining such a beast although I'm sure there is one. And in any case until I solve question 1 up above it's moot.</p>
  
  <p>So my 2nd question is how do I log the incoming request body (without disrupting the request).</p>
  
  <p>The Jersey Servlet config in web.xml looks like:</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;javax.ws.rs.Application&lt;/param-name&gt;
          &lt;param-value&gt;au.com.xandar.wirelesstiming.recorder.web.rest.JerseyApplication&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;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  </code></pre>
  
  <p>My JerseyApplication is:</p>
  
  <pre><code>public final class JerseyApplication extends ResourceConfig {
  
      public JerseyApplication() {
          super(
              //JacksonFeature.class   // Switching on Jackson
              // (My) JerseyLoggingFilter.class       // Log requests using Jersey ContainerRequestFilter 
              MyApplicationEventListener.class        // Log Requests using Jersey RequestEventListener
          );
          packages("au.com.xandar.wirelesstiming.recorder");
  
          // Enable LoggingFilter &amp; output entity.
          // NB This does NOT generate any log.
          registerInstances(new LoggingFilter(Logger.getLogger(JerseyApplication.class.getName()), true));
      }
  }
  </code></pre>