DBA Data[Home] [Help]

PACKAGE: APPS.CLN_DEBUG_PUB

Source


1 PACKAGE  CLN_DEBUG_PUB AS
2 /* $Header: CLNDBGS.pls 120.1 2006/03/28 05:07:50 amchaudh noship $ */
3 /*#
4 * Debug API for CLN transactions
5 * @rep:scope private
6 * @rep:product CLN
7 * @rep:displayname Debug transactions
8 * @rep:category BUSINESS_ENTITY  CLN_TRADING_PARTNER_COLL
9 * @rep:compatibility  S
10 * @rep:lifecycle  active
11 */
12 --  Constants used as tokens for unexpected error Debugs.
13 
14     G_PKG_NAME  CONSTANT    VARCHAR2(15):=  'CLN_DEBUG_PUB';
15 
16 --  API Debugging table type
17 --
18 --      PL/SQL table of VARCHAR2(2000)
19 
20     G_DEBUG_LEN        CONSTANT Number := 500; -- Maximum length of a message
21     TYPE Debug_tbl_type IS TABLE OF VARCHAR2(500)
22      INDEX BY BINARY_INTEGER;
23 
24     G_Debug_Tbl                 Debug_Tbl_Type;
25 
26 --  Global variable holding the Debug count.
27 
28     G_Debug_count   NUMBER := 0;
29 
30 --  Global variable holding the desired debug_level.
31 
32     G_Debug_Level   NUMBER :=  to_number(nvl(fnd_profile.value('CLN_DEBUG_LEVEL'), '0')); /*   1 to 6
33                                                         STATEMENT       1
34                                                         PROCEDURE       2
35                                                         EVENT   3
36                                                         EXCEPTION       4
37                                                         ERROR   5
38                                                         UNEXPECTED      6
39                                                         */
40 --  Index used by the Get function to keep track of the last fetched
41 --  Debug.
42 
43     G_Debug_index   NUMBER     := 0;
44 
45 --  Flag to indicate if the debugging is on.
46 --  The call to procedure ADD will add the string to the debug cache
47     G_DEBUG      Varchar2(1)    := FND_API.G_FALSE;
48     G_DEBUG_MODE VARCHAR2(30)   := 'FILE';
49                                 -- Table , default mode
50                                 -- file , write to log file
51                                 -- CONC , write to log file and concurrent log
52     G_DIR         Varchar2(255)     := nvl(fnd_profile.value
53                         ('CLN_DEBUG_LOG_DIRECTORY'), '/tmp');
54     G_FILE        Varchar2(255)     := null;
55     G_FILE_PTR    utl_file.file_type;
56 
57 /* Name   Set_Debug_mode
58 ** Purpose Sets the debug mode to be FILE or TABLE or CONC.
59 ** It will set the debug mode to FILE if specified so else
60 ** the mode is set to TABLE, It reuturns the name of the file if
61 ** the mode desired is FILE else returns null
62 */
63 
64 /*#
65 * Sets the Debug mode
66 * @param p_mode mode
67 * @return rtn_val  value
68 * @rep:scope private
69 * @rep:lifecycle active
70 * @rep:displayname Set Debug Mode
71 */
72 Function Set_Debug_Mode(P_Mode in varchar2) Return Varchar2;
73 
74 /* Name   Initialize
75 ** Purpose Clears the debug cache. Use this procedure to clear out the
76 ** any debugging statments cached in the debug table.
77 */
78 
79 /*#
80 * Initializes package variables
81 * @rep:scope private
82 * @rep:lifecycle active
83 * @rep:displayname Initialize package variables
84 */
85 PROCEDURE Initialize;
86 
87 /* Name   Debug_On
88 ** Purpose To Turn the debugging on. Use this proceudre to enable debuging
89 ** for the current sesssion. Any subsquent call to the statment add will result
90 ** in the debug statments cached to the debug table
91 */
92 
93 /*#
94 * Sets FND api variables
95 * @rep:scope private
96 * @rep:lifecycle active
97 * @rep:displayname Set variable values
98  */
99 Procedure Debug_ON;
100 
101 /* Name   Debug_Off
102 ** Purpose To Turn off the debugging. Use this proceudre to disable debugging
103 ** for the current sesssion. Call to ADD will be ignored. Please note that
104 ** Function does not clear the cache and any debuging information is retained
105 */
106 
107 /*#
108 * Sets FND api variables
109 * @rep:scope private
110 * @rep:lifecycle active
111 * @rep:displayname Set variable values
112 */
113 Procedure Debug_OFF;
114 
115 /* Name   IsDebugOn
116 ** Purpose To test if the debugging is enabled.
117 */
118 
119 /*#
120 * Gets package variable value debugon
121 * @return booleanvalue
122 * @rep:scope private
123 * @rep:lifecycle active
124 * @rep:displayname Get debugon value
125 */
126 Function ISDebugOn Return Boolean;
127 
128 /* Name   GetDebugCount
129 ** Purpose To get the number of debugging message cached
130 */
131 
132 /*#
133 * Gets package variable value debugcount
134 * @return  value debugcount
135 * @rep:scope private
136 * @rep:lifecycle active
137 * @rep:displayname Get debugcount value
138 */
139 FUNCTION GetDebugCount RETURN NUMBER;
140 
141 /* Name   Add
142 ** Purpose To add a debugging message. This message will be placed in
143 ** the table only if the debuggin is turned on.
144 */
145 
146 /*#
147 * Sets FND api variables
148 * @param p_debug_msg value
149 * @param p_debug_level value
150 * @return  value debugcount
151 * @rep:scope private
152 * @rep:lifecycle active
153 * @rep:displayname Get variable values
154 */
155 PROCEDURE Add(p_debug_msg in Varchar2, p_debug_level in Number default 5);
156 
157 /* Name   GetFirst
158 ** Purpose To Get the First Message. This prcocude will reset the debug index
159 */
160 
161 /*#
162 * Gets first debug message
163 * @param debug_msg value
164 * @rep:scope private
165 * @rep:lifecycle active
166 * @rep:displayname Get first debug message
167 */
168 Procedure GetFirst(Debug_msg OUT NOCOPY Varchar2);
169 
170 /* Name   GetNext
171 ** Purpose To Get the Next Message from the  debug cache.
172 ** This Procedure will increment the debug index  by one
173 */
174 
175 /*#
176 * Gets  debug message
177 * @param debug_msg value
178 * @rep:scope private
179 * @rep:lifecycle active
180 * @rep:displayname Get debug message
181 */
182 Procedure GetNext(debug_msg OUT NOCOPY varchar2);
183 
184 /* Name  GetNextBuffer
185 ** Purpose To Get the Next Set of message separted by a new line
186 ** The routine will concatnate the message until reaching the end of the
187 ** mesage cache or the total messages exceed as specified in the p_msg_count
188 ** This Procedure will increment the debug index  acordingly
189 */
190 
191 /*#
192 * Gets the next message in the buffer
193 * @param p_debug_msg value
194 * @rep:scope private
195 * @rep:lifecycle active
196 * @rep:displayname Get the next message in the buffer
197 */
198 Procedure GetNextBuffer( p_debug_msg in OUT NOCOPY varchar2);
199 
200 /* Name ResetIndex
201 ** resest the debug index, setting the index pointer to the beginging of the
202 ** cache
203 */
204 
205 /*#
206 * Resets package variable values
207 * @rep:scope private
208 * @rep:lifecycle active
209 * @rep:displayname Resets package variable values
210 */
211 Procedure ResetIndex;
212 
213 /* Name SetDebugLevelFromProfile;
214 ** Set g_debug_level to the value specified in the profile CLN_DEBUG_LEVEL
215 */
216 
217 
218 Procedure SetDebugLevelFromProfile;
219 
220 /* Name SetDebugLevel (p_debug_level in number);
221 ** Set g_debug_level to the desired one
222 */
223 Procedure SetDebugLevel(p_debug_level in number);
224 
225 
226 END CLN_DEBUG_PUB;