Rails 4 升级后格式化程序错误的未定义方法“标记" [英] Undefined method `tagged' for Formatter error after Rails 4 upgrade
问题描述
我已按照 Ruby Screencast 指南从 Rails 3.2 升级到 Rails 4.我的测试正在运行并且服务器启动,但我在发送请求时收到错误:
I have upgraded from Rails 3.2 to Rails 4 by following the Ruby Screencast guide. My tests are running and the server starts, yet I receive an error when I send a request:
ERROR NoMethodError: undefined method `tagged' for #<Formatter:0x000000057f5dc8>
/home/mahoni/.rvm/gems/ruby-2.0.0-p195/gems/activesupport-4.0.0/lib/active_support/tagged_logging.rb:67:in `tagged'
/home/mahoni/.rvm/gems/ruby-2.0.0-p195/gems/railties-4.0.0/lib/rails/rack/logger.rb:21:in `call'
/home/mahoni/.rvm/gems/ruby-2.0.0-p195/gems/quiet_assets-1.0.2/lib/quiet_assets.rb:18:in `call_with_quiet_assets'
/home/mahoni/.rvm/gems/ruby-2.0.0-p195/gems/actionpack-4.0.0/lib/action_dispatch/middleware/request_id.rb:21:in `call'
/home/mahoni/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
/home/mahoni/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
/home/mahoni/.rvm/gems/ruby-2.0.0-p195/gems/activesupport-4.0.0/lib/active_support/cache/strategy/local_cache.rb:83:in `call'
/home/mahoni/.rvm/gems/ruby-2.0.0-p195/gems/actionpack-4.0.0/lib/action_dispatch/middleware/static.rb:64:in `call'
/home/mahoni/.rvm/gems/ruby-2.0.0-p195/gems/railties-4.0.0/lib/rails/engine.rb:511:in `call'
/home/mahoni/.rvm/gems/ruby-2.0.0-p195/gems/railties-4.0.0/lib/rails/application.rb:97:in `call'
/home/mahoni/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
/home/mahoni/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
/home/mahoni/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
/home/mahoni/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
/home/mahoni/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
/home/mahoni/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
我看过代码,但对我来说没有意义.它调用 logger.tagged
.变量logger
后面的对象不是记录器,而是Formatter
对象.这很奇怪.
I have I have looked at the code, and it does not make sense for me. It calls logger.tagged
. The object behind the variable logger
is not a logger, but a Formatter
object. This is strange.
知道是什么原因造成的吗?到目前为止,我:
Any idea what could cause this? So far I:
- 删除了我的
Gemfile.lock
gem 更新导轨
捆绑安装
捆绑更新
在这个和不同的顺序.我该如何解决这个问题?
In this and different orders. How can I approach this?
推荐答案
您在使用客户记录器吗?
Are you using a customer logger?
检查config/environments/development.rb
.这就是通常分配记录器的地方.
Check in config/environments/development.rb
. That's where the logger is usually assigned.
此外,查看 config/initializers
以获取与日志相关的猴子补丁.
Also, look in config/initializers
for logging-related monkey patches.
我使用了 Chris Powell 的记录器补丁,它导致了一个非常相似的错误.
I was using Chris Powell's logger patch, and it caused a very similar error.
如果您正在使用该补丁,那么 Rails 4 有一个更新的补丁:http://cbpowell.wordpress.com/2013/08/09/beautiful-logging-for-ruby-on-rails-4/
If you're using that patch, there's an updated one for Rails 4: http://cbpowell.wordpress.com/2013/08/09/beautiful-logging-for-ruby-on-rails-4/
这篇关于Rails 4 升级后格式化程序错误的未定义方法“标记"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!