Log4plsql for PL/SQL Logging

Posted By Sagar Patil

Log4plsql is an open source tool that uses PL/SQL framework to log into PL/SQL code package, function, web application, procedure, trigger and various oracle tools such as reports, forms etc. Before we proceed with Log4plsql for PL/SQL Logging, it is important to understand the concept behind the importance of logging and logs in the development environment.
Logging is very important part of development lifecycle for any process or application. These logs are important for tracing functional events, data and operations. Logs are also used for code debugging and in testing or maintenance phase to understand unforeseen events such as system crash, quit or launch. It is considered as a very time-consuming tedious job as all the logs during the development strategy have to be considered which utilizes vital computer memory or resources.

What Is LOG4PLSQL ?

LOG4PLSQL is a PL/SQL framework for logging in all PL/SQL code
·        Package,
·        Procedure,
·        Function,
·        Trigger,
·        PL/SQL Web application.
·        Oracle Tools (form, report, …)
Purpose:
·        Easy implementation and use
·        Possibility to log apart from transaction
·        Possibility to adapt the level of logging depending on user requirements
·        Ability to use all LOG4J feature.
·        Provide a complete set of  PL/SQL development tools (debug variable, SQLERRM, assert, call stack, … ).

Log destination:
·        table TLOG
·        alert.log file
·        trace file
·        standard output
·        session information (view V$SESSION)
·        advanced queue read by Log4JBackgroundProcess. :
o       Async,
o       JDBC,
o       JMS,
o       NTEventLog,
o       SMTP,
o       Socket,
o       SocketHub,
o       Syslog,
o       Telnet,
o       Writer

Log4plsql was born from the log4J spirit (and use it).

Architecture

 

Package PLOG  It is the main package of the log functionality. Your PL/SQL applications call its public functions to create a log event (info, debug …)

Package PLOGPARAM Package containing default values for the logging context

Package PLOG_INTERFACE  Dispatcher package built dynamically during the installation of the schema (for compilation raison). Its role is to call the dedicated packages for output according to the configuration and installation choices.

Package SL_PLOG_OUT_ALERT Optional package writing log information into the Oracle alert file alert.log. The function DBMS_SYSTEM. Ksdwrt() function is used.

Package SL_PLOG_OUT_TRACE Optional package writing log information into the Oracle trace file ora.trc. The function DBMS_SYSTEM. Ksdwrt() function is used.

Package SL_PLOG_OUT_AQ Optional package writing log information in a multi-consumer advanced queue consumed by the Java background process. The messages are enqueued using the package DBMS_AQ.

Package SL_PLOG_OUT_DBMS_OUTPUT Optional package writing log information into the standard output. The package DBMS_OUTPUT is used.

Package SL_PLOG_OUT_TLOG Package writing the log information in the table SL_TLOG. The package is part of the basis installation.

 

Installation of Log4plsql for PL/SQL Logging is very easy. Just follow these simple steps:

  • Download Log4Sql from sourceforge.
  • Unzip the zip file at the location where you want Log4plsql for PL/SQL Logging to be installed.
  • Run the executable install file in cmd directory.
  • Basic installation of Log4plsql for PL/SQL Logging is complete and now you need to proceed only if you want to functions or features.

An advanced user has more requirements or desires from Log4plsql for PL/SQL Logging as compared to normal end users. Some of these advanced requirements are:

  • He or she needs to test logging level for which they code it before logging with any of the IsEnabled functions such as isInfoEnabled, isErrorEnabled, isDebugEnabled, isWarnEnabled and isFatalEnabled.
  • An advanced user may want to change the default log parameters for a certain application.
  • Need to create log section in hierarchical log node. You can also specify your own hierarchical log node by defining begin, end and get section.

Leave a Reply

You must be logged in to post a comment.

Top of Page

Top menu