如何启用错误日志在Ubuntu阿帕奇 [英] How to enable error log in Ubuntu Apache

查看:149
本文介绍了如何启用错误日志在Ubuntu阿帕奇的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我哪有我的Ubuntu Apache服务器上启用错误日志,这样,如果发生任何错误是任何PHP语法和其他错误,服务器错误应该得到存储在错误日志文件

How can I enable error log on my Ubuntu Apache Server so that if any error occurs be it any PHP Syntax and other errors, server error should get stored in error log file

此外,我怎么可以查看Apache的错误日志文件?

Also how can I view apache error log file?

推荐答案

默认情况下, /var/log/apache2/error.log

这可在 /etc/php5/apache2/php.ini

您还可以定义一个特定的错误日志文件,为每个虚拟主机在Apache中。如果您有任何虚拟主机的定义的/ etc / apache2的/网站的可用/ 启用的/ etc / apache2的/启用的站点 - (启用 sudo的a2ensite [您的不同虚拟主机定义文件] ),您可以通过添加你的虚拟主机配置内以下行更改错误日志:

You can also define a specific error log file for each VirtualHost in Apache. If you have any VirtualHost defined in /etc/apache2/sites-available/ and enabled in /etc/apache2/sites-enabled (enable with sudo a2ensite [your-virtualhost-definition-file]), you can change the error log by adding the following line inside your VirtualHost config:

ErrorLog ${APACHE_LOG_DIR}/[your-vhost]-error.log

如果你有很多的虚拟主机,并要分割他们报告的错误,可能是有用的。

That might be useful if you have a lot of vhosts and want to split where they report the errors.

另外,你可以看你的错误日志直播通过发出以下命令(如果不同于默认适应自己的日志文件):

Also, you can watch your error log live by issuing the following command (adapt to your own log file if different from the default):

sudo tail -f /var/log/apache2/error.log

有关详细信息,请查看以下链接

For more information check out the following links

  • where-are-the-apache-and-php-log-files
  • HTTPD - Apache2 Web Server
  • how-to-configure-logging-and-log-rotation-in-apache-on-an-ubuntu-vps

这篇关于如何启用错误日志在Ubuntu阿帕奇的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆