apache [ httpd.conf ]配置文件
#ErrorLog "logs/error.log"
ErrorLog "|bin/rotatelogs.exe -l logs/error-%Y-%m-%d.log 2M"
Windows下虚拟主机的日志切割
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "D:/wamp/www" ServerName localhost ErrorLog "logs/localhost-error.log" CustomLog "logs/localhost-access.log" common </VirtualHost>
更改后
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "D:/wamp/www" ServerName localhost ErrorLog "|bin/rotatelogs.exe -l logs/localhost-error-%Y-%m.log 86400" # 86400 可改为 2M CustomLog "|bin/rotatelogs.exe -l logs/localhost-access-%Y-%m.log" common </VirtualHost>
或者使用下面这种
在apache的配置文件中找到 ErrorLog logs/error_log CustomLog logs/access_log common Linux系统配置方法: 将其改为 ErrorLog "| /usr/local/apache/bin/rotatelogs /home/logs/www/%Y_%m_%d_error_log 86400 480" CustomLog "| /usr/local/apache/bin/rotatelogs /home/logs/www/%Y_%m_%d_access_log 86400 480" common Windows系统下配置方法: #ErrorLog "|bin/rotatelogs.exe logs/vicp_net_error-%y%m%d.log 86400 480" #CustomLog "|bin/rotatelogs.exe logs/vicp_net_access-%y%m%d.log 86400 480" common 第一次不知道设置480这个参数,导致日志记录时间和服务器时间相差8小时,原来是rotatelogs有一个offset参数,表示相对于UTC的时差分钟数,中国是第八时区,相差480分钟。86400是表示1天。
原文地址:https://www.cnblogs.com/xuey/p/8412569.html
时间: 2024-10-15 02:50:58