tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Baynes" <kbay...@seagullsw.com>
Subject RE: How to debug servlets under tomcat?
Date Tue, 29 Apr 2003 13:17:17 GMT

Debugging servlets is kind of a pain. Using log statements is probably the
most straightforward way to do it, and is better than printing to System.out
because you can quickly turn it off/on. Go to
http://jakarta.apache.org/log4j/docs/index.html for more info.

Another (even better) option is to separate your business logic from your
servlet. Build your application/classes as though it were stand-alone
running from a command line with a main() method.

Example: if your servlet is taking a path sent from browser, grabbing an XML
file, converting it to HTML and writing it back out to the response... then
write a command-line class that takes a path to an XML file, converts it to
HTML and writes to an OutputStream - and just use FileOutputStream instead
of the Servlet OutputStream. Then you can test that object directly from the
command line, using the JVM's HPROF and using JUNIT. Once it's tested and
working, then plug it into the Servlet.

~akb

| -----Original Message-----
| From: Mark W. Webb [mailto:mark@dolphtech.com]
| Sent: Tuesday, April 29, 2003 9:00 AM
| To: Tomcat Users List
| Subject: Re: How to debug servlets under tomcat?
|
|
| please enlighten us as to what must be done to make things work then :)
|
| Donie Kelly wrote:
|
| >You wish :)
| >
| >-----Original Message-----
| >From: Mark W. Webb [mailto:mark@dolphtech.com]
| >Sent: 29 April 2003 13:46
| >To: Tomcat Users List
| >Subject: Re: How to debug servlets under tomcat?
| >
| >so all I need to do is place a file called log4j.properties in
| >WEB-INF/classes and tomcat is smart enough to see it and know what to do
| >with it?  Wow!  I did not know that .  Cool.
| >
| >Tim Funk wrote:
| >
| >
| >
| >>I don't use a debugger. I use log4j. (Actually commons-logging)
| >>
| >>http://jakarta.apache.org/log4j/docs/manual.html
| >>
| >>Each webapp can be configured with its own log4j settings by dropping
| >>a file called log4j.properties into WEB-INF/classes
| >>
| >>Short term - its a PITA, long term it makes things much easier to fix.
| >>
| >>-Tim
| >>
| >>torechia wrote:
| >>
| >>
| >>
| >>>I am new to Tomcat and java servlets.  I am running latest tomcat
| >>>standalone on windows/xp and am having some problems doing
| >>>transformations from xml to html in my java servlet.   How can I
| >>>debug this?  I would like to step over each line of code and see what
| >>>is happening.   I have a copy of Visual J++, but am not sure how to
| >>>compile and debug  my servlets in this environment since I am not
| >>>running IIS.  Currently I am using ant to build and deploy my
| >>>servlet.    What is the best tool to debug servlets under tomcat and
| >>>how can I get it started in the debugger under tomcat?   Any help
| >>>would be appreciated.
| >>>
| >>>
| >>
| >>---------------------------------------------------------------------
| >>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
| >>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
| >>
| >>
| >
| >
| >
| >
| >---------------------------------------------------------------------
| >To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
| >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
| >
| >
| >**********************************************************************
| >This email and any files transmitted with it are confidential and
| >intended solely for the use of the individual or entity to whom they
| >are addressed. If you have received this email in error please notify
| >the system manager.
| >
| >This footnote also confirms that this email message has been swept by
| >MIMEsweeper for the presence of computer viruses.
| >
| >www.clearswift.com
| >**********************************************************************
| >
| >
| >---------------------------------------------------------------------
| >To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
| >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
| >
| >
|
|
|
|
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
| For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


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


Mime
View raw message