Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
103 views
by Contributing Tester (40 points)
retagged by
system.out.print show us in console what I need, but why is not a good practies

1 Answer

0 like 0 dislike
by The go-to Tester (181 points)
selected by
 
Best answer

Imagin you are writing 1000s of system.out.print or system.out.println to write on the console. Now once your final product is ready to go to production, you may want to remove system.out.print as system.out.print will slow down your program a little bit as it has to print on console.

You will have to go back to your code, find out all system.out.prints and comment those or remove those. Instead if you use log4j or any other customized logging tool, you can control the switch just by using log4j.properties file. Also, it will write text file for you. So in future if you happen to catch critiacal exception on production server, you can write it to the file and debug your code.

Once your product is ready for the release, you can simply turn off loggin on console from the log4j.properties file and you are ready to go.

Hope that answers your question!


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

...