aspose file tools*
The moose likes Servlets and the fly likes Standard Out - Debugging Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Standard Out - Debugging" Watch "Standard Out - Debugging" New topic
Author

Standard Out - Debugging

Aryeh Golob
Ranch Hand

Joined: Nov 12, 2006
Posts: 37
I have been developing Java apps for quite some time now and am used to printing my debugging info to standard out.

ex:
prompt$>ant
app running
debug info ....
debug info ....
debug info ....
debug info ....


Can anyone share with me how they print debug info for Servlets during the development process?

I was thinking of maybe creating a debug servlet and use static methods to print my debug info.

ex:



Anything you can share is greatly appreciated ...

Thanks,
Aryeh


David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

How about using a logger, like most people do? Using System.out.println as a logger is almost always a bad idea.
Aryeh Golob
Ranch Hand

Joined: Nov 12, 2006
Posts: 37
Hi David and thanks for the reply!

Do you recommend using a 3rd party logger or just creating my own?

Thanks!
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Why would you create your own when several time-tested alternatives already exist? Is there something specific you need to do that they don't?
Aryeh Golob
Ranch Hand

Joined: Nov 12, 2006
Posts: 37
Hi David,

Can you give me some recommendations.

Should I use the Java Logger class or maybe log4j?

Thanks ...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60053
    
  65

Commons Logging will let you hook up to either Java logging or Log4J.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Note that commons logging (and to a lesser extent Log4J) can bring up subtle trickiness under some classloading situations.

See this explanation for details, and this more cursory examination. Some of these issues may be fixed, but these kinds of things can be irritating if you're not aware of them.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Standard Out - Debugging
 
Similar Threads
Overhead IO : The cryptic case of the extra bytes
reading a private method within a class
Test the request sent? (maybe using a mock servlet somehow?)
How to retrieve data from database every 10 minutes?
Accessing HTTPS URL through SSL - fails with UnknownHostException