Reputation: 48490
I'm seeing this:
undefined method `level' for #<Mongoid::Logger:0xcd1a1f>
When I set the Mongoid logger in my init. The logger is being set by trivial means:
Mongoid.logger = Logger.new($stdout)
in global.rb
What is the issue here? How do I get Mongoid to log to my own logger so I can see some queries?
I've also tried to not avail:
Mongoid.logger = Logger.new($stdout, :info)
Upvotes: 3
Views: 1775
Reputation: 12805
The latest build is broken:
https://github.com/mongoid/mongoid
http://travis-ci.org/#!/mongoid/mongoid/builds/722676
You will have to wait till they fix it or use an older version
Edit: Ok I was having the same problem and I solved it by doing this:
1) Set the specific version you want for mongoid gem in your Gemfile
gem 'mongoid', '= 2.4.5'
2) install
$ bundle install
3) restart your server
Upvotes: 5
Reputation: 3011
I think the issue here may be where you are initiating the Mongoid.logger
and how you are doing it. In my Rails 3.2
app running Ruby 1.9.2
with Mongoid 2.4.3
I have no problem instantiating the Mongoid Logger
.
Here you can read the Mongoid Configuration that shows how to setup the logger.
The code from my most recent app to instantiate the logger in Application.rb
found in the /config
folder
module Application_Name
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
config.mongoid.logger = Logger.new($stdout)
Upvotes: 0