Tuesday, July 28, 2009

Logging in the OAF

logging in the OAF

You can log your message in OAF page using writeDiagnostics method

pageContext.writeDiagnostics(this,"building :"+s_building,OAFwkConstants.STATEMENT);
Syntax:void writeDiagnostics(Object module,String messageText,int logLevel)

Writes an entry to the diagnostics log according to a specific log level.

Parameters:module - current module, usually the "this" pointermessageText - message to be included in the log. Limit 4000 characters.logLevel - category or type of log message. Valid values are are from OAFwkConstants. (UNEXPECTED, ERROR, EXCEPTION, EVENT, PROCEDURE, STATEMENT, PERFORMANCE

To log bc4j objects in OAF
Pagecontext will not be available for AM, View Object Impl and Entity object Impl. So in this case, you can use OADBTransactionImpl.writeDiagnostics to log your messages.

oracle.apps.fnd.framework.server.OADBTransactionImpl

if (OADBTranasctionImpl.isLoggingEnabled(OAFwkConstants.PROCEDURE))OADBTransactionImpl.writeDiagnostics(this, "your message", OAFwkConstants.PROCEDURE);

Now you will be able to see the application log appened to the bottom of the page.

Then set profile option "FND: Debug Log Level" (at user-level).

Finally query FND_LOG_MESSAGES in the database for all the debugging messages:

SELECT module, message_textFROM fnd_log_messagesWHERE user_id = AND timestamp > SYSDATE - (1/24/60) -- in the past minute; this cuts down the number of recordsORDER BY timestamp;

How to see the log?

You can see the output in the OAF Screen itself.
1. Select Diagnostics button from any page
2. In the Diagnostics page select Show Log on Screen option

No comments: