I'm setting up Ruby on Rails for the first time; on my server, I've created and loaded the default rails app. I can view the default page ("Welcome aboard! You are riding Rails"), but when I go to click on the link to "View Application Environment", it generates a 500 error.
(You can view it here.)
I'd like to know more about the error, but, the log file ("log/production.log") is empty. Looking at my Apache log I find:
Rails Error: Unable to access log file. Please ensure that /var/www/rails/myapp/log/production.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.
So, I actually want to get my Ruby on Rails error logging working.
I know this problem has been posted a few times before, but I tried everything I could find, so here's what I have tried:
- Created the "log/production.log" file, set the owner to www-data, set
chmod 0666
. - Set the owner of the "log" folder to
www-data
, setchmod 0666
. - Double-checked my production environment settings such that
config.log_level = :info
is set. Checked that Apache is using the www-data user ("etc/apache2/envvars"):
export APACHE_RUN_USER=www-data export APACHE_RUN_GROUP=www-data
"etc/apache2/mods-available/passenger.conf" has a default user set for Passenger:
<IfModule mod_passenger.c> PassengerRoot /usr PassengerRuby /usr/bin/ruby PassengerDefaultUser www-data </IfModule>
The owner of "config.ru" and "configs/environment.rb" is
www-data
My virtual host has been set accordingly:
DocumentRoot /var/www/rails/myapp/public RackBaseURI / RackEnv production PassengerMaxPoolSize 4
Already read and attempted all the fixes suggested in these places:
- Rails: Unable to access log file
- Can't access log files in production
- http://railsforum.com/viewtopic.php?id=36168
- Why am I getting Permission denied error in deployment on files generated by capistrano?
- http://bradhe.wordpress.com/2011/06/26/a-sneaky-rails-3-bug-in-logging/
(That's all I can remember trying right now...)
Some environment settings of mine:
- Ubuntu 11.10 running on Amazon EC2
- Apache 2.2.20
- RVM 1.10.2
- Ruby 1.9.3p0
- Rails 3.1.3