public
Clone URL: git://github.com/defunkt/exception_logger.git
Search Repo:
technoweenie (author)
Sun Jul 02 06:55:40 -0700 2006
commit  89fee3e9213d3fc6e100e7e9ef435d9dc6ed7d6d
tree    0346f7a5d68945e3266000eedd079611604ceaba
parent  d2b108761e91740a0cbe2b70fa50aa94c1dadc6e
name age message
folder README Sun Jul 02 06:55:40 -0700 2006 enhance readme docs [technoweenie]
folder Rakefile Fri Jun 23 21:43:30 -0700 2006 first public version of logged exceptions plugin [technoweenie]
folder assets/ Sun Jun 25 21:44:37 -0700 2006 send current query params when deleting all vis... [technoweenie]
folder generators/ Fri Jun 23 21:43:30 -0700 2006 first public version of logged exceptions plugin [technoweenie]
folder init.rb Sun Jul 02 06:55:40 -0700 2006 enhance readme docs [technoweenie]
folder install.rb Sun Jul 02 06:55:40 -0700 2006 enhance readme docs [technoweenie]
folder lib/ Sun Jul 02 06:55:40 -0700 2006 enhance readme docs [technoweenie]
folder tasks/ Fri Jun 23 21:43:30 -0700 2006 first public version of logged exceptions plugin [technoweenie]
folder test/ Fri Jun 23 21:43:30 -0700 2006 first public version of logged exceptions plugin [technoweenie]
folder uninstall.rb Fri Jun 23 21:43:30 -0700 2006 first public version of logged exceptions plugin [technoweenie]
folder views/ Sun Jun 25 21:36:09 -0700 2006 add delete visible option [technoweenie]
README
ExceptionLogger
===============

The Exception Logger (forgive the horrible name) logs your Rails exceptions in the database and provides a funky web 
interface to manage them.

First you need to generate the migration:

  ./script/generate exception_migration

Next, you'll need to include the ExceptionLoggable module into ApplicationController.  Once that's done you might want 
to modify key methods to customize the logging:

  render_404(exception) - Shows the 404 template.
  
  render_500(exception) - Shows the 500 template.
  
  log_exception(exception) - Logs the actual exception in the database.
  
  rescue_action_in_public(exception) - Does not log these exceptions: ActiveRecord::RecordNotFound, 
  ActionController::UnknownController, ActionController::UnknownAction

After that, visit /logged_exceptions in your application to manage the exceptions.

It's understandable that you may want to require authentication.  Add this to your config/environments/production.rb:

  # config/environments/production.rb
  config.after_initialize do
    require 'application' unless Object.const_defined?(:ApplicationController)
    LoggedExceptionsController.class_eval do
      before_filter :login_required
      protected
        # only allow admins
        # this obviously depends on how your auth system works
        def authorized?
          current_user.is_a?(Admin)
        end
    end
  end

The exact code of course depends on the specific needs of your application.

CREDITS

Jamis Buck  - original exception_notification plugin
Rick Olson  - model/controller code
Josh Goebel - design