O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

ELMAH

1.054 visualizações

Publicada em

This presentation is an introduction to an error logging tool ELMAH. We will learn how to implement and use ELMAH in a .net web application.

Publicada em: Software
  • Seja o primeiro a comentar

  • Seja a primeira pessoa a gostar disto

ELMAH

  1. 1. ELMAH Error Logging Modules And Handler Presenter: Harsh Wardhan, Mindfire Solutions Date: 08/07/2015
  2. 2. Presenter: Harsh Wardhan, Mindfire Solutions Agenda - Importance of error logging. - Introducing ELMAH. - Installing and configuring ELMAH. - Best practices.
  3. 3. Presenter: Harsh Wardhan, Mindfire Solutions Importance of error logging  Helps in tracking bug.  Helps to evaluate application health.  Organised logs save development time.
  4. 4. Presenter: Harsh Wardhan, Mindfire Solutions Introducing ELMAH  Stands for Error Logging Modules And Handlers.  An open source project created by Atif Aziz.  Completely pluggable.  Logs nearly all unhandled exceptions.  Provides a web page to display all the logged errors.
  5. 5. Presenter: Harsh Wardhan, Mindfire Solutions Introducing ELMAH  Provides e-mail, twitter notification for all the errors as they occur.  RSS feed of last 15 errors logged.  Provides different log storing options including in- memory, SQL Server, SQLite.
  6. 6. Presenter: Harsh Wardhan, Mindfire Solutions Installing ELMAH  Adding ELMAH assembly. Just drop the dll on your application's bin folder. OR Install ELMAH NuGet package.
  7. 7. Presenter: Harsh Wardhan, Mindfire Solutions Configuring ELMAH  Adding a section group which has information on how to log exceptions.  Adding a http module to log exception.  Adding a http handler to view exception.  Elmah section to set the logger type and other settings.
  8. 8. Presenter: Harsh Wardhan, Mindfire Solutions Configuring ELMAH  Adding a section group which has information on how to log exceptions. <configSections> <sectionGroup name="elmah"> <section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah"/> <section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" /> <section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah" /> <section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah"/> </sectionGroup> </configSections>
  9. 9. Presenter: Harsh Wardhan, Mindfire Solutions Configuring ELMAH Adding a http module to log exception. <system.webServer> <validation validateIntegratedModeConfiguration="false"/> <modules> <add name="Elmah.ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" /> </modules> <handlers> <add name="Elmah" path="elmah.axd" verb="POST,GET,HEAD" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" /> </handlers> </system.webServer>
  10. 10. Presenter: Harsh Wardhan, Mindfire Solutions Configuring ELMAH  Adding a http handler to view exception. <system.web> <httpHandlers> <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" /> </httpHandlers> <httpModules> <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/> </httpModules> </system.web>
  11. 11. Presenter: Harsh Wardhan, Mindfire Solutions Configuring ELMAH  Elmah section to set the logger type and other settings. <elmah> <errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="ELMAHConnectionString" /> </elmah>
  12. 12. Presenter: Harsh Wardhan, Mindfire Solutions Logging handled exceptions  Raise an exception using ErrorSignal class of elmah. ErrorSignal.FromCurrentContext().Raise(new Exception("I did it..."));
  13. 13. Presenter: Harsh Wardhan, Mindfire Solutions Best Practices  Secure your logs by restricting remote access. <elmah> <security allowRemoteAccess="False" /> </elmah>  Set roles to access the log.
  14. 14. Presenter: Harsh Wardhan, Mindfire Solutions Question and Answer
  15. 15. Presenter: Harsh Wardhan, Mindfire Solutions Thank you

×