Rails 3.2.6:对于development.log文件,出现“无法访问日志文件"错误 [英] Rails 3.2.6: Getting 'Unable to access log file' error for development.log file
问题描述
这似乎是一个普遍的问题,但是我似乎无法通过Google搜索等找到解决方案.
This seems like it would be a common problem, but I just can't seem to find the solution through google searches, etc.
我刚刚创建了一个新的Rails 3.2.6应用程序,并将其配置为使用PostgreSQL数据库进行本地开发.我遵循了 RailsCast 的要求,并能够正确安装和设置所有内容.
I just created a new Rails 3.2.6 application and configured it to use the PostgreSQL database for my local development. I followed this RailsCast and was able to get everything installed and set up correctly.
但是,每当我尝试执行任何rails生成或rake命令(rails generate model
,rake db:migrate
等)时,都会出现以下错误,这些错误指向我的development.log
文件:
However, whenever I try to do any rails generate or rake commands (rails generate model
, rake db:migrate
etc), I get the following error referring to my development.log
file:
Rails Error: Unable to access log file. Please ensure that /Users/****/projects/rails_projects/rails_app/log/development.log exists and is chmod 0666. The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.
我看到了其他这些stackoverflow问题/答案,但它们与我的情况不完全相同:
I see these other stackoverflow questions/answers, but they don't fit my case exactly:
- 轨道:无法访问日志文件<-返回在Rails 2.2时代
- Ruby on Rails设置:无法访问日志文件<-这是关于使用Apache的生产环境的信息.我在本地开发环境中.
- Rails: Unable to access log file <- This is back in the days of Rails 2.2
- Ruby on Rails Setup: Unable to access log file <- This is regarding a production environment using Apache. I am on a local development environment.
除了该错误外,我的应用程序运行正常.另外,如果我创建一个具有所有默认值的新Rails应用程序,则不会收到此错误.
Other than that error, my application runs fine. Also, if I create a new rails application with all its defaults, I don't get this error.
任何建议/提示将不胜感激.或者,如果您需要有关我的本地环境的更多信息,请告诉我.
Any suggestions/hints would be much appreciated. Or if you need any more information about my local environment, please let me know.
推荐答案
我基本上按照错误消息的建议进行操作,并对development.log
文件进行了chmod 0666
的操作:
I basically did what the error message suggested and did a chmod 0666
on the development.log
file:
$> cd /Users/****/projects/rails_projects/rails_app/log/
$> chmod 0666 development.log
此后一切正常.
这篇关于Rails 3.2.6:对于development.log文件,出现“无法访问日志文件"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!