Rails记录器在开发中的控制台中打印两次

时间:2014-03-15 18:43:14

标签: ruby-on-rails ruby logging

我不确定为什么会这样。我的Rails记录器在Console中打印两次。

这是我的development.rb

  MyApplication::Application.configure do
  # Settings specified here will take precedence over those in config/application.rb.

  # In the development environment your application's code is reloaded on
  # every request. This slows down response time but is perfect for development
  # since you don't have to restart the web server when you make code changes.
  config.cache_classes = false

  # Do not eager load code on boot.
  config.eager_load = false

  # Show full error reports and disable caching.
  config.consider_all_requests_local       = true
  config.action_controller.perform_caching = false

  # Don't care if the mailer can't send.
  config.action_mailer.raise_delivery_errors = false

  # Print deprecation notices to the Rails logger.
  config.active_support.deprecation = :log

  # Debug mode disables concatenation and preprocessing of assets.
  # This option may cause significant delays in view rendering with a large
  # number of complex assets.
  config.assets.debug = true
  config.action_mailer.default_url_options = { :host => 'localhost:3000' }
  config.log_level = :info
  Mongoid.logger.level = Logger::INFO
  Moped.logger.level = Logger::INFO
  Mongoid.logger = Logger.new("#{Rails.root}/log/mongoid_test.log")
  Moped.logger = Logger.new("#{Rails.root}/log/moped_test.log")
  Devise.stretches = 1

end

我不确定我应该包含哪部分代码,请询问您是否需要查看代码的特定部分。

这是它的打印内容。

Started GET "/main/poll_search_result" for 127.0.0.1 at 2014-03-15 18:41:53 +0000
Started GET "/main/poll_search_result" for 127.0.0.1 at 2014-03-15 18:41:53 +0000
Processing by MainController#poll_search_result as */*
Processing by MainController#poll_search_result as */*
  Rendered shared/_tweet.html.erb (0.5ms)
  Rendered shared/_tweet.html.erb (0.5ms)
  Rendered text template (0.0ms)
  Rendered text template (0.0ms)
Completed 200 OK in 1477ms (Views: 0.5ms)
Completed 200 OK in 1477ms (Views: 0.5ms)

它在开发和生产中都发生了。

1 个答案:

答案 0 :(得分:0)

你试过这个吗?

gem 'rails_12factor', group: :production