Hi,
I'm trying to programmatically change the log file destination for a logger 
using the following code
found on this list:

public static void UpdateFileAppenderPaths(string theNewPath) {
  log4net.Repository.Hierarchy.Hierarchy h =
  (log4net.Repository.Hierarchy.Hierarchy) log4net.LogManager.GetRepository();
  foreach (IAppender a in h.Root.Appenders) {

    if (a is FileAppender) {
      FileAppender fa = (FileAppender) a;
      fa.File = theNewPath;
      fa.ActivateOptions();
    }
  }
}

 However, I've found that my logger doesn't show up in the Hierarchy returned.  
My best guess is that it
is because it has additivity = false and is therefore outside of the h.Root 
structure.
Can someone confirm this guess?
If I'm correct, can you also tell me how to gain access to the appender to 
change the file path?

Thanks,

Dan

Reply via email to