Note that there are some explanatory texts on larger screens.

plurals
  1. POServlet post request logging to Eclipse console
    text
    copied!<p>I'm writing my first Java EE application, using EJBs, Servlet, JSPs and the likes.<br> I'm using JBOSS 4.2 AS and Eclipse as and IDE, including tasks like starting and stopping the server. </p> <p>What I can't understand is that while logging instructions inside a jsp, like:</p> <pre><code>&lt;% System.out.println("Log this!"); %&gt; </code></pre> <p>log as expected, both in Eclipse console and in <code>$SERVER_HOME/server/default/log/server.log</code>, any kind of logging instruction I've tried inside a servlet fails. </p> <p>Here's the code from the jsp that calls the servlet:</p> <pre><code>&lt;form action="MyServlet" method="POST" accept-charset="utf-8"&gt; &lt;input type="text" name="id" value="" id="id"&gt; &lt;input type="submit" value="Go &amp;rarr;"&gt; &lt;/form&gt; </code></pre> <p>And of course the servlet itslef:</p> <pre><code>public class MyServlet extends HttpServlet { private static final long serialVersionUID = 1L; public MyServlet() { super(); System.out.println("Hi, I'm your servlet's constructor"); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.err.println("Hi, this is your servlet on system.err"); System.out.println("Hi, this is your servlet on system.out"); System.out.println(request); ServletContext sc = getServletContext(); sc.log("Hi, this is your servlet on servlet context!"); } } </code></pre> <p>Am I missing something obvious? Doing everything wrong, or just looking in the wrong place?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload