Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Alternate to System.out.println

 
kapil patel
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I wanted to print message on System console from JSP page. I would not like to use System.out.println() as it is deprecated and also someone told me that it is not efficient and resume response time if we use very frequently.

I tried to search on internet without success. Your suggestion or guidance would be much appreciated.

Thanks,
Kapil Patel
 
Mukesh Mittal
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use Log4j.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64978
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by kapil patel:
I would not like to use System.out.println() as it is deprecated


Is not.

What is informally deprecated is the use of scriplets in a JSP page. If you are writing to modern standards, your page should have nothing to log.

That said, Log4J is a much perferable alternative to logging than System.out.println(), even if the latter is not deprecated.
 
Sanjeev Singh
Ranch Hand
Posts: 381
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
kapil,
FYI... Log4j can be used with JSP also not by using scriptlets but by using taglibs.Jakarta has developed a taglibs for logging in JSP.
http://jakarta.apache.org/taglibs/doc/log-doc/log-1.0/index.html
 
kapil patel
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you all.

Is there any alternative to log4j in case if our project people reluctant to add logging facility.
 
Mukesh Mittal
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use application.log() in jsp file.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64978
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by kapil patel:
Is there any alternative to log4j in case if our project people reluctant to add logging facility.


Your question doesn't make much sense to me.

Either you want logging, or you don't. Which is it? Any alternative to Log4J is still logging.

If you'd rather not tie your project to a single logging system, you can do what I do and use Jakarta Commons Logging which can be used with either Log4J or java's built-in java.util.logging facility (or even a home-grown logging package).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic