使用 MS Enterprise Library 进行日志记录

标签 logging enterprise-library app-config

我在我的类库中使用 MS Enterprise Library 4.1 版。在 app.config 文件中,我在配置文件中插入了“loggingConfiguration”和“exceptionHandling”的适当条目。但是,它会崩溃,即“在配置源中找不到日志记录的配置部分。”

configSections

<configSections> 
    <section name="loggingConfiguration"
             type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSetting‌​s, Microsoft.Practices.EnterpriseLibrary.Logging, 
                   Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> 
    <section name="exceptionHandling" 
             type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.Exce‌​ptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, 
                   Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

最佳答案

正如错误所示,您还需要在 configSection 中链接它们(仅输入loggingConfiguration和ExceptionHandling节点是不行的)。

This MSDN pages has some Hands on Labs我发现这非常有用

关于使用 MS Enterprise Library 进行日志记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6507663/

相关文章:

java - Spring boot - 如何获取 WARN 的框架日志记录和 DEBUG 的应用程序日志记录

logging - Elasticsearch 索引比它索引的日志的实际大小大得多?

c# - 如何在不同应用程序域中运行的应用程序之间共享缓存数据?

c# - 如何使用反射和app.config调用wcf?

logging - 使用辅助角色azure解析iis日志

php - 使用 PHP 从文件中读取最后几行(即 "tail")的最佳方法是什么?

c# - 企业库异常: Activation error occured while trying to get instance of type ICacheManager, key ?

.net - .Net对象验证

c# - 基于 log4net 中构建配置的不同附加程序

c# - 读取配置文件在另一台计算机上不起作用