elmah的使用
来源:互联网 发布:python开发应用 编辑:程序博客网 时间:2024/06/09 20:46
在C#.Net 网站项目中,经常需要做一些记录错误日志的工作,之前的做法是通常把错误Exception记录到某一张错误日志的数据表中,但做了需要连接VPN的项目之后,对每次查看错误日志,访问数据库的速度真是不能让人满意,遂找了elmah第三方的记录日志的工具来做错误备份,而且elmah 支持很多格式,保存XML或者log记事本文件,以及保存到数据库都支持。我这里只做了保存XML格式在服务器硬盘中,查阅起来也很方便。
1.web.config 配置项目
<?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" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah"/> </sectionGroup> </configSections> <!--此处配置了记录Log的文件路径--> <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> <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> </configuration>配置完毕,网站代码中不需要增加其他任何执行代码。
如何查看elmah日志,直接在Web站点后加入elmah,axd 即可。
如:http://localhost:3721/elmah.axd
- ELMAH的使用
- elmah的使用
- elmah的使用
- Elmah使用总结
- 关于日志管理Elmah的使用(我这里只谈Access的)
- 网站记录错误日志的工具ELMAH
- 关于MVC4中Elmah配置和ViewBag的两个问题
- 利用Elmah和Google体验一把入侵的快感
- ELMAH使用方法
- Elmah log4net
- Elmah .net 最方便最好用的日志,异常记录插件
- Elmah 日志记录组件
- Elmah 日志记录组件
- ASP.NET错误日志处理模块 ELMAH
- Elmah框架,添加日志文件访问权限
- Elmah框架,添加日志文件访问权限
- ELMAH——可插拔错误日志工具
- ELMAH——可插拔错误日志工具
- 【openstack】Nova(Folsom)虚拟化层Driver分析
- 执行外部程序
- 布局中的Padding与Margin的区别
- 单链表
- SQLite3学习之基本SQL语法使用-wince6.0
- elmah的使用
- 如何通过CuteFTP实现在windows环境下和Ubuntu进行文件相互传输
- gdb fork进程,多线程调试
- smarty中if elseif的简单应用(左中右对齐)
- sql语句联合及联系
- 自定义SearchView
- 烟雨江南
- 判断一个点是否在多边形区域内
- VBScript:如何获取数组实际长度