0

Whenever runnning in production, RoR displays only warnings and errors, which is fine.

Howver, the logger does not display detailed information about the error : no timestamp, no IP address, no user request.

I tried creating a custom Logger, but it does not allow me to get the IP address and actual user request without using evil methods (since it's within a model).

Ideally, I'd like to have messages such as :

 Started GET "/api/request?" for 89.80.x.x at Mon Nov 21 17:29:08 +0100 2011 

And the strack trace of the error below. But these should only be displayed for warnings and errors, and the end user should not see them( so consider_all_requests_local should be off).

Any way to achieve this ?

manu_v
  • 1,248
  • 2
  • 12
  • 21
  • Stack trace of error below? Perhaps you should look inside [`log4r`](http://stackoverflow.com/questions/5664136/how-to-configure-log4r-with-rails-3-0-x) and how to integrate it with rails (there should be a more simple way compared to the linked question). – mliebelt Nov 21 '11 at 19:38

1 Answers1

1

Exceptions in production mode should not happen often, so I went for this gem: Exception Notification.

An exception in production mode should be dealt with immediately so this is (for me at least) better then logging the error.

Sindri Guðmundsson
  • 1,253
  • 10
  • 24
  • I, too, use the [Exception Notification](https://github.com/rails/exception_notification) gem, which allows me to have the production server only show friendly error pages while I get all the nasty details almost immediately. In fact, my friendly error pages tell the user that a notification has been sent, so they don't even have to do anything. – Matthew Clark Oct 26 '12 at 20:34