• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

System.out.println

 
Mathew Philip
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys,
I got a simple doubt on what to do with the System.out.println statements.....I don't to keep any more println becos it affects performance in the production server....If I remove those println , I have to put the same println for maintanence and testing...Is there any way , i can handle this situation in a better way...
thanks in advance
mathew
 
Matt Senecal
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Something I've done in the past is to create a global variable (usually boolean)indicating whether or not the program is being run in test mode. You can then enclose all the pertinent println statements with something like:

You have to alter the program so that you can feed a startup parameter that indicates if it's being run in test mode. If the program is run in test mode, the println's work, if not, they don't.
Originally posted by Mathew Philip:
hi guys,
I got a simple doubt on what to do with the System.out.println statements.....I don't to keep any more println becos it affects performance in the production server....If I remove those println , I have to put the same println for maintanence and testing...Is there any way , i can handle this situation in a better way...
thanks in advance
mathew

 
Mathew Philip
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Matt Senecal,
we are also doing the same kind of stuff like a class having a method for print....based on the flag the method prints.....Before deplyment we can change the flag to No.But still we cannot avoid that method call....In an e-commerce site everybody wanted performance to the maximum level....I think that method call will affects performance....I think i have to sit and remove all the println statements after proper testing....
thanks
mathew
 
neal_p
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
instead of having a if statement everytime, u can use LOG4J api to print the debug statement. You can turn the debug statements off just by setting a simple properties. You can do so much more with log4j api then just print statements on the screen. And best of all, lob4j is free. I just tried log4j, and its works preety well and it is also simple and easy to learn.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic