无法使用内置Rails记录器旋转日志

时间:2014-12-12 15:57:48

标签: ruby-on-rails logging

development.rb:

GDisp::Application.configure do
    config.logger = Logger.new(File.join(Rails.root, 'log', 'development.log'), 20, 10240000)
end

错误:

log shifting failed. Permission denied - (D:/Work/disp/log/development.log, D:/Work/disp/log/development.log.0)
log writing failed. closed stream
log shifting failed. closed stream
log writing failed. closed stream
log shifting failed. closed stream
log writing failed. closed stream

development.rb长10001 kb。

Windows 7 x64

1 个答案:

答案 0 :(得分:1)

我知道这是一个非常古老的问题。但是我找到了问题并纠正了这个问题。

问题是由于Windows具有文件关联 - 您需要删除每个.log.0 / .1 / .2 e.t.c的文件关联。文件

我通过编辑我的注册表来完成此操作,这里可以使用要编辑的文件:( 注意我在Win7上工作!http://www.howtogeek.com/171932/how-do-you-remove-a-default-file-association-in-windows-7/

完成此操作后,可能需要重新启动程序,但一旦完成,它将正确切换。您可能还需要手动移动有问题的文件(如果是您必须删除引用的.0文件)

干杯,