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.
例如,像
LogManager.GetLogger("C:\myloggerconfig.xml", "MyLoggerName");
最简单的方法是将以下代码放入您的AssemblyInfo.cs文件中:
AssemblyInfo.cs
[assembly: log4net.Config.XmlConfigurator(ConfigFile="c:\\myloggerconfig.xml",Watch=true)]
您也可以以编程方式执行此操作:
XmlConfigurator.Configure(new System.IO.FileInfo("c:\\myloggerconfig.xml");