Solved

Options to log at the DB tier

Posted on 2011-02-22
5
242 Views
Last Modified: 2012-05-11
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
Comment
Question by:abuyusuf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 74

Expert Comment

by:sdstuber
ID: 34952736
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
 
LVL 74

Expert Comment

by:sdstuber
ID: 34952761
another good option is the Instrumentation Library for Oracle, orginally from HOTSOS

http://sourceforge.net/projects/ilo/
0
 
LVL 74

Accepted Solution

by:
sdstuber earned 500 total points
ID: 34952803
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
 

Author Closing Comment

by:abuyusuf
ID: 35324127
It only partially answers my question
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 35324394
please rescore...you didn't ask for more information.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
migration MS SQL database to Oracle 30 82
ER Diagram 3 52
update statement in oracle 9 53
SQL Syntax Question 9 57
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question