You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Simon Taylor <se...@nortelnetworks.com> on 2003/11/22 19:26:24 UTC

Tomcat and Servlet Debugging

I am new to Java and Tomcat having just inherited the admin of some servlets
from someone who has left the company.
I have a servlet that isn't doing what I expect.
It is littered with lines of the following type:-

writeError("Session was not created by superclass");

Which refers to :-

protected void writeDebug(Object msg)
  {
    if (debug==1) {
      Date date = new Date();
      System.err.println("[" + date.toString() + "] [debug] [" +
                         this.getClass().getName() + "] " + msg.toString());
      debugMsg = debugMsg
        + "<TR><TD BGCOLOR='#CCCCCC'>"
        + msg.toString() + "</TD></TR>\n";
    }
    return;
  }

This is throwing an error but I get no error in any of the Tomcat logs even
though I have a Context Logger set up to debug.
I have manually set debug = 1 at the top of the script recompiled and
redeployed and still no debug messages.
Where would these end up.

Reading around it looks like a better approach would be to use Log4J to
debug the servlet. I'd rather not do that if I can get away with a quick fix
using the existing code.
Comments pls.

Simon


Simon Taylor
Managed Services Technology Consultant
Nortel Networks
p -  01279 404289 (ESN 742 4289)
m - 07740 533743 (ESN 748 3743)
e -  set@nortelnetworks.com

"I code therefore I am"


Re: Tomcat and Servlet Debugging

Posted by Ben Souther <bs...@fwdco.com>.
> System.err.println("[" + date.toString() + "] [debug] [" +
That lines tells you that it's being printed out to Standard Error.

Which OS are you running on?

On Unix, both standard out and standard err get printed to 
TOMCAT_HOME/logs/catalina.out

On windows, I believe both go to the command console.
Try running tomcat by CDing to TOMCAT_HOME/bin and typing: catalina 
on the command line.  You should see another DOS window appear which will show 
any of those messages as they come up.






On Saturday 22 November 2003 01:26 pm, Simon Taylor wrote:
>  System.err.println("[" + date.toString() + "] [debug] [" +

-- 
Ben Souther
F.W. Davison & Company, Inc.



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org