加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – Log4Net何时配置?

发布时间:2020-12-15 08:25:34 所属栏目:百科 来源:网络整理
导读:鉴于你有 [assembly: log4net.Config.XmlConfigurator(ConfigFile = "Log4Net.config",Watch = true)] 在AssemblyInfo.cs文件中,何时配置Log4Net?它是在应用程序启动时还是第一次使用记录器时? 解决方法 当您调用LoggerManager类时,将使用配置文件.这通常
鉴于你有
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "Log4Net.config",Watch = true)]

在AssemblyInfo.cs文件中,何时配置Log4Net?它是在应用程序启动时还是第一次使用记录器时?

解决方法

当您调用LoggerManager类时,将使用配置文件.这通常是通过调用LogManager.GetLogger引起的.

有关详细信息,请参阅http://logging.apache.org/log4net/release/sdk/log4net.Config.XmlConfiguratorAttribute.html;特别注意:

Log4net will only look for assembly level configuration attributes once. When using the log4net assembly level attributes to control the configuration of log4net you must ensure that the first call to any of the LoggerManager methods is made from the assembly with the configuration attributes.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读