erste version der DB dateien erstellt
This commit is contained in:
152
database/packages/pck_log.pkb
Normal file
152
database/packages/pck_log.pkb
Normal file
@@ -0,0 +1,152 @@
|
||||
create or replace package body pck_log as
|
||||
|
||||
procedure p_write (
|
||||
i_level in varchar2
|
||||
,i_module in varchar2
|
||||
,i_action in varchar2
|
||||
,i_message in varchar2
|
||||
,i_detail in clob default null
|
||||
,i_object_ref in varchar2 default null
|
||||
)
|
||||
/*Kopf------------------------------------------------------------------------------------------------
|
||||
-- Beschreibung: Interne Hilfsprozedur — schreibt einen Log-Eintrag in lg_app_log.
|
||||
-- Verwendet autonomous_transaction, damit der Commit unabhängig vom Aufrufer erfolgt.
|
||||
-- Wird ausschließlich von p_info, p_warn und p_error aufgerufen.
|
||||
------------------------------------------------------------------------------------------------------
|
||||
-- Parameter: i_level Log-Level (INFO, WARN, ERROR)
|
||||
-- i_module Aufgerufenes Modul / Package
|
||||
-- i_action Aktion innerhalb des Moduls
|
||||
-- i_message Kurze Meldung
|
||||
-- i_detail Optionaler Langtext (Stack Trace, JSON, etc.)
|
||||
-- i_object_ref Optionaler Objektbezug (z.B. Dateiname, Primärschlüssel)
|
||||
------------------------------------------------------------------------------------------------------
|
||||
-- MA Datum Änderung
|
||||
-- SCK 2026-04-08 Prozedur erstellt
|
||||
------------------------------------------------------------------------------------------------Kopf*/
|
||||
is
|
||||
pragma autonomous_transaction;
|
||||
l_user varchar2(100 char);
|
||||
begin
|
||||
l_user := substr(upper(coalesce(
|
||||
sys_context('apex$session', 'app_user')
|
||||
,sys_context('userenv', 'os_user')
|
||||
,sys_context('userenv', 'session_user'))), 1, 100);
|
||||
|
||||
insert into lg_app_log (
|
||||
log_timestamp
|
||||
,log_level
|
||||
,log_module
|
||||
,log_action
|
||||
,log_object_ref
|
||||
,log_message
|
||||
,log_detail
|
||||
,log_user
|
||||
,log_session_id
|
||||
) values (
|
||||
systimestamp
|
||||
,i_level
|
||||
,i_module
|
||||
,i_action
|
||||
,i_object_ref
|
||||
,i_message
|
||||
,i_detail
|
||||
,l_user
|
||||
,to_number(sys_context('userenv', 'sessionid'))
|
||||
);
|
||||
commit;
|
||||
exception
|
||||
when others
|
||||
then
|
||||
rollback;
|
||||
raise;
|
||||
end p_write;
|
||||
|
||||
procedure p_info (
|
||||
i_module in varchar2
|
||||
,i_action in varchar2
|
||||
,i_message in varchar2
|
||||
,i_object_ref in varchar2 default null
|
||||
)
|
||||
/*Kopf------------------------------------------------------------------------------------------------
|
||||
-- Beschreibung: Schreibt einen Info-Log-Eintrag (Level INFO).
|
||||
------------------------------------------------------------------------------------------------------
|
||||
-- Parameter: i_module Aufgerufenes Modul / Package
|
||||
-- i_action Aktion innerhalb des Moduls
|
||||
-- i_message Kurze Meldung
|
||||
-- i_object_ref Optionaler Objektbezug (z.B. Dateiname, Primärschlüssel)
|
||||
------------------------------------------------------------------------------------------------------
|
||||
-- MA Datum Änderung
|
||||
-- SCK 2026-04-08 Prozedur erstellt
|
||||
------------------------------------------------------------------------------------------------Kopf*/
|
||||
is
|
||||
begin
|
||||
p_write(
|
||||
i_level => 'INFO'
|
||||
,i_module => i_module
|
||||
,i_action => i_action
|
||||
,i_message => i_message
|
||||
,i_object_ref => i_object_ref
|
||||
);
|
||||
end p_info;
|
||||
|
||||
procedure p_warn (
|
||||
i_module in varchar2
|
||||
,i_action in varchar2
|
||||
,i_message in varchar2
|
||||
,i_object_ref in varchar2 default null
|
||||
)
|
||||
/*Kopf------------------------------------------------------------------------------------------------
|
||||
-- Beschreibung: Schreibt einen Warn-Log-Eintrag (Level WARN).
|
||||
------------------------------------------------------------------------------------------------------
|
||||
-- Parameter: i_module Aufgerufenes Modul / Package
|
||||
-- i_action Aktion innerhalb des Moduls
|
||||
-- i_message Kurze Meldung
|
||||
-- i_object_ref Optionaler Objektbezug (z.B. Dateiname, Primärschlüssel)
|
||||
------------------------------------------------------------------------------------------------------
|
||||
-- MA Datum Änderung
|
||||
-- SCK 2026-04-08 Prozedur erstellt
|
||||
------------------------------------------------------------------------------------------------Kopf*/
|
||||
is
|
||||
begin
|
||||
p_write(
|
||||
i_level => 'WARN'
|
||||
,i_module => i_module
|
||||
,i_action => i_action
|
||||
,i_message => i_message
|
||||
,i_object_ref => i_object_ref
|
||||
);
|
||||
end p_warn;
|
||||
|
||||
procedure p_error (
|
||||
i_module in varchar2
|
||||
,i_action in varchar2
|
||||
,i_message in varchar2
|
||||
,i_detail in clob default null
|
||||
,i_object_ref in varchar2 default null
|
||||
)
|
||||
/*Kopf------------------------------------------------------------------------------------------------
|
||||
-- Beschreibung: Schreibt einen Fehler-Log-Eintrag (Level ERROR).
|
||||
------------------------------------------------------------------------------------------------------
|
||||
-- Parameter: i_module Aufgerufenes Modul / Package
|
||||
-- i_action Aktion innerhalb des Moduls
|
||||
-- i_message Kurze Fehlerbeschreibung
|
||||
-- i_detail Optionaler Langtext (Stack Trace, JSON, etc.)
|
||||
-- i_object_ref Optionaler Objektbezug (z.B. Dateiname, Primärschlüssel)
|
||||
------------------------------------------------------------------------------------------------------
|
||||
-- MA Datum Änderung
|
||||
-- SCK 2026-04-08 Prozedur erstellt
|
||||
------------------------------------------------------------------------------------------------Kopf*/
|
||||
is
|
||||
begin
|
||||
p_write(
|
||||
i_level => 'ERROR'
|
||||
,i_module => i_module
|
||||
,i_action => i_action
|
||||
,i_message => i_message
|
||||
,i_detail => i_detail
|
||||
,i_object_ref => i_object_ref
|
||||
);
|
||||
end p_error;
|
||||
|
||||
end pck_log;
|
||||
/
|
||||
Reference in New Issue
Block a user