Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正忙于处理 C# 库,我想将 Common.Logging 与 Log4Net 结合使用,但是,它会在主机应用程序 app.config 文件中查找相应的库设置。
有没有告诉 Common.Logging 查看不同的配置文件?
您可以在应用程序启动时执行此代码一次:
XmlConfigurator.ConfigureAndWatch(new FileInfo("log4net.config"));
您可以将其添加到AssemblyInfo.cs相同的结果中。
AssemblyInfo.cs
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)]