创始人
- 成绩
- 16426
- 威望
- 11339
- 精华
- 3
- 粉丝
- 109
- 好友
- 155
- 注册时间
- 2018-1-30
- 最后登录
- 2024-4-25
- 在线时间
- 8944 小时
- 性别
- 男
|
双击phpstudy图标,其他选项菜单-打开文件位置-Apache
在弹出窗口打开conf文件夹下的vhosts.conf
在vhosts.conf里找到你要生成日志的网站,在</Directory>和</VirtualHost>这两行之间加入你要保存日志的路径,如下:
- <VirtualHost *:80>
- DocumentRoot "C:\WWW\网站1.com"
- ServerName www.网站1.com
- ServerAlias 网站1.com
- <Directory "C:\WWW\网站1.com">
- Options FollowSymLinks ExecCGI
- AllowOverride All
- Order allow,deny
- Allow from all
- Require all granted
- </Directory>
- ErrorLog C:/PhpStudy/PHPTutorial/Apache/logs/网站1.com/error.log
- CustomLog C:/PhpStudy/PHPTutorial/Apache/logs/网站1.com/access.log common
- </VirtualHost>
复制代码
如果想自动分割日志成每天1个文档,将12,13这两行改为:
- ErrorLog "|C:/PhpStudy/PHPTutorial/Apache/bin/rotatelogs.exe C:/PhpStudy/PHPTutorial/Apache/logs/网站1.com/error-%y%m%d.log 86400 480"
- CustomLog "|C:/PhpStudy/PHPTutorial/Apache/bin/rotatelogs.exe C:/PhpStudy/PHPTutorial/Apache/logs/网站1.com/access-%y%m%d.log 86400 480" common
复制代码
注意"|C:/PhpStudy/PHPTutorial/Apache/bin/rotatelogs.exe 换成你自己的rotatelogs.exe的绝对路径(不能是相对路径),在步骤1的Apache\bin文件夹下。开头的竖线不要漏了。
末尾的86400秒是一天,480是北京时间+8小时的意思。
这个rotatelogs.exe非常反人类啊,你稍微多几个站它就能给你开几十个黑窗口,无解的,占内存。但是你要是不分割,又很快就文件很大了,每次复制出来慢。自己取舍吧。 |
上一篇: common combined 两种日志记录格式下一篇: DiscuzX的目录权限设置
|