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) { //... }}
Is it possible in CI (natively) to log into two different files from two different controllers?
No, it isn't. Log file names are pretty much hard coded. See system/libraries/Log.php
Is there any 3rd party logging library available for CI?
That I don't know, but assuming you come empty-handed from Google, I would either ask on the CodeIgniter forums, create your own logging library, or extend the existing one. Instructions