Apache2决定忽略ErrorLog位置。 怎么修?

我的apache2.conf文件中包含了ErrorLog /var/www/logs/error_logCustomLog /var/www/logs/access_log common 。 但是,我只有服务器关机/重新启动通知。 所有其他日志被发送到原始位置( /var/log/apache2 )。 我花了一天时间在盲人debugging,直到我解决了这个问题。 如何将所有日志发送到我想要的地方?

(压缩的) apache2.conf文件与此类似(不包含模块和目录):

 LockFile ${APACHE_LOCK_DIR}/accept.lock PidFile ${APACHE_PID_FILE} Timeout 300 KeepAlive On MaxKeepAliveRequests 100 KeepAliveTimeout 5 User ${APACHE_RUN_USER} Group ${APACHE_RUN_GROUP} AccessFileName .htaccess DefaultType None HostnameLookups Off ErrorLog /var/www/logs/error_log LogLevel debug Include mods-enabled/*.load Include mods-enabled/*.conf Include httpd.conf Include ports.conf LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%h %l %u %t \"%r\" %>s %O" common LogFormat "%{Referer}i -> %U" referer LogFormat "%{User-agent}i" agent CustomLog /var/www/logs/access_log common Include conf.d/ Include sites-enabled/ ServerName 158.132.10.185 ServerRoot /var/www DocumentRoot /var/www AddType application/x-httpd-cgi .cgi ... 

你是什​​么意思的所有其他日志? 您可能已经定义了一些虚拟主机,而这些其他日志属于它们。 因此,您应该在相应的VirtualHostconfiguration部分中,为每个虚拟主机设置日志文件位置。