Rails Error: Unable to access log file... in Apache error log file

Hi,

My Rails Depot app is working fine using WEBrick server but with Apache2, the app is having problems with writing to the development.log file. When using WEBrick, the development.log shows the logging consistently, but when using Apache2, nothing shows in the development.log file. On checking the Apache error log, I get this:

[Sat Nov 25 10:24:38 2006] [error] [client 127.0.0.1] Rails Error: Unable to access log file. Please ensure that /srv/www/htdocs/depot/../config/../log/development.log exists and is chmod 0666. The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.

I am a newbie to RoR and Linux as well (about 3 weeks). I have performed "chown, and chgrp and chmod" on the log directory and "ls -l /srv/www/rails/depot/log" produced the following: -rw-rw-rw- 1 wwwrun www 442996 2006-11-23 17:37 development.log -rw-rw-rw- 1 wwwrun www 0 2006-11-20 22:34 production.log -rw-rw-rw- 1 wwwrun www 0 2006-11-20 22:34 server.log -rw-rw-rw- 1 wwwrun www 0 2006-11-20 22:34 test.log

What am I missing here?

Cheers, Leng

Hi Leng, the webrick server may have an exclusive lock on the development.log file. Also, you cannot change the file’s permission to gain write access to a file that has a exclusive lock. My recommendation would be to allow Apache and Webrick to write to their own respective log files because it makes it easier to debug the application in question.

Good luck,

-Conrad