How can I see logs of oracle procedure(dbms_output statement)
Actually I am calling oracle procedure from java file present at application server. I want to debug my oracle procedure, so I write statement in oracle procedure as "dbms_output", but dont know where the log is store on oracle server, actuaaly I want to print some variable value in oracle procedure to trace my problem.
If you know any other debug mechanism for debugging oracle procedure calling from java file,please share in explain.
I have spent hours looking for something on Google. However I cannot seem to fi开发者_Python百科nd anything that holds the hand,Your help is much appreciated. Try to be more clear, I'm in lack of ideas in this problem, even it sounds like a classic.
When you make a call to dbms_output
( put_line method, I assume), the output is pumped to stderr, not to any log file.
I'd urge you to use a tool like Log4PLSQL or create a logging table and have an autonomous transaction which logs all errors to this table.
Your basic error logging procedure will look something like this:
PROCEDURE log_errors(p_error_details varchar2) is
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
INSERT INTO ERROR_LOG(SR_NO, ERR_MSG, ERR_DATE)
VALUES(ERR_LOG_SEQ.NEXTVAL, p_error_details, sysdate);
COMMIT;
END log_errors;
Supporting scripts for the error logging procedure:
CREATE TABLE ERROR_LOG(SR_NO NUMBER, ERR_MSG VARCHAR2(2000), ERR_DATE DATE);
CREATE SEQUENCE ERR_LOG_SEQ MINVALUE 1 START WITH 1 INCREMENT BY 1 CACHE 20;
Now, just add an exception handler & call this procedure in the PL/SQL procedure giving you the problems.
BEGIN
....
EXCEPTION
...
WHEN OTHERS THEN
log_errors(DBMS_UTILITY.FORMAT_ERROR_BACKTRACE);
All exceptions will be handled and stored in ERROR_LOG
table.
精彩评论