Suddenly when I run my app locally, I get double console output. Does anybody know what might have caused this? The problem exists both when running Thin and Unicorn
<
Check if you have code like this in your application:
<img src="#">
Rails sometimes makes duplicate records because of this also.
You may try doing:
rake assets:clean
Or maybe, commenting out this line in development.rb, might work:
config.active_support.deprecation = :log
As a last try, you may even try changing the folder of the application and then start the server to see the result.
Cheers!
As of Rails 4.2 and the time of this posting, the only solution I'm aware of is to remove rails_12factor from the Gemfile.
Adding group: :production
no longer prevents the double-logging. There is an open issue with heroku on github:
https://github.com/heroku/rails_stdout_logging/issues/1
I've noticed this happens because of the rails_12factor
gem. If you comment out gem rails_12factor
from your Gemfile
the double output should go away. My guess is that the double output isn't important to worry about since you need the gem anyways for Heroku.
As for why the rails_12factor
gem causes this I have no idea.
From your example, it shows that duplicates are happening inline, ie.
A
A
B
B
C
C
If instead you are seeing what appears to be two back-to-back duplicate requests, ie:
A
B
C
A
B
C
You should strongly consider @aelor's answer of hunting down a <img src="#">
or a similar self-referential url tag. I spent hours trying to figure out why my application was appearing to make two duplicate requests, and after reading @aelor's answer I found
%link{href: "", rel: "shortcut icon"}/
in my code! It was causing every page of my production app to be double rendering!!!! So bad for performance and so annoying!
We found this was caused by running the Rails server via
$ rails server
rather than
$ thin start
When using the latter, the double-logging problem goes away. Unfortunately we didn't have time to lock down the cause, we just changed the way we launched Thin and moved on.
in regards to rails_12factor - if you change the line in the Gemfile to:
gem 'rails_12factor', group: :production
you will no longer see the double output in the console while debugging, etc.