Codeigniter error log not including file name Codeigniter error log not including file name codeigniter codeigniter

Codeigniter error log not including file name


No, currently there isn't a built-in way to do this in CodeIgniter.

What you can do is to extend the core CI_Log class, override its write_log() method and use debug_backtrace() to get the appropriate file name and prepend it to the message.

// application/core/MY_Log.phpclass MY_Log extends CI_Log {    public function write_log($level, $msg)    {        foreach (debug_backtrace() as $call)        {            // Somehow find the appropriate call here ...            if ( ! (/* condition to ignore error-handling calls */))            {                break;            }            $msg = '['.$call['file'].'] '.$msg;            break;        }        return parent::write_log($level, $msg);    }}