I hosted my Rails 3.2.13 application in (Ubuntu 14.04 + Passenger + apache2) combination server.
Everything is working perfect in development environment; but in production environment. I got error like below :-
In browser
We're sorry, but something went wrong.
We've been notified about this issue and we'll take a look at it shortly.
Than, I decided to take log report in log/production.log and done some changes like below.
In /config/environments/production.rb file:
config.consider_all_requests_local = true
config.log_level = :debug
Rails.logger = Logger.new(STDOUT)
Rails.logger = Log4r::Logger.new("Application Log")
Even than, log report is not created in /log/production.log file
Do I need to do anything else ? kindly someone assist me to resolve this issue.
Passenger author here. In addition to the Rails log file, you should also look in the web server error log. Learn more about this in the Passenger documentation's troubleshooting section.
Related
I have made a flask application at my local computer in the debugging mode and it runs all fine. But when it comes to production, the website gives me 500 or internal server error, which I have no idea what the bug is. I am fairly new to flask production and this has been stopping me from moving forward for quite a few days.
My questions are:
1> in my local development environment, one could always print things out. But how can I see those prints in the production stage?
2> Do I see them through Apache2 log? Where is Apache2 log?
For production, I actually followed the tutorials from pythonprogramming.net. Youtube link is here:
https://www.youtube.com/watch?v=qZNL4Ku1UQg&list=PLQVvvaa0QuDc_owjTbIY4rbgXOFkUYOUB&index=2
To use a very simple example, if the code imports a package which wasn't installed, where can we see the errors?
Thanks in advance.
I've tried to use to use try ... except block for every flask function. Whenever there is an exception, it can be return to the front-end. But what about other errors?
I found out:
Use logging module
Read apache2 log from /var/log/apache2
Im building my first Rails app server on a Ubuntu server machine. I came to the point where i am testing a simple add located on the server. When I hit the root page, default rails message
"Welcome on board, You’re riding Ruby on Rails!"
Thats good i suspect. But when I hit server/todos i just get this error message
"We're sorry, but something went wrong."
How can I see full error message? I am completely new to Apache and Passenger. I suspect I could get full messages if i run from the server but there is no GUI or browser installed.
Ok found out this was all connected to the Rails app and not a Apache or Passenger setting.
# environments/production.rb
config.consider_all_requests_local = true
wow. going super nuts here trying to deploy to staging on heroku cedar from Rails 3.2.2. I've gotten everything to work, but I wanted to run these issues up the flagpole to see if there's something wrong with... me. eheh
Both of these issues give me the not-helpful "We're sorry, but something went wrong." error page. So it was frustrating when I had 2 different issues (that acted like 3) in one deploy (that worked fine on my local).
Heroku won't give me my logs.
when I run
heroku logs
I get a long error message that starts with,
c:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:762:in `initialize': Permission denied - connect(2) (Errno::EACCES)
so i've been doing all this troubleshooting via small slices of commits. maddening.
Heroku chokes when it can't find an image with image_tag
this works on heroku:
= image_tag("content/portfolio/maskphoto_rubble_rebel_blur.jpg", :alt => params[:photo], :width => "100%")
This doesn't (only difference is an extra letter in the file name, though it works on my local):
= image_tag("content/portfolio/maskphoto_rubble_rebell_blur.jpg", :alt => params[:photo], :width => "100%")
Am i nuts in thinking that heroku should just serve up the image tag as-is and let it just not display, rather than crashing the entire page? I'm running compass; not sure if that has anything to do with anything.
Heroku hates nested expressions in an array ref
this works:
n = f.index(params[:photo]) +1
#nextphoto = f[ n ]
this doesn't (but does on my local):
#nextphoto = f[ f.index(params[:photo]) +1 ]
i guess it's better form to separate expressions, but still. why would it work on my local and not on deploy?
I can't directly answer all of your questions, but here are a few things to look at:
Heroku won't give me my logs.
The error you are getting indicates Permission denied ... Perhaps your account credentials are not setup properly? I see you are on a windows box ... on a unix machine, the heroku client writes a file at ~/.heroku/credentials with the username and what appears to be an API token. Check to see if you have a similar file. You can also check https://toolbelt.herokuapp.com/windows and make sure you have successfully performed the heroku login command.
Heroku chokes when it can't find an image with image_tag
I don't have many ideas here. Perhaps it is related to the asset-pipeline?
Heroku hates nested expressions in an array ref
This one doesn't make a whole lot of sense either. Perhaps the logs can shed some light here. I did notice that you appear to be running Ruby 1.9.3 on your system, and I don't believe heroku supports 1.9.3 yet. Maybe you have hit a version-specific bug.
I hope that helps. Good luck.
When I run rails s it loads up and everything works. When I browse to a page several lines of information are printed. Mostly this is the webpage getting the assets for the page. I really don't need to see this and have it clutter my screen. Is there a way to customize what gets printed in console?
Thanks
For assets pipeline messages it seems that you can't (yet). See How to disable logging of asset pipeline (sprockets) messages in Rails 3.1? and the rails issue on Github
You can do it in part by using these lines (credits) in your development.rb file
config.after_initialize do |app|
app.assets.logger = Logger.new('/dev/null')
end
For Rails 3.1, inside config/environments/development.rb, set the following to false:
config.assets.debug = false
Your logs will show you everything you want to see minus the assets.
You can configure the logging detail of the rails dev server by setting config.log_level in environments/development.rb. Setting it to :warn will get rid of most of the logging (you can always send your own messages with whatever log level you want so they still get printed).
http://guides.rubyonrails.org/debugging_rails_applications.html#log-levels
http://guides.rubyonrails.org/debugging_rails_applications.html#log-levels
I'm new to rails and ruby and was able to stitch together my first app and launch it on heroku. All is well, and now I'm trying to solve the problem of how to manage my data. I found the plugin called "admin_data" and it seemed to be the right choice.
Admin_data works great locally but when I deploy it to heroku I just get the message "We're sorry, but something went wrong. (500)". If I restrict access I get the correct response of "not authorized".
I have no idea what's going wrong, and more importantly, don't know how to look into the cause of the error. Any tips on getting a verbose message from heroku or tuning admin_data are much appreciated.
Thanks!
'admin_data' by default only works in a 'development' environment.
You can either set your Heroku app to 'development' environment (http://docs.heroku.com/config-vars) or add your environment to an 'admin_data' config file (config instructions for a Rails 3 app are here: https://github.com/neerajdotname/admin_data/wiki/admin_data-security-configuration-for-a-Rails3-application):
AdminData.config do |config|
config.is_allowed_to_view = lambda {|controller| return true if (Rails.env.development? || Rails.env.test?) }
config.is_allowed_to_update = lambda {|controller| return true if (Rails.env.development? || Rails.env.test?) }
end