Can I get a Logger by specifying a file that contains a log4net configuration?
For example, like
LogManag开发者_StackOverflower.GetLogger("C:\myloggerconfig.xml", "MyLoggerName");
The simplest way is to drop the following code into your AssemblyInfo.cs
file:
[assembly: log4net.Config.XmlConfigurator(ConfigFile="c:\\myloggerconfig.xml",Watch=true)]
You can also do it programatically:
XmlConfigurator.Configure(new System.IO.FileInfo("c:\\myloggerconfig.xml");
精彩评论