Search This Blog

Wednesday, September 25, 2013

Standard Debug R12 API

API to debug:

fnd_log.STRING(  log_level => '6'
                                 ,module    => 'Project / Task Validate Process'
                                ,message   => 'Source project and Default task not defined.'
                               );

Here Log Level 6 Indicates that we are writing log for ‘UNEXPECTED’ level. We will use the same level for all logs. Module represents that for what interface we are writing logs and message is the log message.

Below profile option should be set at user level for using fnd_log.STRING API. Below are the profile options.
FND: Debug Log Level                                    LEVEL_UNEXPECTED
FND: Debug Log Enabled                              Yes
FND: Debug Log Module                               % or Module Name (e.g. GESSS Project / Task Validate Process)

If above profile options are set for the user, while running concurrent program from that user it will write log in FND_LOG_MESSAGES table.  If module is ‘%’ then it will write log for every concurrent program where we have used the API. If we set it to Module Level then it will write log only for that module e.g. if FND: Debug Log Module  is set to ‘Project / Task Validate Process' then it will write log for that concurrent program only.

To test it from Backend, make sure to manually initialize the PL/SQL layer logging for the current session using FND_GLOBAL.APPS_INITIALIZE.

Below is the sample code:

BEGIN
FND_GLOBAL.APPS_INITIALIZE(13831,20420,0);
fnd_log.STRING(  log_level => '6'
                                 ,module    => 'TEST'
                                ,message   => 'Source project and Default task not defined.'
                               );
END;

SELECT * FROM FND_LOG_MESSAGES
WHERE MODULE = 'TEST'