Search code examples
ruby-on-railswebrick

Different output in server log


I have 2 Ruby on Rails projects. When I start a rails server for the first project and login, I see this in the console:

Started POST "/users/sign_in" for 127.0.0.1 at 2013-11-15 10:40:24 +0100

When I start the rails server for the second project and login, I see this in the console:

Started POST "/users/sign_in" for 127.0.0.1 at 2013-11-15 10:39:46 +0100
Processing by SessionsController#create as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"s8eI2YYtuduMy1Hxa7kJJUeCJoLi5pjEb7FmhpOE5/c=", "user"=>{"email"=>"[email protected]", "password"=>"[FILTERED]"}, "commit"=>"Inloggen"}
  User Load (4.5ms)  SELECT "users".* FROM "users" WHERE "users"."email" = '[email protected]' LIMIT 1

I don't see any differences between the setup of both projects, but how can I make sure the first project also shows the exetended information?


Solution

  • I figured out it had to do with the recent switch to unicorn. Unicorn by default outputs the log to a file instead of STDOUT. So log\development.log is filled with all log messages, but not the terminal screen. To fix this, add this to config/development.rb:

      config.logger = Logger.new(STDOUT)
      config.logger.level = Logger.const_get(
        ENV['LOG_LEVEL'] ? ENV['LOG_LEVEL'].upcase : 'DEBUG'
      )