Just trying to cement by understanding of how to handle system
exceptions/application errors/audit events for a Ruby on Rails
application.
How do people personally handle the following categories of events.
a) Uncaught exceptions (i.e. bubble up to top)
Usage: System failure / developer can’t do anything
Logging: How? Override rails exception framework to
issue a specific “logger.error” message? Check whether
a standard Rails “error” will be sent to the log by
default anyway…
Alerting: Use of “exception_notification” plugin.
b) Trapped exceptions (i.e. handle explicitly)
Usage: Understood application error (not system error)
/ Developer can offer value add
Logging: Issue a “logger.error” line
Alerting: How to hook into “exception_notification”
plugin?
c) Application Specific Audit
Usage: For application specific event (e.g. sale
has occurred) and want an email alert and log it too.
Logging: Via use of “logger.info” system (? or need
custom solution for audit logging?)
Alerting: How to hook into “exception_notification”
plugin from this point?
Any comments / ideas / best practice suggestions would be appreciated.
Just trying to cement by understanding of how to handle system
exceptions/application errors/audit events for a Ruby on Rails
application.
How do people personally handle the following categories of events.
I’ll add my personal opinions.
a) Uncaught exceptions (i.e. bubble up to top)
At my company, we use this option:
Alerting: Use of “exception_notification” plugin.
I highly recommend it. In fact, have this in place very early in
development. I often fix bugs using the information it provides,
before the client can even email me to report it.
b) Trapped exceptions (i.e. handle explicitly)
Usage: Understood application error (not system error)
/ Developer can offer value add
Logging: Issue a “logger.error” line
Alerting: How to hook into “exception_notification”
plugin?
I’m not sure I understand the question here. If you trapped the
error, you need to deal with it as make sense. That includes
recording it, if that’s useful information, and giving the user a
helpful error message.
c) Application Specific Audit
Usage: For application specific event (e.g. sale
has occurred) and want an email alert and log it too.
Logging: Via use of “logger.info” system (? or need
custom solution for audit logging?)
Alerting: How to hook into “exception_notification”
plugin from this point?
This sounds like a great candidate for a before_filter. If you place
all the controllers you wish to monitor in a hierarchy, you can set
the filter on the parent controller and add whatever handling is
appropriate.
Hope this helps.
James Edward G. II
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.