Use of elmah

Source: Internet
Author: User

In C #. net website projects often need to record error logs. The previous practice is to record error exceptions to the data table of an error log, however, after a project needs to be connected to the VPN, the access speed to the database is really unsatisfactory for every view of the Error Log, so I found a third-party elmah logging tool for error backup, elmah supports many formats, including saving XML or log notepad files and saving them to the database. I only saved the XML format on the server hard disk here, which is convenient for reference.

1. Web. config configuration item

<? XML version = "1.0"?> <! -- For more information on how to configure your ASP. NET application, please visit http://go.microsoft.com/fwlink? Linkid = 169433 --> <configuration> <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 "requ Irepermission = "false" type = "elmah. errorfiltersectionhandler, elmah"/> </sectiongroup> </configsections> <! -- The log file path is configured here --> <elmah> <! -- Allowremoteaccess attribute indicates whether remote access is allowed. if this value is set to 0, then the error log web page can only be viewed locally. if this attribute is set to 1 then the error log web page is enabled for both remote and local visitors. --> <Security allowremoteaccess = "1"/> <errorlog type = "elmah. xmlfileerrorlog, elmah "logpath =" D: \ Scott \ projects \ AZ sales \ 06. construction \ sourcecode \ azsales \ log "/> </elmah> <system. web> 

After the configuration is complete, no other code is added to the website code.

To view elmah logs, add elmah and axd to the web site.

For example, http: // localhost: 3721/elmah. axd

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.