rails no error details on production - ruby-on-rails

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.

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

Getting detailed errors in 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

for rails actionmailer, any way to debug ActionView::Template::Error errors?

In my rails 3.1 app, I do have
config.action_mailer.raise_delivery_errors = true
in my development.rb file (and, yes, have restarted by local dev server since changing that to true).
However, as I develop new email templates and run into the occasional ActionView::Template::Error
I'm not seeing any of the debugging info being put out as to which line threw the error. (As opposed to when one of my normal app views has a problem the log shows the snippet of the haml source with the problem).
IS there a way to turn on similar debugging messages for mailers?
I use rails console instead of making a web request to test action mailer. It will gives a-lot more info if an error ocures.
$ rails c
> MyMailer::maielr_name( var1, var2 ).deliver!

Why is debugging information not showing in my Rails development environment?

I've just recently upgraded from Rails 3.0.9 to 3.2.8 and I am seeing user-friendly error pages for my errors instead of the usual error messages.
I've checked the following:
Ran a Rails.env and it showed I was in development
My development.rb has config.consider_all_requests_local = true
I've searched on google and couldn't find anything else. Is there anything else I'm missing here?
Thanks!
As said in User-friendly error pages not displaying in production environment
The other criteria for showing the errors is request.local?
So maybe your ip is not showing as a local one to rails (i.e. you are using a proxy). If so or request.local? is not true you could try the patch mentioned in above question (but of course return true and not false ;)

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