ruby – 在Rails 4升级后,未定义的方法`标记’格式化程序错误

前端之家收集整理的这篇文章主要介绍了ruby – 在Rails 4升级后,未定义的方法`标记’格式化程序错误前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我按照 Ruby Screencast指南从Rails 3.2升级到Rails 4.我的测试正在运行并且服务器启动,但是当我发送请求时收到错误
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.变量记录器后面的对象不是记录器,而是Formatter对象.这很奇怪.

知道是什么原因引起的吗?到目前为止我:

>删除了我的Gemfile.lock
> gem update rails
>捆绑安装
>捆绑更新

在这个和不同的订单.我该如何处理?

解决方法

您使用的是客户记录器吗?

检入config / environments / development.rb.这就是通常分配记录器的地方.

另外,在config / initializers中查看与日志相关的猴子补丁.

我使用的是Chris Powell的记录器补丁,它导致了一个非常类似的错误.

如果你正在使用该补丁,那么Rails 4会有一个更新的补丁:
http://cbpowell.wordpress.com/2013/08/09/beautiful-logging-for-ruby-on-rails-4/

猜你在找的Ruby相关文章