Getting detailed errors in Rails - ruby-on-rails

Somehow my local Rails app is no longer showing detailed error messages. Instead, it shows "We're sorry, but something went wrong." by default. This means I have to check the log each time. I tried forcing the server to start in development mode by running:
RAILS_ENV=development bundle exec rails s
Any ideas on how to get the error logging back?

Instead, it shows "We're sorry, but something went wrong."
This is in production, I take it? If so, this is as intended. You don't display detailed error messages (with stacktraces and sensitive data) to end users.
So yes, either watch your logs, or set up one of the many exception tracking services (honeybadger, sentry, etc.)
If you want to do it anyway (against all advice), set this in your config/environments/production.rb
config.consider_all_requests_local = true

Related

How to turn off the red/grey error help page tool in rails development environment?

I'm trying to replicate a bug in development which come from the production environment.
When the bug occurs I should see a 500 server error, but rails is displaying the following page to me, which is not what I want:
the grey rails error page
(the error in the image is not the one I'm trying to reproduce, but it shows they error page, which is what I'm talking about here)
How can I turn off this feature from rails so it just display a 500 error that a normal user will see?
And what is this tool/page called? I usually just call it the (red) rails error page. (but in this case it is grey for some reason, I don't know why too. Does anyone know?)
Try to the following
# config/environments/development.rb
config.consider_all_requests_local = false
By default, this value is true because of the need to debug code on development environment that's why, if you change value with false then will show the error page which is designed default.
If you need to generate and design custom then the follow this tutorial.
Hope to help
What about run rails in production environment?
rails server -e production

How to disable explicit stack traces on Ruby on Rails website

I have a Ruby on Rails Spree commerce app where I have explicit stack traces enabled in production (e.g., instead of the "We're sorry but something went wrong" message there is a long stack trace with developer-friendly and user unfriendly information).
I remember that I activated this to see what went wrong in production, but now I want to disable it again. Unfortunately I cannot find nor remember how to do this.
I hope someone can tell me how to configure my app to redirect to the standard 500 and 404 pages.
Open project_root/config/environments/production.rb
And set config.consider_all_requests_local = false

rails no error details on production

I'm having big problems with finding what is causing my rails app to return 500 internal error when I call a controller action. I tried setting the config.log_level = :debug in the production.rb environment, but rails won't write display or write any details about the error in the production.log.
If I run the same app and do the same action on my local machine in development mode, I don't get any error.
How should I reveal what is causing the error? I also tried using errorapp.com but no error will be reported there..
Thanks for help
I use the exception_notification gem link
in all my rails apps. When configured with the mail settings it will email you when an exception occurs with the error info.

running server in development mode in rails with error screen

I try to use server in development mode that gives errors on html page instead of the message "We're sorry, but something went wrong.". It starts in development mode but it does not give the error information and still gives the same silly message. How can I make it open the error info. on html page when an error is occurred.
In your environment file either development.rb or production.rb do this:
config.consider_all_requests_local = true

Logging stacktraces when running a Rails app on Thin

This is probably something stupid as I have never deployed a Rails app before. However:
I developed the app using WEBrick. When I got an exception, I'd get a helpful stacktrace in the console. Now I am deploying the app to Thin, running as a Windows service (I am not using Windows by choice, I hasten to add).
When the app gets an exception running in Thin, all I get in the logs is: Completed 500 Internal Server Error in 31ms. No stacktrace or description of the error. When I run it in Thin in the console I get a description of the error, but no class name or line number. I'm sure it's some simple config but a bit of googling has turned up nothing so far. Can anyone shed any light on how to get more informative error logging?
On a related note, what's the simplest and best way to set up email notifications on error in a Rails app?
Ignore me - I was being stupid. I created some extra environments for the app (a sales and a uat environment) and foolishly copied config/environments/test.rb which has
config.action_dispatch.show_exceptions = false
and I now feel quite foolish.
what's the simplest and best way to set up email notifications on error in a Rails app?
The exception_notification gem.

Resources