CI中的错误处理

时间:2012-11-02 08:37:23

标签: codeigniter logging

我看过Error Handling,但如果我使用log_message('debug', 'Hi I m in Cart Controller');log_message('info', 'Hi I m in Cart Controller');,则不会记录任何消息,但仅适用于log_message('error', 'Hi I m in Cart Controller');

知道我的错误是什么吗?

1 个答案:

答案 0 :(得分:2)

您必须在app/config/config.php中设置日志阈值:

/*
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
| If you have enabled error logging, you can set an error threshold to 
| determine what gets logged. Threshold options are:
| 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
|
| 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'] = 2;