DBA Data[Home] [Help]

PACKAGE BODY: APPS.AD_ZD_LOG

Source


1 PACKAGE BODY ad_zd_log AS
2 /* $Header: ADZDLOGB.pls 120.11.12020000.3 2013/03/06 10:52:54 shivaaga ship $ */
3 
4 --  create table APPLSYS.AD_ZD_LOG (
5 --          LOG_SEQUENCE NOT NULL NUMBER,
6 --          MODULE       NOT NULL VARCHAR2(255),
7 --          MESSAGE_TEXT NOT NULL VARCHAR2(4000),
8 --          SESSION_ID   NUMBER,
9 --          TYPE         VARCHAR2(10),
10 --          TIMESTAMP    TIMESTAMP  )'
11 --
12 --
13 --
14 
15 
16 -- procedure:
17 --   message()
18 -- parameters:
19 --   x_module - varchar2 - calling code identifier (calling module)
20 --   x_log_type - varchar2 - the type of message being logged (see below)
21 --   x_message - varchar2 - the message being logged into the table
22 -- purpose:
23 --   Insert record into ad_zd_logs table
24 -- more on x_log_type:
25 --   This specifies the "level" of the log message. This is used to clarify
26 --   log messages by level of detail so that extraneous information can be
27 --   filtered from summary reports. ALL log messages are logged ALL the time
28 --   and there is no filtering of any kind, so please be careful to not
29 --   overlog. Although everything gets logged regardless of what is passed in
30 --   for this parameter, you SHOULD use one of the below defined level codes.
31 -- level codes:
32 --   STATEMENT: Detailed information that might be helpful. Message should
33 --     show some detail that will be useful in debugging.
34 --   PROCEDURE: Used to mark beginning and ending of high level procedures.
35 --     Should be: "begin: <key arguments>' or 'end'
36 --   EVENT: Used to record a significant state change - ie. dropping an index.
37 --     Use English (not SQL) - example: 'Dropping unused column: <name>'
38 --   WARNING: Internal warning. DO NOT USE THIS!!!
39 --   ERROR: Some action failed. Message should state the problem, identify
40 --     the specific object that was being changed (if applicable). Be careful
41 --     using this as this message will be shown to system operators.
42 --   UNEXPECTED: Something terrible happened. DO NOT USE THIS!!!
43  procedure message( x_module    varchar2,
44                     x_log_type  varchar2,
45                     x_message   varchar2 ) is
46    pragma autonomous_transaction;
47    l_applsys varchar2(30);
48    l_message varchar2(4000);
49    l_module  varchar2(255);
50    l_type    varchar2(10);
51   BEGIN
52 
53    l_message := SUBSTR(x_message,1, 3999);
54    l_module  := SUBSTR(x_module,1, 254);
55    l_type    := SUBSTR(x_log_type, 1, 10);
56 
57    insert into ad_zd_logs
58         ( log_sequence,
59           module,
60           message_text,
61           session_id,
62           type ,
63           timestamp)
64    values (AD_ZD_LOGS_S.NEXTVAL,
65            l_module,
66            l_message,
67            SYS_CONTEXT('USERENV', 'SESSIONID'),
68            l_type,
69            current_timestamp);
70    commit;
71  END message;
72 
73 -- procedure:
74 --   clear()
75 -- parameters:
76 --   none
77 -- purpose:
78 --   to truncate the log file.
79 -- notes:
80 --   will delete EVERYTHING - so be careful
81  procedure clear is
82   pragma autonomous_transaction;
83   l_applsys varchar2(30);
84  BEGIN
85 
86   select oracle_username into l_applsys
87     from system.fnd_oracle_userid
88     where  read_only_flag in ('E')
89       and rownum < 2 ;
90 
91   execute immediate 'truncate table ' || l_applsys || '.ad_zd_logs';
92   commit;
93 
94  end clear;
95 
96 end ad_zd_log;