CodeIgniter Forums
Mail on error - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Mail on error (/showthread.php?tid=11659)



Mail on error - El Forum - 09-18-2008

[eluser]FinalFrag[/eluser]
Hi all,

I want to extend the error reporting class to send me an e-mail when an error happens. I think I would have to create a class MY_Log to extend the CI_Log class. I have the following code in MY_Log:

Code:
<?
if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class MY_Log extends CI_Log {
    function MY_Log() {
        parent::CI_Log();
    }
    
    function write_log() {
        parent::write_log();
        mail('[email protected]', 'err', 'err');
    }
}
?>

This doesn't seem to work. Could anyone explain to me why?

I also altered my autoload.php to automaticly load the Log class (but I'm not sure if this is really necessary)...

I'm really confused to which class I have to extend and which functions to overwrite as it seems like there is a global function 'error_log' and a function 'write_log' in the Log class. Which one should I extend?

Hope anyone can help me out on this one...

Thnx in advance, FinalFrag


Mail on error - El Forum - 09-19-2008

[eluser]FinalFrag[/eluser]
*bump* c'mon people, help me out here...


Mail on error - El Forum - 09-19-2008

[eluser]yelirekim[/eluser]
did you set the log_threshold in config.php? it won't even try to log things in the first place if you don't have it set to something besides zero.


Mail on error - El Forum - 10-08-2008

[eluser]dobbler[/eluser]
Any luck with this? I need to set up the same thing..