如何让Rails 4.1.1写入Windows中的日志文件?

时间:2014-06-11 08:23:24

标签: ruby-on-rails ruby-on-rails-4 ruby-on-rails-4.1

日志输出将转到控制台,但我还希望它转到日志文件。 Windows控制台不太适合跟踪单独的请求。如果我删除该文件,它将创建log/development.log,但除了一行之外它不会写入它! (“在...上创建日志文件”)

这是我的config / environment / development.rb(我尝试了几种评论/取消注释的组合)

  config.log_level = :debug
  # Rails.logger = Logger.new("log/development.log")
  config.logger = Logger.new("log/development.log")

这是我的环境

C:\Users\Chloe\workspace\Tyger>rails runner 'puts Rails.env'
DL is deprecated, please use Fiddle
Vanity: loading experiments from C:/Users/Chloe/workspace/Tyger/experiments
Vanity: loading metrics from C:/Users/Chloe/workspace/Tyger/experiments/metrics
development

参考:http://guides.rubyonrails.org/debugging_rails_applications.html#the-logger

0 个答案:

没有答案