Skip to content

Instantly share code, notes, and snippets.

@jayvdb
Last active April 2, 2019 05:00
Show Gist options
  • Save jayvdb/fadf22ed54bcc3febaba to your computer and use it in GitHub Desktop.
Save jayvdb/fadf22ed54bcc3febaba to your computer and use it in GitHub Desktop.
PLSQL frameworks

Every PL/SQL application needs logging and a test framework, and a few other features like assertion, exception and collections.

This is an analsys of the existing frameworks.

APEX logging

APEX has the following debugging packages:

APEX_APPLICATION

  • apex_application.g_debug - debug enabled flag
  • apex_application.debug - procedure to log a debug message

APEX_DEBUG (previously called APEX_DEBUG_MESSAGE)

  • message - general procedure, with p_level to set the level
  • error - shortcut procedure to log an error
  • warn - shortcut procedure
  • info - shortcut procedure (used by apex_application.debug)
  • trace - shortcut procedure to log below info level
  • and others

Only alexandria-plsql-utils (below) sends messages to the APEX logging layer.

Logging/assertion/debugging

Logger

(https://github.com/OraOpenSource/Logger)

This is the most common logging library. It uses a lot of objects in the schema. It doesnt appear to send logging events to APEX's debug functionality, but it does log APEX data in its own tables.

It includes assertion functionality, but not more generic exception functionality.

oos-utils uses Logger in some of its components. https://github.com/OraOpenSource/oos-utils

Actively maintained.

alexandria-plsql-utils

Another large system.

debug_pkg only provides debug support

Includes APEX_APPLICATION.DEBUG support

Only uses dbms_output as a fallback; does not do any logging. No assertion or exception frameworks.

Moderately actively maintained.

plsql-core

A very large system, with a good build and test structure, with 'logger' being only a single component. It also has modules for user_messages, collections and exceptions and assertions.

Most components, including the logging component, have no dependencies on other parts of plsql-core.

Not actively maintained.

log4oracle-plsql

A very comprehensive logging framework, requiring many database objects to be installed.

No updates since 2013.

plsqlstarter

Includes logging (logs) and assertion (excp)

plsql-commons

https://github.com/areuser/plsql-commons

Last update was 2013.

log4plsql

Previously the most commonly used logging package.

Last update was 2013.

Resulting in at least two forks on github: https://github.com/alangibson/log4plsql https://github.com/soliverr/log4plsql

plsqllogger

Also not maintained.

OraLog

Recommends using Logger.

PLSQL-demo-scripts

Has logging examples, such as at_log.pkg, dbms_errlog_helper.pkg, etc.

Testing

plsql-core

Each .sql file has a single anonymous procedure with its own mini test library, inbuilt requiring no test library to be installed.

However some of the tests do depend on components of the framework.

  • assert tests depends on types package
  • event_mediator tests depends on types package
  • properties tests depends on logger package
  • permissions tests depend on constants package

Others

plsql-chrestomathy

https://github.com/dba-diaries/plsql-chrestomathy

Interesting and growing collection of components aimed at DBAs more than application builders.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment