使用Microsoft Enterprise Library 5.0日志提供程序进行服务堆栈

时间:2013-05-14 21:47:30

标签: .net rest servicestack enterprise-library-5

我有一个基于ServiceStack框架的项目,我想使用Microsoft Enterprise Library 5.0的Logging提供程序,以下是我遵循的步骤:

(1)安装MS Enterprise Library 5.0的服务日志提供程序:      Install-Package ServiceStack.Logging.EnterpriseLibrary5

(2)在项目中创建了一个文件EntLib.Config,内容为https://github.com/ServiceStack/ServiceStack.Logging/blob/master/tests/ServiceStack.Logging.Tests/entlib5.test.config

(3)在服务应用程序主机中配置LogFactory以使用EntLib5Factroy:

 public override void Configure(Funq.Container container)
 {
     LogManager.LogFactory = new EntLib5Factory(<Path-to-above-EntLib.config-file>);
     SetConfig(new EndPointHostConfig(DebugMode = true });
 }

启动应用程序后,我可以看到错误:

应用程序中的服务器错误。


不支持DebugFormat方法。使用loggingConfiguration部分中的格式化程序修改日志消息格式。 描述:执行当前Web请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

异常详细信息:System.NotSupportedException:不支持DebugFormat方法。使用loggingConfiguration部分中的格式化程序修改日志消息格式。

来源错误: 在执行当前Web请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常的起源和位置的信息。

堆栈追踪:

[NotSupportedException:不支持DebugFormat方法。使用loggingConfiguration部分中的格式化程序修改日志消息格式。    ServiceStack.Logging.EntLib5.EntLib5Logger.DebugFormat(String format,Object [] args)+96    ServiceStack.WebHost.Endpoints.Support.HttpHandlerBase.ProcessRequest(HttpContext context)+322    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()+100    System.Web.HttpApplication.ExecuteStep(IExecutionStep step,Boolean&amp; completedSynchronously)+75

0 个答案:

没有答案