In my rails app, when I first ran it, I got an error that said 'No such file or directory. log/development.log'
When I touched a development.log file, the app ran fine, but the file wasn't being written to by the logger. I tried changing the permissions on it to 666, but it still didn't work.
Possibly the user that is running your app doesn't have write access to the log file.
Related
I'm deploying a Rails app on Heroku which requires a gem that looks for an executable in PATH. I put my executable inside /vendor/bin and then proceeded as below:
As explained in Heroku docs here, I created a .profile.d directory in the root of my app and then in it, I created a file called path.sh. In path.sh, I set the PATH variable like this:
PATH="$PATH:/app/vendor/bin"
or this
PATH=$PATH:$HOME/vendor/bin
But neither seems to work. The app is deployed successfully but when I run it, I see an application error, and in my logs, I see that this executable could not be found in PATH, thus the application crashed. The script (.profile.d/path.sh) is run for sure though, because in my Heroku logs, I am able to see other commands and the print outs I put in the very same file.
Does anyone know what to do in order to make this work? Thanks in advance.
I cant figure out why my rails app is not generating the log file any more. I restarted the web server but still no sign of the log file. What config parameters could possible make it not being generated?
Do you have the folder log? Does the user that runs rails have write permissions on the folder?
I'm been working on a rails 3.1 app with one other dev.
I've just pulled some of his recent changes, using git. And am now getting a 403 on any page I try to visit.
You don't have permission to access / on this server.
I'm running the site locally through passenger.
Oddly, when I start the app using rails' internal server. I can visit the site at http://0.0.0.0:3000
Looking at the changes in this recent pull, the only files have changed are some javascripts, some html the application.rb, routes.rb and a rake file.
How do I debug this, I'm a bit lost on where to start?
EDIT:
If I roll back to an earlier version the site works, through passenger. Which leads me to believe the problem is within the rails app, rather than an Apache error. Or it could be a permissions thing, can git change file permissions in this way?
IMHO this is a configuration error in Apache or wrong directory layouts. Make sure that the passenger_base_uri still points to the public folder inside your rails project and that there are no hidden .htaccess files which block access. Also verify that your sym-links are correct (if there are any). Also check your Apache error log.
Start by launching your console to see if rails and your app can be loaded.
In your application root directory type :
rails console
I'm trying out a Q&A application written in rails 3.1 on my Ubuntu system. After I run the server (rails server), and enter the localhost:3000 url in the browser, I'm getting the following error:
/var/lib/gems/1.8/gems/jquery-rails-1.0.14/vendor/assets/javascripts/jquery.js isn't in paths:
(...."displays a list of paths including /$home/myapp/jquery-rails/ruby/1.9.1/gems/jquery-rails-1.0.14/vendor/assets/javascripts".....).
I did bundle update and it installed the jquery.js and all other .js files in that last path. But I'm still getting the same error. Any suggestions about what I might be doing wrong here?
P.S. When I enter the URL localhost:3000, it actually tries to open the URL: http://localhost:3000/session/new. Must be some application specific logic.
Remove everything in your /tmp directory and restart the Rails app.
Fixes it for me.
I'm trying to do easy logging
logger.error "ERROR!!!"
But nothing is displayed in any of the log files in the /log directory. I tried rescuing an exception, but there's no exception.
What might be the problem here?
Did you check that your production.log file has the proper rights? Try running sudo chmod 0666 on your production.log file, that might be the problem.
there might be a:
permission problem. run "sudo chmod 0666" on the file. rails does show this when the server is started though
rails uses a BufferedLogger. try a "logger.flush" Can configure it as well.
what does "logger.class" say? what logger are you using?
is the log file created? what is its permission and the permission for the log folder?
are you running the server on webrick (locally ?) or passenger etc?
eg. if you say "Rails.logger = Logger.new(STDOUT)" then the logs will go to stdout rather than a file. check that as well
Check output of Rails.logger. If it shows RailsStdoutLogging::StdoutLogger:0x00007fe3b5bc3540 means you are logging on shell. Change it to ActiveSupport::Logger by creating an initializer.
config/initializer/logger.rb
Rails.logger = ActiveSupport::Logger.new('log/production.log')
I had a similar problem trying to use logger.debug and RAILS_DEFAULT_LOGGER.debug.
However, the following works:
Rails.logger.debug 'hello world'
Then check the logs for the corresponding environment in your app's /log folder.