title: Ruby on Rails Setup: Unable to access log file
body: <p>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.</p>
  
  <p>(You can view it <a href="http://test.delner.com" rel="nofollow noreferrer">here</a>.)</p>
  
  <p>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:</p>
  
  <blockquote>
    <p>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.</p>
  </blockquote>
  
  <p>So, I actually want to get my Ruby on Rails error logging working.</p>
  
  <p>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:</p>
  
  <ol>
  <li>Created the "log/production.log" file, set the owner to www-data, set <code>chmod 0666</code>.</li>
  <li>Set the owner of the "log" folder to <code>www-data</code>, set <code>chmod 0666</code>.</li>
  <li>Double-checked my production environment settings such that <code>config.log_level = :info</code> is set.</li>
  <li><p>Checked that Apache is using the www-data user ("etc/apache2/envvars"):</p>
  
  <pre><code>export APACHE_RUN_USER=www-data
  export APACHE_RUN_GROUP=www-data
  </code></pre></li>
  <li><p>"etc/apache2/mods-available/passenger.conf" has a default user set for Passenger:</p>
  
  <pre><code>&lt;IfModule mod_passenger.c&gt;
    PassengerRoot /usr
    PassengerRuby /usr/bin/ruby
    PassengerDefaultUser www-data
  &lt;/IfModule&gt;
  </code></pre></li>
  <li><p>The owner of "config.ru" and "configs/environment.rb" is <code>www-data</code></p></li>
  <li><p>My virtual host has been set accordingly:</p>
  
  <pre><code>DocumentRoot /var/www/rails/myapp/public
  RackBaseURI /
  RackEnv production
  PassengerMaxPoolSize 4
  </code></pre></li>
  </ol>
  
  <p>Already read and attempted all the fixes suggested in these places:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/632592/rails-unable-to-access-log-file">Rails: Unable to access log file</a></li>
  <li><a href="https://stackoverflow.com/questions/2469059/cant-access-log-files-in-production">Can&#39;t access log files in production</a></li>
  <li><a href="http://railsforum.com/viewtopic.php?id=36168" rel="nofollow noreferrer">http://railsforum.com/viewtopic.php?id=36168</a></li>
  <li><a href="https://stackoverflow.com/questions/8433569/why-am-i-getting-permission-denied-error-in-deployment-on-files-generated-by-cap">Why am I getting Permission denied error in deployment on files generated by capistrano?</a></li>
  <li><a href="http://bradhe.wordpress.com/2011/06/26/a-sneaky-rails-3-bug-in-logging/" rel="nofollow noreferrer">http://bradhe.wordpress.com/2011/06/26/a-sneaky-rails-3-bug-in-logging/</a></li>
  </ul>
  
  <p>(That's all I can remember trying right now...)</p>
  
  <p>Some environment settings of mine:</p>
  
  <ul>
  <li>Ubuntu 11.10 running on Amazon EC2</li>
  <li>Apache 2.2.20</li>
  <li>RVM 1.10.2</li>
  <li>Ruby 1.9.3p0</li>
  <li>Rails 3.1.3</li>
  </ul>