My application uses several applications - a FileAppender
, MemoryAppender
and MemoryAppender
. I have a command to reset the log so that a new file is created on demand. This works fine - I just call log4net.LogManager.GetRepository().Shutdown()
.
I also log in simultaneously with MemoryAppender
, and I have a timer that pulls events from the application and displays them in the log window. When I use the above reset function, the log window stops displaying messages because no more events are being logged.
For FileAppender
I was able to run it again by calling ActivateOptions
after setting the correct file name. I called ActivateOptions
on MemoryAppender
, but that does not force it to start recording again. Before calling ActivateOptions
I looked at the object to make sure it is already configured. It actually saves the configuration from the moment I called the reset function, so it looks fine.
I also searched the Internet and people said that you just need to call log4net.Config.DOMConfigurator.Configure
(deprecated - now it is log4net.Config.XmlConfigurator.Configure`), but that didnโt work either.
Is there another way that I can try to end / restart logging while supporting File, Memory and Ado applications?
source share