title: REST JAX-RS Logging
body: <p>I have followed the <a href="http://www.mkyong.com/webservices/jax-rs/jersey-hello-world-example/" rel="nofollow">HelloWorld</a> example and got my fist REST done successfully.  Now, I would like to add the logging capability the code.  For example, I would like to have any logging frameworks (Log4j, JUL) and be able to log in the code, and have output to a file.  How do I implement the logging to my REST code?</p>
  
  <pre><code>@Path("/hello")
  public class HelloWorldService {
      Logger log = Logger.getLogger("className");
  
      @GET
      @Path("/{param}")
      public Response getMsg(@PathParam("param") String msg) {
  
          String output = "Jersey say : " + msg;
  
          //for example, here.  hopefully to a file  
          log.info("Log Jersey say : " + msg);
  
          return Response.status(200).entity(output).build();
  
      }
  }
  </code></pre>
  
  <p>I am using Jersey 1.19, Tomcat 8</p>