16 April, 2019

How to find logging/tracing/debugging in Oracle Apps 11i/R12?

1) Via script looking into profiles

--Query-1:

set linesize  100
set pagesize 999
column today new_value _date noprint
select to_char(SYSDATE,'DD-MON-RR') today from dual;
ttitle CENTER 'Debug and Trace Profile Options Set to YES'  -
RIGHT _date ' Page:' FORMAT 999 sql.pno SKIP 2 -
Column app_short format a6 heading "APP"
column optname format a35 heading "PROFILE"
column d_level format a36 heading "WHO HAS IT SET"
column optval format a6 heading "SET TO"
column updated format a10 heading "UPDATED ON"
select  distinct
        a.application_short_name app_short,
        user_profile_option_name optname,
        decode(level_id,
        10001,'SITE',
        10002,'APP : '||a2.application_short_name,
        10003,'RESP: '||r.responsibility_key,
        10004,'USER: '||u.user_name,
        'Unknown') d_level,
        profile_option_value optval,
        v.last_update_date updated
from fnd_profile_options_vl o,
        fnd_profile_option_values v,
        fnd_application a,
        fnd_application a2,
        fnd_responsibility r,
        fnd_user u
where (
        upper(o.user_profile_option_name) like '%DEBUG%' or
        upper(o.user_profile_option_name) like '%TRACE%'
--or upper(o.user_profile_option_name) like '%LOGG%'
        )
and a.application_id = v.application_id
and o.application_id = v.application_id
and o.profile_option_id = v.profile_option_id
-- Find the associate level for profile
and r.application_id (+) = v.level_value_application_id
and r.responsibility_id (+) = v.level_value
and a2.application_id (+) = v.level_value
and u.user_id (+) = v.level_value
and profile_option_value = 'Y'
order by 2,1,3,4;


Sample output
=============
                             Debug and Trace Profile Options Set to YES          15-MAY-12 Page:   1

Columnapp_shortheadingAPP
APP_SHORT                                          PROFILE
-------------------------------------------------- -----------------------------------
WHO HAS IT SET                       SET TO UPDATED ON
------------------------------------ ------ ----------
FND                                                Concurrent: Allow Debugging
USER: LSHER                       Y      08-DEC-10

FND                                                Concurrent: Allow Debugging
USER: RAYYG                      Y      27-FEB-12

FND                                                Concurrent: Allow Debugging
USER: RSRIN                    Y      12-JAN-09


So I got the users and profile names which caused logging.

--Query-2:

This query lists the concurrent program which has tracing on. Finding out this information and unsetting redundant tracing improves 11i EBusiness Suite performance.

SELECT concurrent_program_name prog_name
     , enable_trace
     , last_update_date
FROM apps.fnd_concurrent_programs fcp
WHERE NVL(enable_trace,'N') = 'Y' 
/

Sample output:
==============
                            Debug and Trace Profile Options Set to YES          15-MAY-12 Page:   1

Columnapp_shortheadingAPP
PROG_NAME                      E LAST_UPDA
------------------------------ - ---------
VTKSMXXX                       Y 07-MAR-12
MSCXXXXX                       Y 05-OCT-10
FNDWXXXX                       Y 30-MAR-06


2) Using back end DBA_SOURCE to find log information.

I cat/vi the log and found the following text
"Internal logging is enabled" (without double quotes)

see below a sample from logfile,

--------------------------------------------------------------------------
Maximum Stack Size=200000
Each Log File Open Mode=a
Default Log File Prefix=jai_cmn_debug_contexts
Default Log File Suffix=.log
Internal Exception Propagation=N
Context Cache Size (max)=20
Internal Debug Logging=Y
Context Printing=Y
--------------------------------------------------------------------------
NOTE: Internal logging is enabled.  Lines marked with "(#)" are internal log messages.  To disable internal logging
                    set private variable jai_cmn_debug_contexts_pkg.lv_debug='N'
(#):End -> INIT
(#):ln_user_id=1001636
(#):pv_context=TRIGGER.WSH.AFTER.JA_IN_WSH_DLRY_DTLS_AU_TRG
(#):r_temp_rec.log_context=
(#):After Fetch : r_temp_rec.log_context=
(#):Context=TRIGGER.WSH.AFTER.JA_IN_WSH_DLRY_DTLS_AU_TRG not registered
(#):pn_reg_id=0
(#):Begin -> PRINT
(#):pn_reg_id  =0



I searched the selected text in all types of code objects the same in database DBA_SOURCE which covers packages, package bodies, triggers etc

SQL> select owner,name,type  from dba_source where text like '%Internal logging is enabled%';


OWNER                          NAME                           TYPE
------------------------------ ------------------------------ ------------
APPS                           JAI_CMN_DEBUG_CONTEXTS_PKG     PACKAGE BODY

Useful Scripts

To Find session details using SID. set verify off col sid format 99999 col machine format a10 col program format a25 trunc col username form...