Windows 中打开httpd.conf配置文件找到:
CustomLog "logs/access.log" common
ErrorLog “error_log”
将其改为:
CustomLog "|bin/rotatelogs.exe logs/%Y_%m_%d_access.log 86400 480" common
ErrorLog "|bin/rotatelogs.exe logs/%Y_%m_%d_error.log 86400 480"
Linux系统中
vi /etc/httpd/conf/httpd.conf #编辑文件
#ErrorLog logs/error_log #注释此行,添加下面这行
ErrorLog "|rotatelogs /var/log/httpd/error_log%Y%m%d.log 86400 480" #每天单独生成一个日志文件
#CustomLog logs/access_log common #注释此行,添加下面这行
CustomLog "|rotatelogs /var/log/httpd/access_log%Y%m%d.log 86400 480" common #每天单独生成一个日志文件