Oracle中基于级别的日志记录 [英] Level based Logging in Oracle
问题描述
我是Kanagaraj.在我们的存储过程中,我们将消息记录在500个位置,并且日志存储在一个存在性能问题的表中.我们需要将这些消息分为调试",信息"和错误"消息.根据级别,仅应记录有限的消息.如有必要,我们将启用下一个级别并查看更多日志.在我们的过程中引入这种基于级别的日志记录的有效方法是什么?
I am Kanagaraj. In our stored procedure, we are logging messages at 500 places and logs are stored in a table where we are having some performance issues. We need to split these messages into Debug, Info and Error messages. Based on the level, only limited messages should be logged. If necessary, we will be enabling the next level and see the more logs. What could be the effective way for introducing this level based logging in our procedure?.
提前谢谢.
Kanagaraj.
Kanagaraj.
推荐答案
类似这样的事情...
Something like this...
create or replace package logger as
min_level number := 2;
procedure ins_log(level number, message varchar2);
end;
create or replace package body logger as
procedure ins_log(level number, message varchar2) is
pragma autonomous_transaction;
begin
if level>=min_level then
insert into loggin(ts, msg) values (sysdate, message);
end if;
commit; // autonomous_transaction requires that
end;
end;
添加了pragma autonomous_transaction;
,谢谢亚当
这篇关于Oracle中基于级别的日志记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!