Welcome Guest, Not a member yet? Register   Sign In
Send error log to email
#4

(This post was last modified: 03-20-2015, 01:09 AM by GeorgeD.)

In system/core/Log.php, in function write_log, before last return ( return is_int($result); ). I have written the next code:
PHP Code:
$ci =& get_instance();
$ci->load->library('email');

$config['protocol']     = 'smtp';
$config['smtp_host']     = '';
$config['smtp_user']     = '';
$config['smtp_pass']     = '';
$config['smtp_port']     = '25';
$config['mailtype']     = 'html';
$config['wordwrap']     = TRUE;
$config['charset']         = 'utf-8';

$ci->email->initialize($config);

$ci->email->from('''');
$ci->email->to('');
$ci->email->subject('Error on project ');
$ci->email->message($message);

$ci->email->send(); 
I also put an condition for not sending 404 error on mail.

On the begining of project it works, now it doesn't and I didn't changed anything on system folder. 

For line ( $ci->load->library('email'); ) I get:
PHP Code:
NoticeTrying to get property of non-object in system\core\Log.php on line 236

Fatal error
Call to a member function library() on a non-object in system\core\Log.php on line 236 
I checked $ci and is NULL.

Offtopic: I like that CodeIgniter is very simple, fast and easy. But I think that a feature for sending error to email, should get in consideration. I implemented this on every projects, because I want to know in real time if something went wrong with one of my projects. If you have minimum 2 projects is very usefull.
Reply


Messages In This Thread
Send error log to email - by GeorgeD - 03-19-2015, 04:06 AM
RE: Send error log to email - by Avenirer - 03-19-2015, 05:52 AM
RE: Send error log to email - by rfulcher - 03-19-2015, 03:26 PM
RE: Send error log to email - by GeorgeD - 03-20-2015, 01:06 AM
RE: Send error log to email - by ivantcholakov - 03-20-2015, 03:34 AM
RE: Send error log to email - by GeorgeD - 03-20-2015, 04:54 AM
RE: Send error log to email - by CroNiX - 03-20-2015, 09:53 AM
RE: Send error log to email - by GeorgeD - 03-20-2015, 09:58 AM
RE: Send error log to email - by jeffjones72 - 02-11-2022, 02:17 PM



Theme © iAndrew 2016 - Forum software by © MyBB