首先,停止Apache服務,並刪除Apache下/logs/目錄中的error.log和access.log文件。
然後,打開Apache的conf/httpd.conf設定檔並找到下兩條配置:
ErrorLog
logs/error.log
CustomLog logs/access.log common
CustomLog logs/access.log common
直接在前面加#注釋掉,換成下面的設定檔。
錯誤日誌檔error.log
# 限制錯誤日誌檔為 1M
ErrorLog "|bin/rotatelogs.exe -l logs/error-%Y-%m-%d.log 1M”
ErrorLog "|bin/rotatelogs.exe -l logs/error-%Y-%m-%d.log 1M”
或者
# 每天生成一個錯誤日誌檔
ErrorLog "|bin/rotatelogs.exe -l logs/error-%Y-%m-%d.log 86400"
ErrorLog "|bin/rotatelogs.exe -l logs/error-%Y-%m-%d.log 86400"
日誌檔access.log
# 限制訪問日誌檔為 1M
CustomLog "|bin/rotatelogs.exe -l logs/access-%Y-%m-%d.log 1M” common
CustomLog "|bin/rotatelogs.exe -l logs/access-%Y-%m-%d.log 1M” common
或者
# 每天生成一個訪問日誌檔
CustomLog "|bin/rotatelogs.exe -l logs/access-%Y-%m-%d.log 86400" common
CustomLog "|bin/rotatelogs.exe -l logs/access-%Y-%m-%d.log 86400" common
沒有留言:
張貼留言