未写入Apache错误日志的错误

时间:2013-12-10 02:47:59

标签: php apache error-logging

我遇到了一些Apache Web服务器错误日志的问题。

我的计算机上有一个虚拟托管的网站scotthermmann.loc。手动清除错误日志后,使用

sudo cat /dev/null > scotthermmann.loc-error_log

或在emacs&中打开文件删除所有内容,错误不再记录到文件中。我尝试过使用

sudo apachectl restart

解决问题,但它没有解决它。退出&回来也没有解决它。解决它的原因是重新启动计算机,但每次清除错误日志后我都不想这样做。

我托管的每个网站都不是这种情况。我有另一个网站barefootfool.loc。在我清除错误日志后,我没有任何问题。

两个虚拟站点在httpd-vhosts.conf文件中具有基本相同的设置。对于scottherrmann.loc:

<VirtualHost *:80>
    DocumentRoot "/Users/dan/Sites/scottherrmann.com"
    ServerName scottherrmann.loc
    ServerAlias www.scottherrmann.loc
    ErrorLog "/private/var/log/apache2/scottherrmann.loc-error_log"
    CustomLog "/private/var/log/apache2/scottherrmann.loc-access_log"

    <Directory "/Users/dan/Sites/scottherrmann.com">
        Options Indexes FollowSymLinks
        AllowOverride All
        Order Allow,Deny
        Allow from all 
    </Directory>
</VirtualHost>

对于barefootfool.loc:

<VirtualHost *:80>
    DocumentRoot "/Users/dan/Sites/barefootfool.com"
    ServerName barefootfool.loc
    ServerAlias www.barefootfool.loc
    ErrorLog "/private/var/log/apache2/barefootfool.loc-error_log"
    CustomLog "/private/var/log/apache2/barefootfool.loc-access_log"

    <Directory "/Users/dan/Sites/barefootfool.com">
        Options Indexes FollowSymLinks
        AllowOverride All
        Order Allow,Deny
        Allow from all 
    </Directory>
</VirtualHost>

有没有人知道可能导致问题的原因是什么?

2 个答案:

答案 0 :(得分:5)

我刚才这是因为我不小心删除了/ var / log / httpd / error_log文件,然后触及了一个新的日志文件。

service httpd restart

解决了这个问题。下次我用

截断error_log
:>error_log

答案 1 :(得分:0)

可能是因为您使用用户apachectl运行tomcat,当您使用命令sudo cat /dev/null > scotthermmann.loc-error_log清除日志文件时,执行此命令的用户获取文件的所有权,然后是用户{ {1}}不能再写了。尝试运行cleanup命令:

apachectl
相关问题