Rails 3.1 / Hiding asset information in a terminal

Possible duplicate:
How to disable logging of pipeline messages (asterisks) in Rails 3.1?

Since they (uselessly) take up most of the reading space and are lazy to always scroll a bit, they are currently trying to find a way to hide the messages of these assets:

(..interesting stuff..) Completed 200 OK in 281ms (Views: 83.9ms | ActiveRecord: 16.7ms) (..not so interesting stuff..) Started GET "/assets/application.css?body=1" for 127.0.0.1 at Tue Dec 27 13:17:16 +0100 2011 Served asset /application.css - 304 Not Modified (1ms) (...loads more of useless stuff...) 
+4
source share
3 answers

You can add this inside config/initializers/quiet_assets.rb

 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 

We hope that a cleaner version will turn it into Rails 3.2

+4
source

Also follow this discussion https://github.com/rails/rails/pull/3795

+1
source

You can patch the monkey to silence it. Solution from the Chinese community :

 # inside config/environments/development.rb YouApp::Application.configure do # add this config.after_initialize do |app| app.assets.logger = Logger.new('/dev/null') end end # and this 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 
0
source

Source: https://habr.com/ru/post/1388122/


All Articles