| 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
|
posted

0
|
|
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
|
posted

0
|
|
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: 56187
|
|
|
Commons Logging will let you hook up to either Java logging or Log4J.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12617
|
posted

0
|
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.
|
 |
 |
|
|
subject: Standard Out - Debugging
|
|
|