
[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何时配置?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)