4

I've deployed a ruby on rails 4.0.3 application to a server that I've configured with the following likely relevant software:

  • Ubuntu 12.04.4 x64 server
  • Phusion Passenger 4.0.37
  • Apache 2.2.22
  • Ruby 2.0.0p353
  • Rails 4.0.3 / Capistrano 2.15.5 / Rake 10.1.1

Everything with the app seems to be working properly, with the exception of the rails application logging. My expectation is that everything application-specific should be written to the {Rails.root}/log/production.log file. However, everything seems to be being written to /var/log/apache2/error.log.

Here's an excerpt from the apache error.log to show what I mean:

App 1495 stdout: Started GET "/" for 192.168.1.106 at 2014-03-08 17:26:04 -0500 App 1495 stdout: Processing by HomeController#index as HTML App 1495 stdout: Rendered home/index.html.erb within layouts/application (0.1ms) App 1495 stdout: Rendered layouts/_header.html.erb (2.0ms) App 1495 stdout: Rendered home/_auth.html.erb (0.4ms) App 1495 stdout: Rendered layouts/_footer.html.erb (0.1ms) App 1495 stdout: Completed 200 OK in 9ms (Views: 5.8ms | ActiveRecord: 0.0ms) 

I find it interesting that the log/production.log even gets created, but nothing is being written to it.

Some things that I've looked into/verified:

  • RAILS_ENV=production
  • The {Rails.root}/config/environments/production.rb is set to all of the default values
  • My apache/passenger setup is mostly default, with the exception of having to add a virtualhost entry for my app, like so:
<VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/apps/myapp/current/public RailsEnv production </VirtualHost> 
  • Permissions across all of the files in the rails app, appear to be good - and in desperation I tried to grant '777' permission to the log/production.log, to no avail.

I'll be happy to provide any other application configuration information or environment details upon request.

5
  • 1
    I have the exact same problem, any solution? Commented May 30, 2014 at 12:09
  • Unfortunately none yet. Commented Jun 6, 2014 at 0:09
  • Actually, I think this might have just been an issue with that version of rails. I just deployed a new rails app that is built on 4.1.1 and it's writing the log/production.log. Try upgrading your version of rails and see what happens. FYI, I also upgraded a few other components, but the most major change was rails. If it doesn't fix it for you, I'll provide specific versions for the other stuff in my environment. Commented Jun 6, 2014 at 1:48
  • I can confirm that upgrading to rails 4.1.1 solved the logs problem Commented Jun 9, 2014 at 16:17
  • In my case I face this problem on Rails 4.1.5. I upgraded to 4.1.6 without success. Commented Sep 19, 2014 at 20:44

1 Answer 1

0

I had a similar situation. In my case a #{Rails.root}/config.ru included the line use Rails::Rack::LogTailer. This was causing all Rails logging to also be added to /var/log/apache2/error.log.

1
  • Did removing/modifying that line work or did you have to update your version like the OP referenced? Commented Nov 3, 2014 at 21:23

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.