I've following settings in php.ini-
error_reporting = E_ALL | E_NOTICE | E_STRICT|E_WARNING
display_errors = Off
log_errors = On
error_log = "/var/log/php_errors.log"
And config.php in CodeIgniter-
$config['log_threshold'] = 1;
$config['log_path'] = getcwd() . '/' . SYSDIR . '/logs/';
In the Index.php file-
case 'development':
error_reporting(E_ALL);
break;
case 'testing':
case 'production':
error_reporting(0);
When it's "development" in Index.php, i see warnings, and error messages also on webpage, PHP Fatal error, PHP Parse error in php_errors.log file. But if I make it "Production", no error/warnings are not displayed nor logged in the file. How do I log all errors and messages without displaying?
(Just to mention here- The folder application/logs/ is 777 and there all I have is index.html that has "403 Forbidden" written in it. )
Different environment will require different levels of error reporting. By default, development mode will display errors and testing and live mode will hide them. CodeIgniter provides three functions as shown below to handle errors. show_error() function displays errors in HTML format at the top of the screen.
No need to type a long query to disable error reporting in codeigniter. Use error_reporting(0); in the page to disable displaying errors in that page.
Please check your config/config.php file and check your settings
$config['log_threshold'] = 4;
**Note :**
0 = Disables logging, Error logging TURNED OFF
1 = Error Messages (including PHP errors)
2 = Debug Messages
3 = Informational Messages
4 = All Messages
I'm not completely sure, but I think you are mixing two things together.
error_reporting in php settings shows you errors created during php script execution. If you use "desplay_errors" = Off. PHP won't show any of those errors. You have turned on log_errors and setup a folder. So PHP error will get to the /var/log/php_errors.log file.
On the other hand CodeIgniter uses function:
log_message('level,'message')
which serves for storing errors/debug/info into log files. If you call
log_message('error','I'm an error!')
somewhere in your code, you really should have a new log file in log directory.
Internaly CodeIgniter uses log_message() if there are any PHP errors. I'm really not sure how it will behave while display_error is set to Off (he will think that there was no error?).
Try calling your own log_message and turn display_errors to On. I think that it should help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With