Rails doesn't write to development.log file anymore as soon as I save it from another location

ぃ、小莉子 提交于 2019-12-12 01:18:09

问题


I'm facing a really strange problem. When I start rails s, Rails logs as expected to log/development.log file.

As soon as I open it in an editor (e.g. Vi, TextMate) and save it from there, Rails doesn't write to it anymore! I have to restart the server, and then it works again.

This is really strange, it seems like Vi/TextMate "steals" the right to write the file, and only a restart of the Rails server regains the right again.

Anybody has an idea what's happening here? This is really annoying. I'm also only able to do rake log:clear as long as I didn't hit "save" for development.log, so it's exactly the same strange behavior...

I described a similar strange behavior like this before, and I suspected AckMate to have something to do with it. Sadly, I didn't get any response, see here.

Thanks a lot for help, this is really bugging me.


回答1:


vim writes your file to a temporary file and then renames it.

The Rails process keeps writing to the old opened fd.



来源:https://stackoverflow.com/questions/11783109/rails-doesnt-write-to-development-log-file-anymore-as-soon-as-i-save-it-from-an

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!