php CI框架log写入

Posted 风雨无阻

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php CI框架log写入相关的知识,希望对你有一定的参考价值。

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写入的主要内容,如果未能解决你的问题,请参考以下文章

linux crontab定时任务调用CI框架PHP代码

CI框架中,扩展验证码类。

CI框架 -- 核心文件 之 Lang.php(加载语言包)

php CI框架输出空行问题排查

CI框架 -- CLI执行php代码

CI框架源代码阅读笔记2 一切的入口 index.php