Oracle中pls_logger记录日志信息

/*
 参数说明:
 pi_program_name    程序名称
 pi_directory        写入日志文件所在的目录
 pi_file            日志文件名称,必须存在
 pi_log_level        日记级别,INFO、WARN、FATAL
 pi_write_to        写到哪里,SCREEN、FILE、TABLE、ALL
 pi_error_message   写入到日志的错误信息
 
  pi_status            输出参数 1失败 0成功
*/
BEGIN
    pls_logger  ( pi_program_name   => 'SCREEN_PROGRAM_ERROR'
                , pi_log_level      => 'INFO'
                , pi_write_to       => 'SCREEN'
                , pi_error_message  => 'This execution writes to SCREEN.'
                );

    pls_logger  ( pi_program_name   => 'WARN_PROGRAM_ERROR'
                , pi_log_level      => 'WARN'
                , pi_write_to       => 'TABLE'
                , pi_error_message  => 'This execution writes to TABLE.'
                );
                
    pls_logger  ( pi_program_name     => 'FATAL_PROGRAM_ERROR'
                , pi_log_level        => 'FATAL'
                , pi_write_to         => 'FILE'
                , pi_error_message    => 'This execution writes to FILE.'
                , pi_file             => 'my_logfile.txt'
                );
                
    pls_logger  ( pi_program_name   => 'FATAL_PROGRAM_ERROR'
                , pi_log_level      => 'FATAL'
                , pi_write_to       => 'ALL'
                , pi_error_message  => 'This execution writes to ALL.'
                , pi_file           => 'my_logfile.txt'
                );
END;
/

 

posted on 2014-06-07 15:44  Sunny_NUAA  阅读(371)  评论(0编辑  收藏  举报

导航