0

This seems like it would be a common problem, but I just can't seem to find the solution through google searches, etc.

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.

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.

I see these other stackoverflow questions/answers, but they don't fit my case exactly:

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.

Community
  • 1
  • 1
richsinn
  • 1,341
  • 1
  • 12
  • 27
  • That file is not part of Postgres (at least not a standard installation). So I don't think it's a Postgres problemn –  Jul 17 '12 at 07:31
  • Yea, I figured... It's just that the only thing I did differently was use PostgreSQL for my db for my local development environment, and that is when I started getting the errors. If I just use the Rails defaults for local development (i.e. SQLite, etc), I do not get this error. Let me re-word/edit the question and re-post it. – richsinn Jul 17 '12 at 22:28

3 Answers3

2

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

Everything worked fine after that.

richsinn
  • 1,341
  • 1
  • 12
  • 27
1

Have you verified that the log file is there and that you can access it? I've done some similar things in the past.

BServiss
  • 34
  • 1
  • Hi @BServiss, thanks for your response. Yes, the file always existed and I was always able to access it. I actually just went ahead and manually did a chmod on the file, and I'm no longer receiving the error now. – richsinn Jul 23 '12 at 03:11
0

Check it out with sudo if your enviroment its on linux, for example, i got that error trying to run the migration - rake db:migrate, so i used sudo rake db:migrate and that's work, maybe because the rake when its trying to consult development.log doesn't have the right permissions or something like that.

Fulvio
  • 925
  • 2
  • 13
  • 21