rails 3.2.1 怎么去掉如下这种日志输出:
Started GET "/assets/admin/jquery.tablesorter.min.js?body=1" for 127.0.0.1 at 2012-02-02 09:03:49 +0800
Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2012-02-02 09:03:49 +0800
Started GET "/assets/admin/editor/kindeditor.js?body=1" for 127.0.0.1 at 2012-02-02 09:03:49 +0800
Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2012-02-02 09:03:49 +0800
Started GET "/assets/admin/editor/lang/zh_CN.js?body=1" for 127.0.0.1 at 2012-02-02 09:03:49 +0800
Started GET "/assets/admin/admin.css?body=1" for 127.0.0.1 at 2012-02-02 09:03:49 +0800
我 development.rb 里有如下内容:
config.after_initialize do |app|
app.assets.logger = Logger.new('/dev/null')
end
之前华顺弄过的
# 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
在 Rails 3.2.1 下会出错:
/Users/zhengmiclle/.rvm/gems/ruby-1.9.2-p180@healthier/gems/activesupport-3.2.1/lib/active_support/core_ext/module/aliasing.rb:31:in `alias_method': undefined method `before_dispatch' for class `Rails::Rack::Logger' (NameError)
from /Users/zhengmiclle/.rvm/gems/ruby-1.9.2-p180@healthier/gems/activesupport-3.2.1/lib/active_support/core_ext/module/aliasing.rb:31:in `alias_method_chain'
... ...