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 文件
来源: http://www.bubuko.com/infodetail-2805284.html