{"id":407,"date":"2022-08-30T15:00:50","date_gmt":"2022-08-30T15:00:50","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/undefined-method-level-for-mongoid-logger-in-a-rails-app-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:00:50","modified_gmt":"2022-08-30T15:00:50","slug":"undefined-method-level-for-mongoid-logger-in-a-rails-app-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/undefined-method-level-for-mongoid-logger-in-a-rails-app-collection-of-common-programming-errors\/","title":{"rendered":"Undefined method `level` for Mongoid logger in a Rails app-Collection of common programming errors"},"content":{"rendered":"<p>I think the issue here may be where you are initiating the <code>Mongoid.logger<\/code> and how you are doing it. In my <code>Rails 3.2<\/code> app running <code>Ruby 1.9.2<\/code> with <code>Mongoid 2.4.3<\/code> I have no problem instantiating the <code>Mongoid Logger<\/code>.<\/p>\n<p>Here you can read the Mongoid Configuration that shows how to setup the logger.<\/p>\n<p>The code from my most recent app to instantiate the logger in <code>Application.rb<\/code> found in the <code>\/config<\/code> folder<\/p>\n<pre><code>module Application_Name\n  class Application &lt; Rails::Application\n    # Settings in config\/environments\/* take precedence over those specified here.\n    # Application configuration should go into files in config\/initializers\n    # -- all .rb files in that directory are automatically loaded.\n\n    config.mongoid.logger = Logger.new($stdout)\n<\/code><\/pre>\n<p id=\"rop\"><small>Originally posted 2013-11-09 19:03:02. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-407","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/407","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=407"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/407\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=407"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=407"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=407"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}