CREATE OR REPLACE PROCEDURE testLog
IS

 /* *****************************************************************************
    * Description
    * ============
    *  This procedure shows how to use LogFileMgr
    *
    *   File:          proc_akitools_testLog.sql
    *   Modified at:   $Date: 2020-01-01 08:00:00 +0200 (Mi, 01 Jan 2020) $
    *   Checked in by: $Author: AKielhorn $
    *   Revision:      $Revision: 100 $
    *   Author:        Andy Kielhorn
    *   Company:       AkiCom
    *****************************************************************************
 */
   
    retCode   NUMBER;
BEGIN
    retCode :=
        logFileMgr.logInit (i_moduleName   => $$PLSQL_UNIT,
                            i_logCfgPath   => '/opt/oracle/admin/log/config',
                            i_logCfgFile   => 'logging.cfg');
    logFileMgr.writeLog (
        i_v_moduleName       => $$PLSQL_UNIT,
        i_n_moduleCodeLine   => $$PLSQL_LINE,
        i_n_loggingLevel     => logFileMgr.c_debug,
        i_v_messageText      => '# LogInit returncode: ' || retCode);
    logFileMgr.writeLog (i_v_moduleName       => $$PLSQL_UNIT,
                         i_n_moduleCodeLine   => $$PLSQL_LINE,
                         i_n_loggingLevel     => logFileMgr.c_info,
                         i_v_messageText      => '> Start Batch TestLog');
    logFileMgr.writeLog (i_v_moduleName       => $$PLSQL_UNIT,
                         i_n_moduleCodeLine   => $$PLSQL_LINE,
                         i_n_loggingLevel     => logFileMgr.c_alert,
                         i_v_messageText      => '+ This is an alert message');
    logFileMgr.writeLog (
        i_v_moduleName       => $$PLSQL_UNIT,
        i_n_moduleCodeLine   => $$PLSQL_LINE,
        i_n_loggingLevel     => logFileMgr.c_critical,
        i_v_messageText      => '+ This is a critical message');
    logFileMgr.writeLog (i_v_moduleName       => $$PLSQL_UNIT,
                         i_n_moduleCodeLine   => $$PLSQL_LINE,
                         i_n_loggingLevel     => logFileMgr.c_error,
                         i_v_messageText      => '! This is an error message',
                         i_n_dbErrorID        => -1412,
                         i_v_dbErrorText      => SQLERRM (-1412));
    logFileMgr.writeLog (
        i_v_moduleName       => $$PLSQL_UNIT,
        i_n_moduleCodeLine   => $$PLSQL_LINE,
        i_n_loggingLevel     => logFileMgr.c_warning,
        i_v_messageText      => '+ This is a warning message');
    logFileMgr.writeLog (i_v_moduleName       => $$PLSQL_UNIT,
                         i_n_moduleCodeLine   => $$PLSQL_LINE,
                         i_n_loggingLevel     => logFileMgr.c_notice,
                         i_v_messageText      => '+ This is a notice message');
    logFileMgr.writeLog (i_v_moduleName       => $$PLSQL_UNIT,
                         i_n_moduleCodeLine   => $$PLSQL_LINE,
                         i_n_loggingLevel     => logFileMgr.c_info,
                         i_v_messageText      => '+ This is an info message');
    logFileMgr.writeLog (i_v_moduleName       => $$PLSQL_UNIT,
                         i_n_moduleCodeLine   => $$PLSQL_LINE,
                         i_n_loggingLevel     => logFileMgr.c_debug,
                         i_v_messageText      => '+ This is a debug message');
    logFileMgr.writeLog (i_v_moduleName       => $$PLSQL_UNIT,
                         i_n_moduleCodeLine   => $$PLSQL_LINE,
                         i_n_loggingLevel     => logFileMgr.c_info,
                         i_v_messageText      => '< End Batch TestLog');
 EXCEPTION 
   WHEN OTHERS THEN
    logFileMgr.raiseError(i_v_moduleName       => $$PLSQL_UNIT,
                         i_n_moduleCodeLine   => $$PLSQL_LINE,
                         i_n_loggingLevel     => logFileMgr.c_error,
                         i_v_messageText      => '! This is an error message',
                         i_n_dbErrorID        => SQLCODE,
                         i_v_dbErrorText      => SQLERRM);                 
END testLog;
/
