ohseekay
ohseekay

Reputation: 805

How to get System.out.println in servlet to show on console?

I am running a simple servlet on Tomcat 7.0 in Windows.

For the sake of debugging I want to

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // do some stuff
    System.out.println("Some stuff was done");
    ...

    PrintWriter out = response.getWriter();
    out.println("Done");
}

However, I do not see my System.out.println output in either the console or any of the log files in the logs folder, be it catalina.log or catalina.out. I have searched this many times, but none of the methods I read work.

All I need is for my output to show up on the console without having to use other utilities, so I'd really appreciate it if someone can show me the steps on how to fix it.

Upvotes: 3

Views: 6170

Answers (1)

Deepak
Deepak

Reputation: 327

For the sake of debugging, use some log framework like log4j.

However, system.out logs will be in catalina.out or one of the localhost*.log files in your Tomcat's logs directory

Is there a specific reason you're not using a logging framework or the standard Java logging? It's quite a bit more useful, and configurable.

Upvotes: 2

Related Questions