c# – Log4Net何时配置?

c# – Log4Net何时配置?,第1张

概述鉴于你有 [assembly: log4net.Config.XmlConfigurator(ConfigFile = "Log4Net.config", Watch = true)] 在AssemblyInfo.cs文件中,何时配置Log4Net?它是在应用程序启动时还是第一次使用记录器时? 当您调用LoggerManager类时,将使用配置文件.这通常是通过调用LogManager.GetLo 鉴于你有
[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.

总结

以上是内存溢出为你收集整理的c# – Log4Net何时配置?全部内容,希望文章能够帮你解决c# – Log4Net何时配置?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/langs/1249171.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-06-07
下一篇2022-06-07

发表评论

登录后才能评论

评论列表(0条)

    保存