I’m trying to extend the CodeIgniter log library with a bit of additional information that I load from the “Session” library. This appears to be possible according to the information here:
http://codeigniter.com/user_guide/general/creating_libraries.html
So, I created a file in application/libraries called MY_Log.php with the following:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Log extends CI_Log {
function __construct() {
parent::__construct();
$CI =& get_instance();
$CI->load->library('session');
}
}
?>
The trouble is, whenever I call get_instance from within this file, I get a “500 Internal Server Error”. I tried swapping out my codeigniter system directory with a fresh copy of the latest version (2.1.2), but I get the same error. What am I doing wrong?
Thanks in advance.
The CI_Log library doesn’t exist anymore – this in turn also means that the file
MY_Log.phpinside thecorefolder will not automatically load anymore.This means you should remove the extension of the former class and implement the needed features in your library.
For futere reference, when you get a 500 server error, you can check the error log on your server. It will most likely tell you what is wrong.