禁用Codeigniter日志记录并允许本机PHP日志记录
我正在运行Codeigniter 2.1.4,据我所知,Codeigniter正在拦截PHP错误消息并将其存储在禁用Codeigniter日志记录并允许本机PHP日志记录,php,codeigniter,logging,error-handling,Php,Codeigniter,Logging,Error Handling,我正在运行Codeigniter 2.1.4,据我所知,Codeigniter正在拦截PHP错误消息并将其存储在/application/logs 我想禁用CodeIgniter日志记录,只允许使用本机PHP错误日志 以前有人这样做过吗?on/application/config.php 检查$config['log_threshold']=0 /* |------------------------------------------------------------------------
/application/logs
我想禁用CodeIgniter日志记录,只允许使用本机PHP错误日志
以前有人这样做过吗?on/application/config.php
检查$config['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;
查看主codeigniter index.php文件的顶部 定义环境的方法多种多样,但您可以在该索引页上定义它。你想要的是“生产”
// comment this line out
//define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');
// put in this line
define('ENVIRONMENT', 'production');
您将在代码中看到codeigniter也适用于您的php版本。
或者你可以在代码的那一部分下粘贴这个
ini_set('display_errors', 0);
在显示错误和不显示错误之间切换的更快更慢的方式
==编辑
这篇文章是对你的评论的回复:
这是一个很好的信息,但不幸的是,CI似乎仍然存在 拦截“通知”级别的消息并将其输出到 浏览器
因此,上面的说明控制是否将错误消息发送到浏览器。否则,就codeigniter“记录”错误而言,您可以在application/config中关闭codeigniter日志记录,并执行您想要的任何类型的日志记录 这是很好的信息,但不幸的是,CI似乎仍在拦截“通知”级别的消息,并将其输出到浏览器。这些都不会记录在CI日志或PHP日志中。我发现如果我注释掉行“72-
set#u error_handler”(“u exception_handler”)然后我得到了所需的结果。但我不想弄乱核心:/所以这应该是为了让CodeIgniter停止截取我想要转到PHP本机日志文件的日志条目?