Search Results


Thursday, April 02, 2009

System.out.println

System.out.println


This is the most commonly asked question in web applications development in jdeveloper including OA Framework, ADF, ejb, web services etc.


Can I leave System.out.println or System.err.println in the production code?

System.out.println comes handy when debugging the application because you can see the messages pretty much easily in the jdeveloper console. And it takes relatively less time than the debugging option in Jdeveloper. So even experienced developers use it for debugging. You may think, "Anyway this doesnot any affect in the production system". But actually System.out.println statements will have serious performance issue in the production system if you fail to remove them in the final code.

The reason is that the application server will have only one output stream and one error stream in the JVM. Hence multiple threads calling the System.out.println() have to be synchronized.

Considering the production system with thousands of users, back end programs, webservices, scheduled process running parralley in the machine. Calling system.out.println() will potentially block the performance of whole system.

Also the application server doesn't redirect the std out to a file, and is lost.



Hence always remove the System.out.println() /System.err.println() from the production code.


Article By:
Prasanna Jayaraman

Please post your Ideas and Comments

2 comments :

Praveen Reddy B said...

Hi Prasanna,
I am new to OAFramework, i want to have a new page in iRecievables, for that what are the basic steps to do, i.e. shall i need to import all the folders from server to local JDEV or can i work on server directly? if have to download all the folders from server then what are the minimum needed folders? and where to set them in JDev?

Please help me in this regard. your help is greatly appreciated.

Thanks
Praveen Reddy

Pras said...

If you want to create a new page, you don't have to download anythng from the server.


You can create a new page in your jdeveloper and deploy it to the server.

If you new to oaf then read http://prasanna-adf.blogspot.com/2008/11/new-to-oaf.html article..


You have to do 5 basic exercises to familiarize yourself with OAF...


If you have any doubts post it in my blog or OAF forum


--Prasanna