• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Standard Out - Debugging

 
Aryeh Golob
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64717
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Commons Logging will let you hook up to either Java logging or Log4J.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic