1. Installing Elmah through NuGet
ELMAH on XML log automatically adds configuration content to the Web. config file, does not allow remote access by default, log access path is Elmah.axd, 500 error is not logged
2. Modify the configuration file
500 increase in exception logging, allowing remote access
<Elmah> <!--See Http://code.google.com/p/elmah/wiki/SecuringErrorLogPages for more information in remote access an D Securing ELMAH. - <Securityallowremoteaccess= "true" /> <errorlogtype= "Elmah.xmlfileerrorlog, Elmah"LogPath= "~/app_data/elmah.errors" /> <Errorfilter> <Test> <Equalbinding= "HttpStatusCode"value= "404"type= "Int32" /> <Equalbinding= "HttpStatusCode"value= "$"type= "Int32" /> </Test> </Errorfilter> </Elmah>
modifying access paths
< LocationPath= "log.axd"inheritinchildapplications= "false"> <system.web> <httphandlers> <Addverb= "Post,get,head"Path= "log.axd"type= "Elmah.errorlogpagefactory, Elmah" /> </httphandlers> <!--See Http://code.google.com/p/elmah/wiki/SecuringErrorLogPages for more information on using ASP. Uthorization securing ELMAH. <authorization> <allow roles= "admin"/> <deny users= "*"/> </authorization> - </system.web> <system.webserver> <handlers> <Addname= "ELMAH"verb= "Post,get,head"Path="Log.axd"type= "Elmah.errorlogpagefactory, Elmah"Precondition= "Integratedmode" /> </handlers> </system.webserver> </ Location>
There are many Elmah extensions on NuGet that can be stored in other formats.
Three minutes integrated Elmah XML format log to MVC site