我将我的项目从我的实际站点复制到本地系统,并以localhost身份运行。
在任何模块,如果有错误,那么我可以看到一个文件error_log在当前目录中的活动服务器中创build。
如何在本地系统中做同样的事情? 我应该添加什么选项,以便我可以在我的本地系统中创builderror_log
这些值应该已经被设置为Apache安装的默认值。 在configuration文件中查找/search“ErrorLog”,它应该给你存储日志的位置。 Apacheconfiguration文件存在的path取决于安装的版本和操作系统。
如果找不到该条目,则可以将其添加到configuration文件中,如:
ErrorLog "c:\apache\logs\site_error.log"
要么
ErrorLog "/home/user/logs/site_error.log"
如果将此行添加到configuration中(您不需要),请重新启动Apache以应用更改。
-Brendan
由于以下是涉及到我的问题,因为我使用这个我build议这种通过PHPlogging错误的替代方式。 我接受的答案是使用apache设置错误日志。
另一种使用phplogging错误的方法是使用php函数error_log
$elog = "\r\n[".date('dmY H:i:s',time())."] - [".$_SERVER['REMOTE_ADDR']."] - $string - in file $file in line $line"; error_log($elog, 0); error_log($elog, 3, docroot."/error_log.txt"); error_log($elog, 1, '[email protected]');
http://php.net/manual/en/function.error-log.php
检查将解释各种参数的用法的参数部分。