How can I write to a log file from a servlet?

Alex Chaffee

Look for the method ServletContext.log(String) or GenericServlet.log(String). These will write to a servlet log file maintained by your servlet container.

E.g.:

  log("Servlet called with name " + request.getParameter("name"));

If this is insufficient, you can use java.io classes to write your own files.

See also:
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact