MVC & Elmah - Can Elmah render using MVC site layout?

Lots of interesting information about Elmah and MVC 3/4. I have been using Elmah in projects for several years now.

One thing I haven't seen, asked, or pointed out is showing Elmah using the MVC site layout.

Has anyone ever tried this?

I am developing an MVC-4 project and have Elmah currently working in his own area. I used the Joel.net installation

It works very well as it is, but would love to hear from the community regarding the display of results in the site layout.

Any advice / suggestions are greatly appreciated.

+3


source to share


4 answers


There is a great article: http://dotnetdarren.wordpress.com/

This is a pretty extensive article about combining Elmah, health monitoring, Log4Net, and NLog to cover all the records you would ever need in any MVC application. It covers objects as well as Entity objects, controllers, views, etc. And it does it in one interface for all of them.

The article is dated (2010) and in MVC 2. I was able to take Darren's approach, convert it to VB.NET and run it all in a large MVC 4 application that I am working on.



Even if you don't use it, this is a great tutorial and well worth reading.

Enjoy and crazy Darren props for this article.

+3


source


No, at least not directly. Elmah uses HttpHandler to display errors that completely ignore the MVC pipeline.

You have several options that require additional work:



  • Create your own views. You may need to link to Elmah source as some of the required classes may be internal.
  • Show Elmah in an iframe in your own view. This is probably not the best option, but it should work.
  • Try Elmah.MVC , which looks like an MVC controller for Elmah:

Painless integration of ELMAH functions into ASP.NET MVC Application. Creates the admin area and the corresponding controller, so ELMAH is accessible via the / admin / elmah route.

+5


source


If you are using SQL Server Module for Elmah, you can save errors to SQL database. Once this is done, you can write your own application or page to read from the DB and present it in any way you want.

+1


source


If ("site layout" == in-line, on the page){
    edit the masterstylesheet to include elmah.
or 
    wire it into a jQuery plugin.
} else {
    have you considered Glimpse role in the display chain?
}

      

0


source







All Articles