ElmahR Introduction

What’s Elmah

Elmah stands for Error Logging Modules and Handlers and is used to log unhandled exceptions to the file system, event log, databases or even have it email you the errors.

What’s ElmahR (ElmahR = Elmah + SingalR)

ElmahR is a web dashboard where you can aggregate several monitored applications; adding them to ElmahR configuration will enable them to post error events, which will show them on all the connected client dashboards in real-time.ElmahR is about error logging in real-time, and to do that it’s based on ELMAH for the ‘error logging’ part and on SignalR for the ‘real-time notification’ piece.ElmahR is an open source project which is assembled from several other open sources projects, trying to find the right Lego pieces to reach its goal. YSOD = Yellow Screen of Death

Url

Elmah & Dashboard

Elmah: http://hostname/elmah.axd
Dashboard: http://hostname/elmahr/dashboard

Module

ErrorLog


ErrorEmail


ErrorFilter

The following markup instructs ELMAH to not log 404 errors.






We can also implement it by code, add below code to Global.asax

// Don't forget to reference the Elmah assembly and import its namespace.
void ErrorLog_Filtering(object sender, ExceptionFilterEventArgs e)
{
if (e.Exception.GetBaseException() is HttpRequestValidationException)
    e.Dismiss();
}

ErrorPost


Log type

in Memory


XML


SqlLite


SQL Server


Rss

Setup

Create a brand new web application, mvc or normal web app works fine.

Using Nuget add the following packages to your blank MVC solution, so add Elmah and JQuery.

Install Elmah

install-package Elmah

When finished, the below code will be added to the web.config


  
...

Install ElmahR.core + ELmahR.DashBoard

install-package ElmahR.Elmah
install-package ElamhR.Modules.DashBoard

When finished, the below code will be added


Change it to


Add a declaration of the application:


How to add another site to Dashboard

Create another site

Run below command:

install-package elmah
install-package elmahr.elmah

Modify the node to


Add annode to host’s web.config


ThesourceId must match the one in<errorPost>

<system.web> & <system.webserver>

system.web is for Classic Mode. system.webserver is for Integrated Pipeline Mode (available in IIS7+).


    
    
    
    

And this:

    
    
    
    

How to add a module

1. Add a handler to SectionGroup

2. Add a module to modules


3. Add element to elmah






References

ElmahR – Elmah fused With SignalR
Config ElmahR
ElmahR Wiki
ELMAH – Error Logging Modules And Handlers
Logging Errors with ELMAH in ASP.NET MVC 3 – Part 3 – (Filtering)

博主开通了微信公众号,欢迎关注啦

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.