10

Every time I load a page, webrick pollutes its log with lots of assets rendering lines. I want it to render assets, but I don't want it to be logged, because it makes it really difficult to look into what really matters. How do I force it to stop doing that?

orion3
  • 9,797
  • 14
  • 67
  • 93
  • 1
    Look at http://stackoverflow.com/questions/6312448/how-to-disable-logging-of-asset-pipeline-sprockets-messages-in-rails-3-1 seems like the same issue – chischaschos Sep 08 '11 at 23:37
  • I wouldn't use webrick for a production application, anyways. Use thin , mongrel, or passenger. http://tenmiles.com/blog/2010/08/apache-passenger-and-other-server-alternatives-rails/ – WattsInABox Nov 10 '11 at 18:02

2 Answers2

3

There is an open ticket for this https://github.com/rails/rails/issues/2639, when it is closed and you have the lastest and greatest, in config/environments/development.rb add:

config.assets.logger = nil

Until the above issues is resolve, then this will work:

Rails.application.assets.logger = Logger.new('/dev/null')
Rails::Rack::Logger.class_eval do
  def before_dispatch_with_quiet_assets(env)
    before_dispatch_without_quiet_assets(env) unless env['PATH_INFO'].index("/assets/") == 0
  end
  alias_method_chain :before_dispatch, :quiet_assets
end

Reference: How to disable logging of asset pipeline (sprockets) messages in Rails 3.1?

Community
  • 1
  • 1
Matt Smith
  • 3,479
  • 2
  • 28
  • 29
2

Add gem 'quiet_assets', :group => :developmentto your Gemfile. See https://github.com/evrone/quiet_assets .

lacco
  • 882
  • 1
  • 10
  • 24