I see the following error when I start my rails app:
$ script/server --environment=production
=> Booting WEBrick
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement
Rails Error: Unable to access log file. Please ensure that /home/me/test/railsapp/log/production.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.
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/buffered_logger.rb:52:in `initialize': Permission denied - log/ (Errno::EACCES)
production_delayed_jobs.log
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/buffered_logger.rb:52:in `open'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/buffered_logger.rb:52:in `initialize'
from /home/me/test/railsapp/config/initializers/dj.rb:3:in `new'
from /home/me/test/railsapp/config/initializers/dj.rb:3
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:147:in `load_without_new_constant_marking'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:147:in `load'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:622:in `load_application_initializers'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:621:in `each'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:621:in `load_application_initializers'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:176:in `process'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `send'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `run'
from /home/me/test/railsapp/config/environment.rb:10
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/commands/server.rb:84
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from script/server:3
I did a chmod -R 0666
on the log
directory and now the permissions look as follows. "me" is a regular user that I am sshed as.
drw-rw-rw- 2 me me 4096 2010-07-31 18:48 log
I get this listing only if I do a sudo ls -al log
:
drw-rw-rw- 2 me me 4096 2010-07-31 18:48 .
drwxr-xr-x 14 me me 4096 2010-07-31 19:32 ..
-rw-rw-rw- 1 me me 51 2010开发者_JAVA百科-07-31 18:45 ?development_delayed_jobs.log
-rw-rw-rw- 1 me me 527 2010-07-31 18:59 development.log
-rw-rw-rw- 1 me me 51 2010-07-31 18:48 ?production_delayed_jobs.log
-rw-rw-rw- 1 me me 51 2010-07-31 18:48 production.log
If I do a ls -al log
, I get the following error (over ssh):
Error:
ls: cannot access log/..: Permission denied
ls: cannot access log/
development_delayed_jobs.log: Permission denied
ls: cannot access log/development.log: Permission denied
ls: cannot access log/
production_delayed_jobs.log: Permission denied
ls: cannot access log/production.log: Permission denied
ls: cannot access log/.: Permission denied
total 0
d????????? ? ? ? ? ? .
d????????? ? ? ? ? ? ..
-????????? ? ? ? ? ? ?development_delayed_jobs.log
-????????? ? ? ? ? ? development.log
-????????? ? ? ? ? ? ?production_delayed_jobs.log
-????????? ? ? ? ? ? production.log
chmod the dir 755 or 775, you need execute access to the directory to be able to access it.
精彩评论