Question

It is possible to make the Code Igniter write into one file ? Instead of many files:

admn@comp:~$ ll application/logs/
total 22916
drwxr-xr-x  2 admn www-data    4096 Feb 12 23:43 ./
drwxr-xr-x 15 admn www-data    4096 Feb 12 23:43 ../
-rwxr-xr-x  1 admn www-data     114 Feb 12 23:43 index.html*
-rwxr-xr-x  1 admn www-data  123984 Feb 12 23:43 log-2013-11-26.php*
-rwxr-xr-x  1 admn www-data   18051 Feb 12 23:43 log-2013-11-27.php*
-rwxr-xr-x  1 admn www-data   79681 Feb 12 23:43 log-2013-11-28.php*
-rwxr-xr-x  1 admn www-data  629424 Feb 12 23:43 log-2013-12-01.php*
-rwxr-xr-x  1 admn www-data  201280 Feb 12 23:43 log-2013-12-03.php*
-rwxr-xr-x  1 admn www-data  133149 Feb 12 23:43 log-2013-12-07.php*

This should for using logrotate in debian/ubuntu for rotate application log. Thank you!

Was it helpful?

Solution

create your own MY_Log class, i.e. application/libraries/MY_Log.php

you can then extend the log class and write your own custom function:

class MY_Log extends CI_Log  {
  public function writeMyLog($entry)
  {
    // do whatever you want
  }
}

then use your own function to write instead of the built in codeigniter one.

or you can overwrite the write_log function which is CI's default method, by defining your own method in this class.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top