Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 248
  • Last Modified:

Options to log at the DB tier

Hi - We have an application which has a portion of its processing done in the database - the processing is done using PL/SQL and shell scripts and currently logging occurs by writing to a flat file - however we are looking to exert more control over the logging by setting logging levels and turning logging on and off dynamically at runtime.

Can anyone suggest options for DB tier level logging - the database we are using is Oracle 11g.

Thanks
0
abuyusuf
Asked:
abuyusuf
  • 4
1 Solution
 
sdstuberCommented:
If you are familiar with java and the log4j  framework,  there is a similar structure

log4plsql  you might want to explore


http://log4plsql.sourceforge.net/
0
 
sdstuberCommented:
another good option is the Instrumentation Library for Oracle, orginally from HOTSOS

http://sourceforge.net/projects/ilo/
0
 
sdstuberCommented:
and of course, you can always roll your own.

use autonomous_transactions to commit your logs independently of the transactions that spawned them (one of the few places autonomous transactions are appropriate to use)

Here is a simple logging procedure you expand on as needed
FUNCTION write_to_log (p_message VARCHAR2)
        RETURN NUMBER
    IS
/*
    Declaring with the Autonomous Transaction PRAGMA allows
    this procedure to commit and rollback independently of
    any parent transactions.

    i.e. The COMMIT in this procedure will only commit the
    insert statement of this procedure.  Actions outside of this
    procedure will not be committed or rolledback because of
    activity within this procedure.

    CREATE TABLE MY_LOG
    (
        LOG_TS    TIMESTAMP(6) WITH TIME ZONE,
        LOG_TEXT  VARCHAR2(4000 BYTE)
    )



*/
        PRAGMA AUTONOMOUS_TRANSACTION;
    BEGIN
        INSERT INTO my_log
                    (log_ts, log_text
                    )
             VALUES (SYSTIMESTAMP, p_message
                    );

        COMMIT;
        RETURN 0;
    EXCEPTION
        WHEN OTHERS
        THEN
            ROLLBACK;
            RETURN SQLCODE;
    END write_to_log;

Open in new window

0
 
abuyusufAuthor Commented:
It only partially answers my question
0
 
sdstuberCommented:
please rescore...you didn't ask for more information.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now