Codeigniter错误日志

正式上线的网站通常会禁用错误报告,如果需要调试,可以通过向日志文件写入错误信息的方式。

  • 设置 application/config/config.php 文件中的 “threshold” 参数
  • application/logs/ 目录必须设置为可写的
  • 代码如下:
if ($some_var == '')
{
    log_message('error', 'Some variable did not contain a value.');
}
else
{
    log_message('debug', 'Some variable was correctly set');
}

log_message('info', 'The purpose of some variable is to provide some value.');

264 total views, 4 views today

Revisions

There are no revisions for this post.

No comments yet.

发表评论