This works:
http://geekswithblogs.net/wpeck/archive/2009/10/08/setting-log4net-fileappender.file-at-runtime.aspx[
^]
Be sure that the mentioned
Initialize method is called after
log4net.Config.XmlConfigurator.Configure() is called. This is not mentioned in the article but can be overlooked.
At runtime any path defined in the config file will be replaced by
logDirectory while the name of the log file remains the same.
<param name="File" value="C:\\TestProj\\TestProj/Info.txt" />
(check if the forward slash in /Info.txt is OK to use)
Maybe you do not want to replace the complete path but add a base directory at runtime instead. The config file would look like this:
<param name="File" value="\\Some\\Relative\\Path\\Info.txt" />
Then the following code line needs to change in order to concatenate the base and relative path (I guess you can figure that out for yourself):
fileAppender.File = Path.Combine(logDirectory, Path.GetFileName(fileAppender.File));