asp.net-mvc-4 – 如何使用Enterprise Library 6将异常,事件记录
发布时间:2020-12-16 06:23:48 所属栏目:asp.Net 来源:网络整理
导读:我正在使用 windows azure项目在Enterprise库6上工作.基于快速启动应用程序,我们可以将消息,事件记录到Xml文件或sql server.以下代码在示例应用程序中执行此操 this.fileListener = FlatFileLog.CreateListener("aExpense.DataAccess.log",formatter: new Xm
我正在使用
windows azure项目在Enterprise库6上工作.基于快速启动应用程序,我们可以将消息,事件记录到Xml文件或sql server.以下代码在示例应用程序中执行此操
this.fileListener = FlatFileLog.CreateListener("aExpense.DataAccess.log",formatter: new XmlEventTextFormatter(EventTextFormatting.Indented),isAsync: true); fileListener.EnableEvents(AExpenseEvents.Log,EventLevel.LogAlways,AExpenseEvents.Keywords.DataAccess); //Log to Rolling file informational UI events only this.rollingfileListener = RollingFlatFileLog.CreateListener("aExpense.UserInterface.log",rollSizeKB: 10,timestampPattern: "yyyy",rollFileExistsBehavior: RollFileExistsBehavior.Increment,rollInterval: RollInterval.Day,formatter: new JsonEventTextFormatter(EventTextFormatting.Indented),isAsync: true); rollingfileListener.EnableEvents(AExpenseEvents.Log,EventLevel.Informational,AExpenseEvents.Keywords.UserInterface); // Log all events to DB this.dbListener = SqlDatabaseLog.CreateListener("aExpense",WebConfigurationManager.ConnectionStrings["Tracing"].ConnectionString,bufferingInterval: TimeSpan.FromSeconds(3),bufferingCount:10); dbListener.EnableEvents(AExpenseEvents.Log,Keywords.All); 但我需要将所有这些事件和例外记录到Azure表存储.企业库6可以支持吗?怎么做 ? 解决方法
基于代码示例,看起来您正在使用语义记录块.有一个
Windows Azure sink for the Semantic Logging Application Block将登录到表存储. this.azuretableListener = WindowsAzureTableLog.CreateListener( RoleEnvironment.CurrentRoleInstance.Id,RoleEnvironment.GetConfigurationSettingValue("ConnectionString")); azuretableListener.EnableEvents(AExpenseEvents.Log,Keywords.All); 默认表名称为“SLABLogsTable”,但您可以指定其他名称. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net-mvc – Automapper和Windsor的问题
- .net – 数据绑定到LINQ到实体时的重复行
- C#_.NetFramework_Web项目_NPOI_EXCEL数据导入
- asp.net – page load()或者page init()
- entity-framework – EF Core:内置Created和Edited时间戳
- asp.net-mvc – MVC WebApi不使用AutofacWebApiDependencyR
- asp.net – VS 2010 Web.config转换进行调试
- 什么是ASP.NET-MVC 5.1中的ManageController.cs及其创建原因
- ASP.Net如何在没有用户第一次请求的情况下自动启动应用程序
- asp.net-mvc – 在ASP.NET MVC视图中允许多少逻辑?
推荐文章
站长推荐
热点阅读