PHP Codeigniter框架中的错误日志

时间:2011-08-24 10:10:36

标签: php codeigniter

我目前正在使用Codeigniter作为我的默认框架来创建一些我的项目。但是,当我在我的服务器上上传项目时,3天后,我的服务器中的错误日志已超过1 MB。如何忽略此错误日志?错误日志是由我的服务器或codeigniter本身引起的吗?

非常感谢您的帮助。

1 个答案:

答案 0 :(得分:6)

假设这是您所指的 Codeigniter 错误记录,请检查config.php log_threshold设置并将其设置为0以禁用错误记录:

/*
|--------------------------------------------------------------------------
| 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'] = 0;

我通常将其设置为1,至少在开发过程中。如果您确实启用了错误日志记录,则应该读取错误日志并在可能的情况下更正错误,否则这是毫无意义的。