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'
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 update rails
bundle install
bundle update
In this and different orders. How can I approach this?
Are you using a customer logger?
Check in config/environments/development.rb
. That's where the logger is usually assigned.
Also, look in config/initializers
for logging-related monkey patches.
I was using Chris Powell's logger patch, and it caused a very similar error.
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/
I also had the same error, got rid of it by re-initializing the logger.
Added a new file on config/initializers, called it log_formatting.rb
with this code:
Rails.logger = ActiveSupport::Logger.new "log/mylog.log"
Rails.logger.formatter = proc{|severity,datetime,progname,msg|
"[#{datetime.strftime("%Y-%m-%d %H:%M:%S")}] [#{severity}]: #{msg}\n"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With