DBA Data[Home] [Help]

PACKAGE: APPS.PA_DEBUG

Source


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