ELMAH.MVC is a useful NuGet package that provides an HTTP module to automatically log unhandled ("Yellow Screen Of Death") exceptions in your website, and provides a webpage to allow the exceptions to be reviewed. However, your MVC project is likely to use the built-in HandleErrorAttribute filter which, when custom errors are enabled, catches exceptions and renders the default error view. Since the errors are caught, they do not reach the ELMAH HTTP module and are never logged. Get round this by replacing the built-in HandleErrorAttribute with this ELMAHHandleErrorAttribute.

If you intend ELMAH to log exceptions to a SQL database, you should run the SQL setup script before starting up the website. The SQL script is reproduced below. For the latest version, see https://code.google.com/p/elmah/wiki/Downloads?tm=2.

Installing the ELMAH.MVC NuGet package will update web.config automatically, but you must still make some changes. Create a connection string for ELMAH to use (or point it at an existing connection string) and set elmah.mvc.disableHandleErrorFilter = "true" to prevent ELMAH from using its own built-in filter. If you do not change this setting, ELMAH's filter will run alongside your own and can result in exceptions being logged twice.