CodeIgniter Forums
How to do error logging in CodeIgniter (PHP) - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: How to do error logging in CodeIgniter (PHP) (/showthread.php?tid=70648)



How to do error logging in CodeIgniter (PHP) - nathanjame - 05-08-2018

I want error logging in PHP CodeIgniter. How do I enable error logging?
I have some questions:
  1. What are all the steps to log an error?

  2. How is an error log file created?

  3. How to push the error message into log file (whenever an error occurs)?

  4. How do you e-mail that error to an email address?



RE: How to do error logging in CodeIgniter (PHP) - InsiteFX - 05-08-2018

SEE: Below Link.

Codeigniter: Exception/Error Logging


RE: How to do error logging in CodeIgniter (PHP) - dave friend - 05-08-2018

There is a built-in function to log errors called log_message Read about it HERE.

There is additional information about error handling on that page.
There is not any built-in mechanism to email logged errors though.


RE: How to do error logging in CodeIgniter (PHP) - adamparker1 - 02-06-2021

CodeIgniter has some error logging functions built-in. CodeIgniter error logging is mostly relatable to php error logging if you want to create it through code.

Make your /application/logs folder writable
In /application/config/config.php set
$config['log_threshold'] = 1;
or use a higher number, depending on how much detail you want in your logs
Use log_message('error', 'Some variable did not contain a value.');
To send an email you need to extend the core CI_Exceptions class method log_exceptions().