I have a class to whose every instance i create a new logger and attache a buffer appender and a flie appender to it. Everything is being done runtime and no information is picked from the config file.
Now to release resources at the class's custom dispose method i need to shutdown that specific logger and release all of its attached resources so as to avoid any memory leak.
At the moment what i have been doing is atleast flush the file appender and write all logging information but that neither releases the lock on that specific logging file nor does it release any of its resources.
What is the proper way of shutting down the logger while not shutting down other active loggers that are in process
log4net.ILog log = log4net.LogManager.GetLogger(loggerName);
foreach (IAppender iapp in log.Logger.Repository.GetAppenders())
{
BufferingAppenderSkeleton buffered = iapp as BufferingAppenderSkeleton;
if (buffered is BufferingForwardingAppender)
{
((BufferingForwardingAppender)buffered).Flush();
}
}
log.Logger.Repository.Shutdown();
I hope i have made my question clear enough :)