2014. november 19., szerda

Oracle - Trace, FND Debug Log, FND Diagnostics

I. Trace

Type 1
1. Set Initialization SQL Statement - Custom Profile Option at User level:
BEGIN
fnd_ctl.fnd_sess_ctl(
'',''
,'TRUE','TRUE','LOG'
, 'ALTER SESSION SET TRACEFILE_IDENTIFIER=''TEST'' EVENTS=''10046 TRACE NAME CONTEXT FOREVER, LEVEL 12''' ); 
END;
2. Find the trace file(s)
3. Use tkprof <input_file_name>.trc <output_file_name>.prf in $ORACLE_HOME folder and enjoy the readable output :-)

Advantage: more detailed trace file.
Disadvantage: the user has to sign out before the Profile Option setting and then sign in again.

Type 2
1. Set Utilities:Diagnostics Profile Option to Yes at User Level.
2. Go to Help > Diagnostics > Trace and select Trace with Binds and Waits

3. A note appears where you will find your trace file.

Advantage: the user doesn't have to sign out, the settings have effect immediately.
Disadvantage: less detailed trace file.

II. FND Debug Log
1. Set the following Profile Options at User level:
1.1. Set FND: Debug Log Enabled to Yes
1.2. Set FND: Debug Log Level to 1 if you would like to use it in code as C_LEVEL_STATEMENT or
1.3. Set FND: Debug Log Level to Statement
1.4. Set FND: Debug Log Module to %

2. Query log_sequence -> &1st_value
select max(log_sequence)
from fnd_log_messages;

3. Do what you would like to debug.
4. Query log_sequence again -> &2nd_value
5. Query your debug log:
SELECT substr(module,1,70), MESSAGE_TEXT, timestamp, log_sequence
from fnd_log_messages
where log_sequence between &1st_value AND &2nd_value
ORDER BY log_sequence;

6. Set the Profile Options back to the original values.

III. FND Diagnostics
1. Set FND: Diagnostics Profile Option to Yes at User level.
2. Click "Diagnostics" tool menu.
3. Select "Show Log on screen" in Diagnostic field and "Statement" in Log Level field and click "Go" button.

4. Do about what you would like to have the log. The log will be displayed at the bottom of the screen.
5. Turn off logging: click "Diagnostics" tool menu, select "Show Log on screen" in Diagnostic field and "Turn off screen logging" in Log Level field and click "Go" button.
6. Set FND: Diagnostics Profile Option to No at User level.