日志输出将转到控制台,但我还希望它转到日志文件。 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