pdjota
pdjota

Reputation: 3243

Log exception: comparison of Fixnum with :debug failed in Rails 3.2

I have created an application in Rails 3.2, generated a controller page, added a default route, removed the public/index.html file and get the following error when navigating '/'.

Internal Server Error
comparison of Fixnum with :debug failed 

Detailed log: https://gist.github.com/1698521

Basically what the error is raised when adding the severity.

activesupport-3.2.1/lib/active_support/buffered_logger.rb:80

def add(severity, message = nil, progname = nil, &block)
  @log.add(severity, message, progname, &block)
end

Any ideas of why this is might be happening?

TIA

Upvotes: 2

Views: 989

Answers (2)

pdjota
pdjota

Reputation: 3243

The problem was that I set wrong the log level in an initializer:

Rails.logger.level = :debug

The issue is that the Logger class internally compares the attribute level with a Fixnum and that was the mistake, that I put a symbol. It should be done this way:

Rails.logger.level = 0

And, of course @Wilhelm is right about the best practice of defining root in the controller

Upvotes: 4

Wilhelm
Wilhelm

Reputation: 820

I have never seen that error but you should be using:
root :to => 'pages#demo'
instead of
get '/' => 'pages#demo'
in your routes file.

Upvotes: 2

Related Questions