Logging into a two different log file types in Codeigniter

I was looking for the same but couldn't find anything. I tweaked the code and it works fine. I have posted the same to CI forum http://forum.codeigniter.com/thread-25933.html

Have a look it probably will serve your purpose.


You can override the Log library with your own log class, specially override function write_log($level = 'error', $msg, $php_error = FALSE). You can see the original Log library code in the file system/libraries/Log.php. To create your own Log library, overriding default behaviour, read this page.

Create the file system/application/libraries/MY_Log.php:

class MY_Log extends CI_Log {

  function MY_Log()
  {
    parent::CI_Log();
  }
  //your code
  //...
  function write_log($level = 'error', $msg, $php_error = FALSE)
  {
  //...
  }
}