Sometimes we might have to place the log files away from the location where the application is installed. And lo there is an option to do that! In the config file create a variable like below
<file type="log4net.Util.PatternString" value="%property{SomeVariable}log.txt" />
And in the code, before calling log4net configure, set the new path to the Variable
log4net.GlobalContext.Properties["SomeVariable"] = YourNewPath;
log4net.Config.XmlConfigurator.Configure();
Simple isn’t it ![]()