1. 程式人生 > >php CI框架log寫入

php CI框架log寫入

min arr php文件 mine pes php ci ESS out live

1.首先,打開application下的config.php文件,將log配置打開如下

/*
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
| You can enable error logging by setting a threshold over zero. The
| threshold determines what gets logged. Threshold options are:
|
|    0 = Disables logging, Error logging TURNED OFF
|    1 = Error Messages (including PHP errors)
|    2 = Debug Messages
|    3 = Informational Messages
|    4 = All Messages
|
| You can also pass an array with threshold levels to show individual error types
|
|     array(2) = Debug Messages, without Error Messages
|
| For a live site you‘ll usually only enable Errors (1) to be logged otherwise
| your log files will fill up very fast.
|
*/ $config[‘log_threshold‘] = 4;

2.在控制器裏面輸入,並在瀏覽器打開該控制器

    public function get_payee_summary()
    {    
        log_message(‘info‘,‘log_test:log測試‘);
    }    

3.最後就能在application下的logs文件夾裏面開到最近生成的log文件

php CI框架log寫入