I have custom xml file with the log4net configurations. Below code is used for configuring the log4net. It is working fine.
The question is how does LogManager.Getlogger gets the "MyLogger" when it doesnt know the config file details?
Should we maintain any sequence while calling LogManager.GetLogger and xmlconfigurator.configure ?
Class LoggerClass
{
private static readonly ILog fileLogger = LogManager.GetLogger("MyLogger");
public LoggerClass()
{
FileInfo logConfiguration = new FileInfo("ConfigFile.xml");
//Loading the configuration from the xml file.
XmlConfigurator.Configure(logConfiguration);
}
public void Log(string msg)
{
fileLogger.Log(......);
}
}