DBA Data[Home] [Help]

PACKAGE: APPS.PN_DEBUG

Source


1 PACKAGE PN_DEBUG AUTHID CURRENT_USER AS
2 /* $Header: PNDEBUKS.pls 120.2 2011/01/28 10:26:28 kmaddi noship $ */
3    -- Standard who
4    x_last_updated_by         NUMBER(15) := FND_GLOBAL.USER_ID;
5    x_last_update_date        NUMBER(15) := FND_GLOBAL.USER_ID;
6    x_created_by              NUMBER(15) := FND_GLOBAL.USER_ID;
7    x_last_update_login       NUMBER(15) := FND_GLOBAL.LOGIN_ID;
8    x_request_id              NUMBER(15) := FND_GLOBAL.CONC_REQUEST_ID;
9    x_program_application_id  NUMBER(15) := FND_GLOBAL.PROG_APPL_ID;
10    x_program_id              NUMBER(15) := FND_GLOBAL.CONC_PROGRAM_ID;
11 
12    -- Debug Levels
13 
14    DEBUG_LEVEL_EXCEPTION CONSTANT NUMBER := -1;    -- This debug level will be used for very important message reporting
15    DEBUG_LEVEL_NONE      CONSTANT NUMBER :=  0;
16    DEBUG_LEVEL_BASIC     CONSTANT NUMBER :=  1;
17    DEBUG_LEVEL_TIMING    CONSTANT NUMBER :=  2;
18    G_CURRENT_RUNTIME_LEVEL   CONSTANT NUMBER := 6;
19 
20    TYPE char255tabtype IS TABLE OF VARCHAR2(255) INDEX BY BINARY_INTEGER;
21 
22    -- Public variables for this package
23 
24    debug_flag               BOOLEAN := FALSE;
25    debug_level               NUMBER  := DEBUG_LEVEL_NONE;
26    number_of_debug_messages  BINARY_INTEGER := 0;
27 
28    debug_message             char255tabtype;
29 
30    G_Path                    Varchar2(240);
31    G_Stage                   Varchar2(240);
32 
33 -- -------------------------------------------
34 
35 
36     G_TimeOut    Number  := 0;
37     G_CommitMode    Boolean := FALSE;
38     G_LockMode    Number  := 6;
39 
40    -- Modified G_process default from PLSQL to IGNORE
41    -- so that forms that call Write_File with out calling
42    -- set_process do not have to be modified to call set_process
43    -- There are large number of forms that call API's that are using
44    -- Write_File, We felt it was better to change the PN_DEBUG API
45    -- instead of changing all the forms. (changes made by Pkoganti
46    -- after consulting Taheri and Selva).
47 
48     G_Process    Varchar2(10) := 'IGNORE';
49     G_WriteFile    Varchar2(10) := 'LOG';
50     G_WriteFileID    Number         := FND_FILE.LOG;
51 
52        TYPE char80tabtype IS TABLE OF VARCHAR2(80) INDEX BY BINARY_INTEGER;
53 
54     G_Err_Stack    Varchar2(2000);
55     G_Err_Stack_Tbl    char80tabtype;
56     G_Err_Ind    Binary_Integer := 0;
57     G_Err_Stage    Varchar2(650);
58     G_Err_Code    Number;
59 
60 -- -------------------------------------------
61 
62     -- The subroutines require the following globals:
63 
64     -- 1. G_Function_Stack holds the name of the called functions in a stack format.
65     -- 2. G_Counter is used to mark the current location in the function stack.
66     -- 3. G_Space is used to provide indentation in the stack of function calls
67 
68        G_Function_Stack               PN_PLSQL_DATATYPES.Char50TabTyp;
69        G_Function_Counter             NUMBER := 0;
70        G_Space                        VARCHAR2(4000);
71 
72 -- -------------------------------------------
73 
74    PROCEDURE initialize;
75    PROCEDURE enable_debug;
76    PROCEDURE enable_debug (x_debug_level IN NUMBER);
77    PROCEDURE disable_debug;
78    PROCEDURE set_debug_level (x_debug_level IN NUMBER);
79    PROCEDURE debug (x_debug_message IN VARCHAR2);
80    PROCEDURE debug (x_debug_message IN VARCHAR2, x_debug_level IN NUMBER);
81    PROCEDURE get_message(x_message_number IN NUMBER,
82              x_debug_message OUT NOCOPY VARCHAR2);
83    FUNCTION no_of_debug_messages RETURN NUMBER;
84 
85 
86 -- -------------------------------------------
87 
88    /* Set_User_Lock_Mode :
89     x_Lock_Mode    Lock modes as defined in APPs dev guide.
90             6 - Exclusive.
91     x_Commit_Mode    Rls lock on Commit
92             FALSE - Do not rls on commit
93     x_TimeOut    Seconds before timeout.
94 */
95     PROCEDURE Set_User_Lock_Mode
96             (     x_Lock_Mode    IN    NUMBER  DEFAULT 6,
97                 x_Commit_Mode    IN    BOOLEAN DEFAULT FALSE,
98                 x_TimeOut    IN    NUMBER  DEFAULT 0 );
99 
100     Function Acquire_User_Lock
101             (    x_Lock_Name    IN    VARCHAR2,
102                 x_Lock_Mode    IN    NUMBER,
103                 x_Commit_Mode    IN    BOOLEAN,
104                 x_TimeOut    IN    NUMBER )
105             Return NUMBER;
106 
107     Function Acquire_User_Lock
108             (    x_Lock_Name    IN    VARCHAR2 )
109             Return NUMBER;
110 
111     Function Release_User_Lock (    x_Lock_Name    IN    VARCHAR2 )
112             Return NUMBER;
113 
114 /* Set_Process :
115     x_Process    Type of Process
116             'PLSQL' - PLSQL conc process to use FND_FILE APIs
117             'SQL'    - SQL execution to use dbms_output APIs
118             'REPORT'- Oracle Report execution to use PN_DEBUG buffer
119     x_Write_File    File to write to for PLSQL process only.
120             'LOG'     - Log file
121             'OUT'    - Out file
122     x_Debug_Mode    Set the debug mode for the session
123             'Y'    - Set G_DebugMode Y
124             'N'    - Set G_DebugMode N
125 
126 */
127     Procedure Set_Process (    x_Process    IN    VARCHAR2,
128                 x_Write_File    IN    VARCHAR2 DEFAULT 'LOG',
129                 x_Debug_Mode    IN    VARCHAR2 DEFAULT 'N' );
130 /* Write_File :
131     x_Write_File    File to write to for PLSQL process only, as above
132     x_Msg        String to write.
133     x_Write_Mode    Mandatory write or use debug flag
134             0     - Use G_DebugMode to write.
135             1    - Mandatory write.
136 */
137 
138     Procedure Write_File (    x_Write_File    IN    VARCHAR2,
139                 x_Msg        IN    VARCHAR2,
140                 x_Write_Mode    IN    NUMBER     DEFAULT 0);
141 
142     Procedure Write_File (    x_Msg         IN    VARCHAR2,
143                 x_Write_Mode    IN    NUMBER     DEFAULT 0) ;
144 
145     Procedure Init_Err_Stack (    x_Stack    IN    VARCHAR2 );
146 
147     Procedure Set_Err_Stack (    x_Stack    IN    VARCHAR2 );
148 
149     Procedure Reset_Err_Stack;
150 
151     PROCEDURE raise_error(     x_Msg_Num    IN NUMBER,
152                                   x_Msg        IN VARCHAR2 ,
153                                   x_TokenName1 IN VARCHAR2 ,
154                               x_Token1     IN VARCHAR2 ,
155                               x_TokenName2 IN VARCHAR2 ,
156                               x_Token2     IN VARCHAR2 ,
157                               x_TokenName3 IN VARCHAR2 ,
158                               x_Token3     IN VARCHAR2 );
159 
160     PROCEDURE raise_error(     x_Msg_Num    IN NUMBER,
161                                   x_Msg        IN VARCHAR2 ,
162                                   x_TokenName1 IN VARCHAR2 ,
163                               x_Token1     IN VARCHAR2 ,
164                               x_TokenName2 IN VARCHAR2 ,
165                               x_Token2     IN VARCHAR2 );
166 
167     PROCEDURE raise_error(     x_Msg_Num    IN NUMBER,
168                                   x_Msg        IN VARCHAR2,
169                                   x_TokenName1 IN VARCHAR2,
170                               x_Token1     IN VARCHAR2 );
171 
172     PROCEDURE raise_error(     x_Msg_Num    IN NUMBER,
173                                   x_Msg        IN VARCHAR2 );
174 
175 -- -------------------------------------------
176 
177     -- Procedure log_message
178        -- Displays a message using the current function set by the
179        -- procedure set_curr_function
180        -- in addition to that, it sends the write mode
181        -- write mode: 0 print in debug mode
182        --             1 print always
183        -- p_msg_options provides formatting options.
184        -- p_write_file values: LOG, OUT.
185 
186 
187        PROCEDURE log_message(p_message IN VARCHAR2
188                             , p_write_mode  IN NUMBER     DEFAULT 0
189                             , p_msg_options IN VARCHAR2   DEFAULT 'PLAIN'
190                             , p_write_file  IN VARCHAR2   DEFAULT 'LOG'
191                              );
192 
193     -- Procedure set_curr_function
194        -- Sets the current function name passed in and sets the process and stack
195        -- information as well.
196        --
197        -- ALWAYS call this at the beginning of each procedure.
198 
199        PROCEDURE set_curr_function(p_function      IN   VARCHAR2
200                                    , p_process       IN    VARCHAR2 DEFAULT 'PLSQL'
201                    , p_write_file  IN    VARCHAR2 DEFAULT 'LOG'
202                    , p_debug_mode  IN    VARCHAR2 DEFAULT 'N'
203                                    );
204 
205     -- Procedure reset_curr_function
206        -- Resets the current function name and also resets the stack
207        -- information.
208        --
209        -- ALWAYS call this at the end of each procedure.
210 
211        PROCEDURE reset_curr_function;
212 
213 -- -------------------------------------------
214 -- This procedure is deprecated. Please use PN_DEBUG.WRITE.
215 -- Ewee : Procedure for handling logging messages to FND_LOG_MESSAGES table
216 -- Write_Log :
217 --    x_Module    Module which writes message to FND_LOG_MESSAGES
218 --    x_Msg        String to write
219 --    x_Log_Level    Scope of log message
220 
221     Procedure Write_Log (    x_Module    IN    VARCHAR2,
222                 x_Msg        IN    VARCHAR2,
223                 x_Log_Level    IN    NUMBER DEFAULT 6);
224 
225 -- -------------------------------------------
226 -- x_module: ex. pa.plsql.pa_timeline_pvt
227 -- x_msg: Message
228 -- x_Log_Level: 6 - Unexpected Errors
229 --              5 - Expected Errors
230 --              4 - Exception
231 --              3 - Event (High Level Logging Message)
232 --              2 - Procedure (Entry / Exit from a routine)
233 --              1 - Statement - (Low Level Logging Message)
234 --
235 Procedure WRITE (
236       x_Module    IN    VARCHAR2,
237             x_Msg        IN    VARCHAR2,
238             x_Log_Level    IN    NUMBER DEFAULT 1 );
239 
240 -- =======================================================================
241 -- Start of Comments
242 -- API Name      : TrackPath
243 -- Type          : Private
244 -- Pre-Reqs      : None
245 -- Type          : Procedure
246 -- Function      : This procedure tracks the path thru the code to attach to error messages.
247 --
248 --  Parameters:
249 --
250 --  IN
251 --    P_Function     -  VARCHAR2(10) -- ADD or STRIP
252 --    P_Value        -  VARCHAR2(100)
253 --
254 /*-------------------------------------------------------------------------*/
255 
256 Procedure TrackPath (
257         P_Function IN VARCHAR2,
258         P_Value    IN VARCHAR2);
259 
260 END PN_DEBUG;