DBA Data[Home] [Help]

PACKAGE: APPS.FND_LOG

Source


1 package FND_LOG as
2 /* $Header: AFUTLOGS.pls 120.2 2005/08/17 16:09:17 ppradhan ship $ */
3    /* Documentation for this package is at */
4    /* http://www-apps.us.oracle.com/atg/plans/r115/aflog.txt */
5 
6    LEVEL_UNEXPECTED CONSTANT NUMBER  := 6;
7    LEVEL_ERROR      CONSTANT NUMBER  := 5;
8    LEVEL_EXCEPTION  CONSTANT NUMBER  := 4;
9    LEVEL_EVENT      CONSTANT NUMBER  := 3;
10    LEVEL_PROCEDURE  CONSTANT NUMBER  := 2;
11    LEVEL_STATEMENT  CONSTANT NUMBER  := 1;
12 
13    /* Context ID of the log transaction */
14    G_TRANSACTION_CONTEXT_ID NUMBER;
15 
16    /*
17    ** FND_LOG.INIT_TRANSACTION
18    **
19    ** Description:
20    ** Initializes a log transaction.  A log transaction
21    ** corresponds to an instance or invocation of a single
22    ** component.  (e.g. A concurrent request, service process,
23    ** open form, ICX function)
24    **
25    ** This routine should be called only after
26    ** FND_GLOBAL.INITIALIZE, since some of the context information
27    ** is retrieved from FND_GLOBAL.
28    **
29    ** Arguments:
30    **   CONC_REQUEST_ID       - Concurrent request id
31    **   FORM_ID               - Form id
32    **   FORM_APPLICATION_ID   - Form application id
33    **   CONCURRENT_PROCESS_ID - Service process id
34    **   CONCURRENT_QUEUE_ID   - Service queue id
35    **   QUEUE_APPLICATION_ID  - Service queue application id
36    **
37    ** Use only the arguments that apply to the caller.
38    ** Any argument that does not apply should be passed as NULL
39    ** i.e. when calling from a form, pass in FORM_ID and FORM_APPLICATION_ID
40    ** and leave all other parameters NULL.
41    **
42    ** Returns:
43    **   ID of the log transaction context
44    **
45    */
46    FUNCTION INIT_TRANSACTION (CONC_REQUEST_ID             IN NUMBER DEFAULT NULL,
47                               FORM_ID                     IN NUMBER DEFAULT NULL,
48                               FORM_APPLICATION_ID         IN NUMBER DEFAULT NULL,
49                               CONCURRENT_PROCESS_ID       IN NUMBER DEFAULT NULL,
50                               CONCURRENT_QUEUE_ID         IN NUMBER DEFAULT NULL,
51                               QUEUE_APPLICATION_ID        IN NUMBER DEFAULT NULL)
52                                                           return NUMBER;
53 
54 
55    /*
56    ** FND_LOG.SET_TRANSACTION
57    ** Description:
58    **     Sets the log transaction ID for the current DB connection.
59    **     This routine should be used whenever the database connection
60    **     changes within the context of a transaction.  For example, this
61    **     routine will be used for successive hits within the same ICX
62    **     transaction or when a concurrent process reconnects to the database.
63    **
64    ** Arguments:
65    **     Log_Transaction
66    **
67    */
68    PROCEDURE SET_TRANSACTION (TRANS_CONTEXT_ID IN NUMBER);
69 
70    /*
71    **  Writes the message to the log file for the spec'd level and module
72    **  if logging is enabled for this level and module
73    */
74    PROCEDURE STRING(LOG_LEVEL IN NUMBER,
75                     MODULE    IN VARCHAR2,
76                     MESSAGE   IN VARCHAR2);
77 
78    /*
79    **  Writes the message with context information to the log file for
80    **  the spec'd level and module if logging is enabled for this level
81    **  and module
82    */
83    PROCEDURE STRING_WITH_CONTEXT(LOG_LEVEL  IN NUMBER,
84                       MODULE           IN VARCHAR2,
85                       MESSAGE          IN VARCHAR2,
86                       ENCODED          IN VARCHAR2 DEFAULT NULL,
87                       NODE             IN VARCHAR2 DEFAULT NULL,
88                       NODE_IP_ADDRESS  IN VARCHAR2 DEFAULT NULL,
89                       PROCESS_ID       IN VARCHAR2 DEFAULT NULL,
90                       JVM_ID           IN VARCHAR2 DEFAULT NULL,
91                       THREAD_ID        IN VARCHAR2 DEFAULT NULL,
92                       AUDSID          IN NUMBER   DEFAULT NULL,
93                       DB_INSTANCE     IN NUMBER   DEFAULT NULL);
94 
95    /*
96    **  Writes a message to the log file if this level and module is enabled
97    **  The message gets set previously with FND_MESSAGE.SET_NAME,
98    **  SET_TOKEN, etc.
99    **  The message is popped off the message dictionary stack, if POP_MESSAGE
100    **  is TRUE.  Pass FALSE for POP_MESSAGE if the message will also be
101    **  displayed to the user later.
102    **  Example usage:
103    **  FND_MESSAGE.SET_NAME(...);    -- Set message
104    **  FND_MESSAGE.SET_TOKEN(...);   -- Set token in message
105    **  FND_LOG.MESSAGE(..., FALSE);  -- Log message
106    **  FND_MESSAGE.ERROR;            -- Display message
107    */
108    PROCEDURE MESSAGE(LOG_LEVEL   IN NUMBER,
109                      MODULE      IN VARCHAR2,
110                      POP_MESSAGE IN BOOLEAN DEFAULT NULL);
111 
112    /*
113    **  Writes a message to the log file if this level and module is enabled
114    **  The message gets set previously with FND_MESSAGE.SET_NAME,
115    **  SET_TOKEN, etc.
116    **  The message is popped off the message dictionary stack, if POP_MESSAGE
117    **  is TRUE.  Pass FALSE for POP_MESSAGE if the message will also be
118    **  displayed to the user later.
119    **  Example usage:
120    **  FND_MESSAGE.SET_NAME(...);    -- Set message
121    **  FND_MESSAGE.SET_TOKEN(...);   -- Set token in message
122    **  ATTACHMENT_ID := FND_LOG.MESSAGE_WITH_ATTACHMENT(..., FALSE);  -- Log message
123    **  -- For ASCII data use WRITE
124    **  FND_LOG_ATTACHMENT.WRITE(ATTACHMENT_ID, ...);
125    **  -- For Non-ASCII data use WRITE_RAW
126    **  FND_LOG_ATTACHMENT.WRITE_RAW(ATTACHMENT_ID, ...);
127    **  FND_LOG_ATTACHMENT.CLOSE();
128    */
129    FUNCTION MESSAGE_WITH_ATTACHMENT(LOG_LEVEL   IN NUMBER,
130                      MODULE      IN VARCHAR2,
131                      POP_MESSAGE IN BOOLEAN DEFAULT NULL,
132                      P_CHARSET IN VARCHAR2 DEFAULT 'ascii',
133                      P_MIMETYPE IN VARCHAR2 DEFAULT 'text/html',
134                      P_ENCODING IN VARCHAR2 DEFAULT NULL,
135                      P_LANG IN VARCHAR2 DEFAULT NULL,
136                      P_FILE_EXTN IN VARCHAR2 DEFAULT 'txt',
137                      P_DESC IN VARCHAR2 DEFAULT NULL) RETURN NUMBER;
138 
139    /*
140    **  Writes a message to the log file if this level and module is enabled
141    **  The message gets set previously with FND_MESSAGE.SET_NAME,
142    **  SET_TOKEN, etc.
143    **  The message is popped off the message dictionary stack, if POP_MESSAGE
144    **  is TRUE.  Pass FALSE for POP_MESSAGE if the message will also be
145    **  displayed to the user later.
146    **  Example usage:
147    **  FND_MESSAGE.SET_NAME(...);    -- Set message
148    **  FND_MESSAGE.SET_TOKEN(...);   -- Set token in message
149    **  FND_LOG.MESSAGE(..., FALSE);  -- Log message
150    **  FND_MESSAGE.ERROR;            -- Display message
151    */
152    PROCEDURE MESSAGE(LOG_LEVEL   IN NUMBER,
153                      MODULE      IN VARCHAR2,
154                      POP_MESSAGE IN BOOLEAN DEFAULT NULL,
155 		     AUTO_LOG    IN VARCHAR2);
156 
157    /*
158    **  Writes a message with context to the log file if this level and
159    **  module is enabled.  This requires that the message was set
160    **  previously with FND_MESSAGE.SET_NAME, SET_TOKEN, etc.
161    **  The message is popped off the message dictionary stack, if POP_MESSAGE
162    **  is TRUE.  Pass FALSE for POP_MESSAGE if the message will also be
163    **  displayed to the user later.  If POP_MESSAGE isn't passed, the
164    **  message will not be popped off the stack, so it must be displayed
165    **  or explicitly cleared later on.
166    */
167    PROCEDURE MESSAGE_WITH_CONTEXT(LOG_LEVEL IN NUMBER,
168                       MODULE           IN VARCHAR2,
169                       POP_MESSAGE      IN BOOLEAN DEFAULT NULL, --Default FALSE
170                       NODE             IN VARCHAR2 DEFAULT NULL,
171                       NODE_IP_ADDRESS  IN VARCHAR2 DEFAULT NULL,
172                       PROCESS_ID       IN VARCHAR2 DEFAULT NULL,
173                       JVM_ID           IN VARCHAR2 DEFAULT NULL,
174                       THREAD_ID        IN VARCHAR2 DEFAULT NULL,
175                       AUDSID          IN NUMBER   DEFAULT NULL,
176                       DB_INSTANCE     IN NUMBER   DEFAULT NULL);
177 
178    /*
179    ** FND_LOG.WORK_METRIC
180    ** Description:
181    **     Writes a metric value out to the FND tables in an
182    **     autonomous transaction.  Posting to the Business Event
183    **     system is deferred until WORK_METRICS_EVENT is called.
184    **
185    ** Arguments:
186    **     Module       - Module name (See FND_LOG standards.)
187    **     Metric_code  - Internal name of metric.
188    **     Metric_value - Value for metric (string, number, or date)
189    **
190    */
191    procedure WORK_METRIC (MODULE       IN VARCHAR2,
192                      METRIC_CODE  IN VARCHAR2,
193                      METRIC_VALUE IN VARCHAR2);
194 
195    procedure WORK_METRIC (MODULE       IN VARCHAR2,
196                      METRIC_CODE  IN VARCHAR2,
197                      METRIC_VALUE IN NUMBER);
198 
199    procedure WORK_METRIC (MODULE       IN VARCHAR2,
200                      METRIC_CODE  IN VARCHAR2,
201                      METRIC_VALUE IN DATE);
202 
203    /*
204    ** FND_LOG.WORK_METRICS_EVENT
205    ** Description:
206    **     Posts the pending metrics for the current component
207    **     session to the Business Event system and updates the pending
208    **     metrics with the event key. The metrics will be bundled in an
209    **     XML message included in the event.  The event will be named:
210    **     "oracle.apps.fnd.system.metrics"
211    **
212    ** Arguments:
213    **     CONTEXT_ID    ID of the context to post the metrics event for.
214    **                   Use NULL for the current context.
215    */
216 
217    PROCEDURE WORK_METRICS_EVENT(CONTEXT_ID IN NUMBER DEFAULT NULL);
218 
219    /*
220    ** Tests whether logging is enabled for this level and module, to
221    ** avoid the performance penalty of building long debug message
222    ** strings unnecessarily.
223    */
224    FUNCTION TEST(LOG_LEVEL IN NUMBER,
225                  MODULE    IN VARCHAR2) RETURN BOOLEAN;
226 
227 
228    /* This global allows callers to avoid a function call if a log message */
229    /* is not for the current level.  It is automatically populated by */
230    /* the FND_LOG_REPOSITORY package.
231    /* Here is an example of how to achieve maximum performance with */
232    /* this, assuming that you want to log a message at EXCEPTION level */
233    /*  */
234    /* if((FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL)) then*/
235    /*   if(FND_LOG.TEST(FND_LOG.LEVEL_EXCEPTION */
236    /*           'fnd.form.ABCDEFGH.PACKAGEA.FUNCTIONB.firstlabel')) then*/
237    /*      dbg_msg := create_lengthy_debug_message(...);*/
238    /*      FND_LOG.STRING(FND_LOG.LEVEL_EXCEPTION, */
239    /*           'fnd.form.ABCDEFGH.PACKAGEA.FUNCTIONB.firstlabel', dbg_msg);*/
240    /*   end if; */
241    /* end if;*/
242    G_CURRENT_RUNTIME_LEVEL NUMBER := 6;
243 
244    /*
245    ** FND_LOG.GET_TEXT
246    **
247    ** Description:
248    ** Retrieves the fully translated message text, given a log sequence ID
249    **
250    ** Arguments:
251    **      log_sequence_id   - FND_LOG message identifier.
252    **      lang              - Language code for translation (optional).
253    **
254    ** Returns:
255    **      If an encoded message, the full translated text of the message.
256    **      If message not encoded, the text of the message as logged.
257    **      Returns NULL if the message cannot be found.
258    */
259    FUNCTION GET_TEXT(LOG_SEQUENCE_ID IN NUMBER,
260                      LANG            IN VARCHAR2 DEFAULT NULL
261                      ) RETURN  VARCHAR2;
262 
263     /**
264      * Procedure to enable PL/SQL Buffered Logging (for Batch Mode).
265      * Caller is responsible for calling RESET_BUFFERED_MODE to flush
266      * messages at end. Only messages with log_level < 4 are bufferable.
267      * All error messages (log_level >= 4) are logged immediately.
268      *
269      * Internally reads AFLOG_BUFFER_MODE Profile and if !=0
273 
270      * buffers messages in PL/SQL Collection for Bulk-Inserting.
271      */
272     PROCEDURE SET_BUFFERED_MODE;
274     /**
275      * Flushes any buffered messages, and switches back to the
276      * default synchronous (non-buffered) logging.
277      */
278     PROCEDURE RESET_BUFFERED_MODE;
279 
280     /**
281      * API for raising a proxy alert on behalf of the given
282      * concurrent request. The transaction context for the alert is set to
283      * that of the given request ID. The current transaction context is also
284      * captured as a parent context.
285      *
286      * This API does the following:
287      * 1) Sets a child context for the given request ID
288      * 2) Raises the proxy alert by calling fnd_log.message in the normal
289      *    fashion
290      * 3) Clears the child context.
291      */
292     PROCEDURE PROXY_ALERT_FOR_CONC_REQ(
293 	MODULE IN VARCHAR2,
294 	POP_MESSAGE IN BOOLEAN DEFAULT NULL,
295 	REQUEST_ID IN NUMBER);
296 
297 end FND_LOG;