我的apache日志和php errorlog哪里去了?
授权方式:署名,非商业用途,保持一致,转载时请务必以超链接(http://www.fwolf.com/blog/post/189)的形式标明文章原始出处和作者信息及本声明。由于ubuntu改变了apache的conf文件布局,所以有些配置容易被漏掉。
默认情况下:apache.conf中只定义了apache的error文件:
ErrorLog /var/log/apache2/error.log
注意,没有access.log的指定,而是将其转移到了sites-enabled/000-default文件中:
LogLevel warn
CustomLog /var/log/apache2/access.log combined
可是在我们禁用000-default文件,自己编写配置文件的时候,就很容易忘记access.log文件的定义,因为在其他系统中这一项是默认就有的。
php的errorlog则更奇怪,由于我习惯把php的errorlog放在/var/log目录下,所以很快就发现了这一问题:当我把php的errorlog删除(让系统自动重新生成新的文件)之后,却怎么也都不会自动生成这个文件了,左查右找,却发现原本应该在php的errorlog中的错误信息却跑到了apache的error.log中。原来如果指定的php的errorlog文件不可写(/var/log目录权限要求较高),apache就会把php的errorlog信息写入apache的error.log文件中。新建一个空的php errorlog文件,更改属性为777之后,问题解决。属性更改为755都不行,不知道为什么这么多的操作都要求x权限作什么。
![[Bloglines]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/bloglines.png)
![[del.icio.us]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/delicious.png)
![[Digg]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/digg.png)
![[diigo]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/diigo.png)
![[Facebook]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/facebook.png)
![[Google]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/google.png)
![[MySpace]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/myspace.png)
![[Reddit]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/reddit.png)
![[Slashdot]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/slashdot.png)
![[Email]](http://www.fwolf.com/blog/wp-content/plugins/bookmarkify/email.png)