升级到CodeIgniter 2.0,但现在我的php错误没有出现在日志中,我该怎么办?

OK, so I wrote an app using CodeIgniter 1.7.3 and everything was dandy.

then i moved to CodeIgniter 2.0 and it all works fine, except now it doesn't display errors in my php_error.log

so for example if i had a typo in a method name, I used to get something like:

[04-Feb-2011 16:20:01] PHP Fatal error: Call to undefined method Some_controller::my_method() in /Applications/MAMP/htdocs/application/controllers/some_controller.php on line 61

now i get nothing. just the 500 servlet exception in my browser window.

So far ive checked my php.ini which has error_reporting = E_ALL and log_errors = On also display_errors = On (even though i think this logs to the screen no the file)

i just tried an intentional broken non-codeigniter php file and I do get an error in my log like:

[10-Mar-2011 02:47:02] PHP Fatal error: Call to undefined function fake_method() in /Applications/MAMP/htdocs/test.php on line 2

so it appears to only be codeigniter which doesnt log.

my config/config.php has logging set like this: $config['log_threshold'] = 4;

also index.php has error_reporting(E_ALL);

Its such a pain to debug when I dont get line numbers... Can anyone else tell me what else I should change/check to get my logging back?

so I discovered that I had auto-loaded a library (paypal_lib) which for some reason had error_reporting(0) at the top of it.

Try to set ini_set('display_erros',1);

Make sure your index.php has error reporting set to ALL

error_reporting(E_ALL);

For showing errors in logs, check your config at line 181. If you set it to $config['log_threshold'] = 4;

this will log everything...

Might also be worth noting that if you have environments defined but don't use them, in 'production' and 'testing' error_reporting(0) is set. See index.php line 31 onward:

if (defined('ENVIRONMENT')) {
switch (ENVIRONMENT)
{
    case 'development':
        error_reporting(E_ALL);
    break;

    case 'testing':
    case 'production':
        error_reporting(0);
    break;

    default:
        exit('The application environment is not set correctly.');
}
}