DBA Data[Home] [Help]

PACKAGE: APPS.EAM_DEBUG

Source


1 PACKAGE eam_debug AUTHID CURRENT_USER AS
2 /* $Header: EAMDBGJS.pls 115.4 2002/11/18 18:17:23 aan 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 -- -------------------------------------------
31 
32    /* Tsaifee : Modifications for handling processes, user locks, etc. */
33 
34 	G_TimeOut	Number  := 0;
35 	G_CommitMode	Boolean := FALSE;
36 	G_LockMode	Number  := 6;
37 
38    -- Modified G_process default from PLSQL to IGNORE
39    -- so that forms that call Write_File with out calling
40    -- set_process do not have to be modified to call set_process
41    -- There are large number of forms that call API's that are using
42    -- Write_File, We felt it was better to change the PA_DEBUG API
43    -- instead of changing all the forms. (changes made by Pkoganti
44    -- after consulting Taheri and Selva).
45 
46 	G_Process	Varchar2(10) := 'IGNORE';
47 	G_WriteFile	Varchar2(10) := 'LOG';
48 	G_WriteFileID	Number	     := FND_FILE.LOG;
49 
50    	TYPE char80tabtype IS TABLE OF VARCHAR2(80) INDEX BY BINARY_INTEGER;
51 
52 	G_Err_Stack	Varchar2(2000);
53 	G_Err_Stack_Tbl	char80tabtype;
54 	G_Err_Ind	Binary_Integer := 0;
55 	G_Err_Stage	Varchar2(650);
56 	G_Err_Code	Number;
57 
58 -- -------------------------------------------
59 -- 29-NOV-00, jwhite:
60 
61     -- Added functions and procedures to EXTEND PA_DEBUG functionality.
62     --
63     -- The subroutines require the following globals:
64 
65     -- 1. G_Function_Stack holds the name of the called functions in a stack format.
66     -- 2. G_Counter is used to mark the current location in the function stack.
67     -- 3. G_Space is used to provide indentation in the stack of function calls
68 
69        G_Function_Stack               PA_PLSQL_DATATYPES.Char50TabTyp;
70        G_Function_Counter             NUMBER := 0;
71        G_Space                        VARCHAR2(200);
72 
73 -- -------------------------------------------
74 
75    PROCEDURE initialize;
76    PROCEDURE enable_debug;
77    PROCEDURE enable_debug (x_debug_level IN NUMBER);
78    PROCEDURE disable_debug;
79    PROCEDURE set_debug_level (x_debug_level IN NUMBER);
80    PROCEDURE debug (x_debug_message IN VARCHAR2);
81    PROCEDURE debug (x_debug_message IN VARCHAR2, x_debug_level IN NUMBER);
82    PROCEDURE get_message(x_message_number IN NUMBER,
83 			 x_debug_message OUT NOCOPY VARCHAR2);
84    FUNCTION no_of_debug_messages RETURN NUMBER;
85 
86 
87 -- -------------------------------------------
88 
89    /* Tsaifee : APIs for handling processes, user locks, etc. */
90 
91    /* Set_User_Lock_Mode :
92 	x_Lock_Mode	Lock modes as defined in APPs dev guide.
93 			6 - Exclusive.
94 	x_Commit_Mode	Rls lock on Commit
95 			FALSE - Do not rls on commit
96 	x_TimeOut	Seconds before timeout.
97 */
98 	PROCEDURE Set_User_Lock_Mode
99 			( 	x_Lock_Mode	IN	NUMBER  DEFAULT 6,
100 				x_Commit_Mode	IN	BOOLEAN DEFAULT FALSE,
101 				x_TimeOut	IN	NUMBER  DEFAULT 0 );
102 
103 	Function Acquire_User_Lock
104 			(	x_Lock_Name	IN	VARCHAR2,
105 				x_Lock_Mode	IN	NUMBER,
106 				x_Commit_Mode	IN	BOOLEAN,
107 				x_TimeOut	IN	NUMBER )
108 			Return NUMBER;
109 
110 	Function Acquire_User_Lock
111 			(	x_Lock_Name	IN	VARCHAR2 )
112 			Return NUMBER;
113 
114 	Function Release_User_Lock (	x_Lock_Name	IN	VARCHAR2 )
115 			Return NUMBER;
116 
117 /* Set_Process :
118 	x_Process	Type of Process
119 			'PLSQL' - PLSQL conc process to use FND_FILE APIs
120 			'SQL'	- SQL execution to use dbms_output APIs
121 			'REPORT'- Oracle Report execution to use PA_DEBUG buffer
122 	x_Write_File	File to write to for PLSQL process only.
123 			'LOG' 	- Log file
124 			'OUT'	- Out file
125 	x_Debug_Mode	Set the debug mode for the session
126 			'Y'	- Set G_DebugMode Y
127 			'N'	- Set G_DebugMode N
128 
129 */
130 	Procedure Set_Process (	x_Process	IN	VARCHAR2 DEFAULT 'PLSQL',
131 				x_Write_File	IN	VARCHAR2 DEFAULT 'LOG',
132 				x_Debug_Mode	IN	VARCHAR2 DEFAULT 'N' );
133 /* Write_File :
134 	x_Write_File	File to write to for PLSQL process only, as above
135 	x_Msg		String to write.
136 	x_Write_Mode	Mandatory write or use debug flag
137 			0 	- Use G_DebugMode to write.
138 			1	- Mandatory write.
139 */
140 
141 	Procedure Write_File (	x_Write_File	IN	VARCHAR2,
142 				x_Msg		IN	VARCHAR2,
143 				x_Write_Mode	IN	NUMBER 	DEFAULT 0);
144 
145 	Procedure Write_File (	x_Msg 		IN	VARCHAR2,
146 				x_Write_Mode	IN	NUMBER 	DEFAULT 0) ;
147 
148 	Procedure Init_Err_Stack (	x_Stack	IN	VARCHAR2 );
149 
150 	Procedure Set_Err_Stack (	x_Stack	IN	VARCHAR2 );
151 
152 	Procedure Reset_Err_Stack;
153 
154 	PROCEDURE raise_error( 	x_Msg_Num    IN NUMBER,
155        		               	x_Msg        IN VARCHAR2 ,
156        		               	x_TokenName1 IN VARCHAR2 ,
157                       		x_Token1     IN VARCHAR2 ,
158                       		x_TokenName2 IN VARCHAR2 ,
159                       		x_Token2     IN VARCHAR2 ,
160                       		x_TokenName3 IN VARCHAR2 ,
161                       		x_Token3     IN VARCHAR2 );
162 
163 	PROCEDURE raise_error( 	x_Msg_Num    IN NUMBER,
164        		               	x_Msg        IN VARCHAR2 ,
165        		               	x_TokenName1 IN VARCHAR2 ,
166                       		x_Token1     IN VARCHAR2 ,
167                       		x_TokenName2 IN VARCHAR2 ,
168                       		x_Token2     IN VARCHAR2 );
169 
170 	PROCEDURE raise_error( 	x_Msg_Num    IN NUMBER,
171        		               	x_Msg        IN VARCHAR2,
172        		               	x_TokenName1 IN VARCHAR2,
173                       		x_Token1     IN VARCHAR2 );
174 
175 	PROCEDURE raise_error( 	x_Msg_Num    IN NUMBER,
176        		               	x_Msg        IN VARCHAR2 );
177 
178 -- -------------------------------------------
179 -- 29-NOV-00, jwhite:
180 -- 07-DEC-00, jwhite: Added p_msg_options.
181 -- 08-DEC-00, jwhite: Added p_write_file
182 
183     -- Added functions and procedures to EXTEND eam_debug functionality.
184     --
185 
186     -- Procedure log_message
187        -- Displays a message using the current function set by the
188        -- procedure set_curr_function
189        -- in addition to that, it sends the write mode
190        -- write mode: 0 print in debug mode
191        --             1 print always
192        -- p_msg_options provides formatting options.
193        -- p_write_file values: LOG, OUT.
194 
195 
196        PROCEDURE log_message(p_message IN VARCHAR2
197                             , p_write_mode  IN NUMBER     DEFAULT 0
198                             , p_msg_options IN VARCHAR2   DEFAULT 'PLAIN'
199                             , p_write_file  IN VARCHAR2   DEFAULT 'LOG'
200                              );
201 
202     -- Procedure set_curr_function
203        -- Sets the current function name passed in and sets the process and stack
204        -- information as well.
205        --
206        -- ALWAYS call this at the beginning of each procedure.
207 
208        PROCEDURE set_curr_function(p_function      IN   VARCHAR2
209                                    , p_process	   IN	VARCHAR2 DEFAULT 'PLSQL'
210 				   , p_write_file  IN	VARCHAR2 DEFAULT 'LOG'
211 				   , p_debug_mode  IN	VARCHAR2 DEFAULT 'N'
212                                    );
213 
214     -- Procedure reset_curr_function
215        -- Resets the current function name and also resets the stack
216        -- information.
217        --
218        -- ALWAYS call this at the end of each procedure.
219 
220        PROCEDURE reset_curr_function;
221 
222 -- -------------------------------------------
223 /* Ewee : Procedure for handling logging messages to FND_LOG_MESSAGES table */
224 
225 /* Write_Log :
226 	x_Module	Module which writes message to FND_LOG_MESSAGES
227 	x_Msg		String to write
228 	x_Log_Level	Scope of log message
229 */
230 
231 	Procedure Write_Log (	x_Module	IN	VARCHAR2,
232 				x_Msg		IN	VARCHAR2,
233 				x_Log_Level	IN	NUMBER DEFAULT 6);
234 
235 -- -------------------------------------------
236 
237 
238 END eam_debug;