Rails Error: Unable to access log file - ruby-on-rails

I suddenly got this error at my app which ran without problems for more than two years:
Rails Error: Unable to access log file. Please ensure that .../production.log exists...
WARN -- : Errno::EACCES: Permission denied # rb_sysopen .../log/newrelic_agent.log
The result of this error is that my mongoDB is killed. After I restarted the app everything works again until scheduled tasks are called which lead to that behaviour.
The error message says that i have to chmod to 0664, but this is still the case. For the deployment I use capistrano.
Any ideas?

Make log directory writable for other users:
chmod -R 777 specify_app_path_here/log

Now I know the reason for that strange behaviour: Hard Disk Failure !!!
Even both Disks were dead at the same time (RAID1) :(

Related

Rails Error: Unable to access log file on aws lambda

I'm trying to run the Rails app in AWS lambda (using lamby gem) via docker image.
I'm getting the following error.
Rails Error: Unable to access log file. Please ensure that /fi-service/log/development.log exists and is writable (ie, make it writable for user and group: chmod 0664 /fi-service/log/development.log). The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.
I even added the following commands in the dockerfile (as suggested here)
RUN touch log/development.log
RUN chmod 0664 log/development.log

Having issue with installing this in my mac terminal

I cannnot figure out why it's giving me this result.
Warning: Failed to create the file /Users/myname/.bash_profile: Permission
Warning: denied
curl: (23) Failed writing body (0 != 1968)
When I enter the second step see in the link below.
Instructions provided here that I was given from a bootcamp I am learning to code from.
If some one could take the time out their day to please answer my question. I would gladly appreciated.
Try appending "sudo" in the beginning of the command.
If that does not work, attempt to edit permissions for the directory by using chmod.
Be careful with using 777, but if it is on your local device, it should not mean a whole lot.
Usage: sudo chmod XYZ /di/rec/tory
Replace XYZ with chmod settings.
Read this if you are in doubt.

My Rails apps all suddenly became read-only

I was working on my rails app, left it for a while, came back, and tried to restart my server. In response, I got back this error:
Rails Error: Unable to access log file. Please ensure that /home/user/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 have no idea what I could have done to cause this. I never even touched my log directory. I tried to run chmod 0666 /home/user/app/log/development.log and then various other chmod commands, like chmod 0664 and chmod 777. Each time I got back:
chmod: changing permissions of ‘/home/user/app/log/development.log’: Read-only file system
but I always got back the same error from rails s.
Then I gave up and switched to a different app I'm working on, but after running rails s for that app, I got back basically the same error:
Rails Error: Unable to access log file. Please ensure that /home/user/sweat/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.
What is going on? I'm using Ubuntu 14.04.
UPDATE
Running sudo chmod 777 -R log gives me back this:
sudo: unable to open /var/lib/sudo/user/1: No such file or directory
chmod: changing permissions of ‘log’: Read-only file system
chmod: changing permissions of ‘log/development.log’: Read-only file system
chmod: changing permissions of ‘log/.keep’: Read-only file system
if you are using Linux!
try this => cd home/user/app
then => sudo chmod 777 -R log
I hope this helps you!

how to setup appium for iOS simulator?

I was trying to setup appium for iOS automated testing, but I keep getting this error while running ./reset.sh
does anyone know how to fix the issue?
Running "setConfigVer:ios" (setConfigVer) task
Config file exists, updating it
{"git-sha":"1c004673dcc4a2af7357aff4be72a2da7f9f86bc","ios":{"version":"1.2.3"}}
Done, without errors.
* Installing ios-sim-locale
cp: build/ios-sim-locale: Permission denied
---- FAILURE: reset.sh exited with status 1 ----
Because it is a "Permission denied" error,
try: sudo ./reset.sh --ios ?
I found the issue, for some reason the build folder inside my repo, had the wrong permissions. I simply removed it (it's an empty folder) and mkdir a new one with the same name.

Rails Error: Unable to access log file And ActionView::Template::Error Permission denied

I'm deploy my app with capistrano on centos (apache + passenger), when access my web I got `HTTP 500 (Internal Server Error)' and check error_log file , here's error look likes :
DAV/2 Phusion_Passenger/3.0.19 mod_ssl/2.2.24 OpenSSL/1.0.0-fips configured -- resuming normal operations
Rails Error: Unable to access log file. Please ensure that /home/admin/myaap/releases/20130506191509/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..
production.log permission
-rwxrwxr-x 1 root root 46211 May 6 20:49 production.log
and
ActionView::Template::Error (Permission denied - /home/admin/myaap/releases/20130506191509/tmp/cache/assets/D3B
directory D3B not found.
I am looking for a solution via google, one of which is sudo chown -R root:root /home/admin/myapp/ but not working for me, Is there any other way to fix it?
Note :
I'm using user root for deploy and installing rvm, and directory root location on user 'admin' (kloxo control panel)
UPDATE
On error_log file not found error about permission and unable to access, I'm using chmod go-w /home/admin/myapp and chmod 0666 production.log , but my web still 500 server error, How do I check error?
As Rails is suggesting in the error log, you should change permissions for the log file to 066:
chmod 0666 production.log
You are using root to deploy, but the web server is using another user name.
You need to make your apache user the owner of your app like:
sudo chown -R apacheuser:apacheuser /home/admin/myapp/
I've always had success with the the log file permissions as 644. When this has happened to me, more than once I might add, it has always been answered by the question linked below. Since this is the first answer in Google for the query I use, I'm linking to the answer that I really want.
Rails: Unable to access log file

Resources