2012-06-25 61 views
0

我在VPS服务器上运行Debian,并将开发和生产代码和数据库都放在同一台服务器上。Apache错误日志:仅记录服务器的一部分

是否有可能让服务器只记录服务器开发部分的错误,而不是生产。现在,从生产方面记录的错误非常多,这使得很难发现错误。

+2

你可以更改每个目录或每个文件的日志设置 – 2012-06-25 20:28:01

+1

我会投票选择2个日志位置,而不是生产日志,或者你真的想在某些生产环节中丢失数百个客户 - 在事实之后没有任何知识究竟发生了什么? – Wrikken

回答

3

虽然这确实属于对serverfault.com:

你一定要始终记录所有的错误。

如果您在服务器example.com和test.example.com上托管示例2域,则可以为每个虚拟主机指定要存储日志的位置。

在Apache虚拟主机可能看起来像:

<VirtualHost xxx.xxx.xxx.xxx:80> 
    // some configuration stuff 
    ServerName  example.com 
    // some more configuration stuff 
    CustomLog  /var/log/httpd/example.com-access_log combined 
    ErrorLog  /var/log/httpd/example.com-error_log 
</VirtualHost> 

<VirtualHost xxx.xxx.xxx.xxx:80> 
    // some configuration stuff 
    ServerName  test.example.com 
    // some more configuration stuff 
    CustomLog  /var/log/httpd/test.example.com-access_log combined 
    ErrorLog  /var/log/httpd/test.example.com-error_log 
</VirtualHost> 

所以你可以很容易区分example.com日志test.example.com信息。