Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9225293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:32:32+00:00 2026-06-18T04:32:32+00:00

I have MVC3 application where it is extremely important that all errors that may

  • 0

I have MVC3 application where it is extremely important that all errors that may happen in production will be properly logged.

Current approach uses IExceptionFilter.OnException. The functionality is applied on BaseContorller, from which all other controllers inherit, and looks (slightly simplified) as follows:

public class BaseController : Controller, IExceptionFilter
{        
    protected override void OnException(ExceptionContext exceptionContext)
    {
        Logger.Error(exceptionContext.Exception);
    }
}

This approach works very well, for:

  • exceptions that originate in code within controller action methods

  • exceptions that originate in views returned by controllers methods,
    including compilation errors

  • exceptions in filters applied to controller

However there are exceptions that will not be caught using this approach:

  • exceptions thrown within controller constructor
  • exceptions thrown in application routines such as: RegisterGlobalFilters, RegisterRoutes, Application_Start
  • page not found (404)

Are there any other types of exceptions you can think of that can be missed with controller level exception handling?

I am asking because I will likely implement additional layer of logging using Application_Error or ELMAH, and I want to verify that none of those exceptions slips through unlogged.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T04:32:33+00:00Added an answer on June 18, 2026 at 4:32 am

    Anything that doesn’t go through the MVC pipeline would not be caught by this implementation. HttpHandlers, WebAPI implementations, ServiceStack addition, etc.

    An additional layer of Elmah doesn’t hurt, but I would probably just pick one or the other. If you fragment your error handling you could be doubling your work when debugging.

    “Did my logger catch it or did Elmah catch it?”

    Since Elmah is close to the ASP.NET metal, I would just stick with Elmah and keep your exceptions in one place.

     NuGet Install-Package Elmah.MVC
    

    As a side note, you might still want a logger to do tracing but that is a lot more explicitly expressed in your code than an unhandled exception.

     Logger.Info("Just got another Sale, W00t!")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET MVC3 application that I have built and it has two
I have a ASP.NET MVC3 application that handles time-consuming processes (copying a large file
i have created an mvc3 web application that uses forms based authentication. one part
I have an MVC3 application, I know that for relative paths, I can use
I'm stumped. I have an MVC3 application that is using FormsAuthentication with a custom
I have MVC3 application that runs under mono on linux. I have this route:
I have an MVC3 application that takes 30+ seconds for global.asax Application_Start() to execute.
I have an MVC3 application the displays the current time locally, but displays the
My Problem: I have an MVC3 application where all views use a common master
I have an existing MVC3 application and database that is on a SQL Server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.