[eluser]Chad Fulton[/eluser]
There are two solutions I see:
1. Disable CodeIgniter error handling system. I suspect that's not what you really want, however, since you're probably just interested in the log files. However, if you do want this, then you should comment out line 59 in system/codeigniter/CodeIgniter.php:
Code:
//set_error_handler('_exception_handler');
That would of course remove ALL of CodeIgniter's error handling. This is the solution that requires least customization, however.
2. Secondly, I suggest that rather than customizing CI_Log, you should customize CI_Exception class. In particular, you could override the log_exception function so that it called the native PHP function error_log, which would write to the apache error log as you want:
Code:
class MY_Exceptions extends CI_Exceptions {
function log_exception($severity, $message, $filepath, $line) {
$severity = ( ! isset($this->levels[$severity])) ? $severity : $this->levels[$severity];
error_log(sprintf("PHP %s: %s in %s on line %d", $severity, $message, $filepath, $line));
parent::log_exception($severity, $message, $filepath, $line);
}
}
That will do what you want, by mimicking the PHP error logging format, and logging the error using the native PHP function.