其中combined是日志格式名字,主配置文件里定义了三种日志格式combined、common、combinedio。我们这里使用combined格式。
3.检查无误后重新加载配置文件:
[root@CentOS6 important]# apachectl -t
Syntax OK
[root@CentOS6 important]# apachectl graceful
4.在浏览器中多访问几次,就可以生成访问日志和错误日志(没有错误时为空)
[root@CentOS6 important]# cd /usr/local/apache2/logs/
[root@CentOS6 logs]# ls
access_log error_log
dummy-host.example.com-access_log httpd.pid
dummy-host.example.com-error_log
查看主配置文件中日志格式定义:
[root@CentOS6 important]# vim /usr/local/apache2/conf/httpd.conf
……
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio