Organizational Research By

Surprising Reserch Topic

error logging in CodeIgniter (PHP)

  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?

asked Jun 2, 2015 in codeinither by rajesh
0 votes

Related Hot Questions

1 Answer

0 votes

CodeIgniter has some error logging functions built in.

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(). You can do this yourself or use this. More info on extending the core here

answered Jun 2, 2015 by rajesh