Welcome Guest, Not a member yet? Register   Sign In
DB Errors log
#1

[eluser]gon[/eluser]
Hi,

How do you guys keep a log of possible failed queries?
When setting db_debug to true, they get logged, but an error screen is also shown.
Also, tables get locked when using transactions.


So what I do is modify the display_error function, on DB_driver.php:

Code:
function display_error($error = '', $swap = '', $native = FALSE)
    {
        return false;


//        $LANG = new CI_Lang();
        $LANG = new CI_Language();
        $LANG->load('db');

        $heading = 'Database Error';
        
        if ($native == TRUE)
        {
            $message = $error;
        }
        else
        {
            $message = ( ! is_array($error)) ? array(str_replace('%s', $swap, $LANG->line($error))) : $error;
        }

        if ( ! class_exists('CI_Exceptions'))
        {
//            include(BASEPATH.'core/Exceptions'.EXT);
            include(BASEPATH.'libraries/Exceptions'.EXT);
        }
        
        $error = new CI_Exceptions();
        echo $error->show_error('An Error Was Encountered', $message, 'error_db');
        exit;
    }

Is there another way to do this without touching inside CI?

I would suggest to add a different database config param for logging and displaying errors.

Regards.


Messages In This Thread
DB Errors log - by El Forum - 02-25-2008, 08:40 AM
DB Errors log - by El Forum - 02-27-2008, 06:28 PM
DB Errors log - by El Forum - 02-29-2008, 06:37 AM
DB Errors log - by El Forum - 02-29-2008, 06:46 AM



Theme © iAndrew 2016 - Forum software by © MyBB