I'm writing my first JEE application, using EJBs, Servlet, JSPs and the likes.
I'm using JBOSS 4.2 AS and Eclipse as and IDE, including tasks like starting and stopping the server.
What I can't understand is that while logging instructions inside a jsp, like:
<% System.out.println("Log this!"); %>
log as expected, both in Eclipse console and in $SERVER_HOME/server/default/log/server.log
, any kind of logging instruction I've tried inside a servlet fails.
Here's the code from the jsp that calls the servlet:
<form action="MyServlet" method="POST" accept-charset="utf-8">
<input type="text" name="id" value="" id="id">
<input type="submit" value="Go →">
</form>
And of course the servlet itslef:
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!");
}
}
Am I missing something obvious? Doing everything wrong, or just looking in the wrong place?