Showing posts with label LOGGING. Show all posts
Showing posts with label LOGGING. Show all posts

Sunday, 26 April 2015

Logging in Custom OAF Pages

Logging in Custom OAF Pages

We have often felt for years simple SOP (System.out.Println) is the best way of debugging in java/j2ee applications. I have the evil habit.. of putting lots of SOPs while writing code for OAF or ADF or simple j2ee applications. I generally create a method with sop in it eg:

private void putLogMsg(Object o)
{
System.out.println(o);
}


and call it with the code wherever required. The benefit is at the point of deployment of code, i just need to change this method from sop to writeDiagnostics().

private void putLogMsg(Object o)
{
pageContext.writeDiagnostics(this,o,OAFwkConstants.STATEMENT);
}


We should try not to put any SOPs in the deployed OAF/ADF code as it is can impact the performance.