private static void LogManager_OnStopLogging(object sender, EventArgs args)
{
try
{
InternalLogger.Info("Shutting down logging...");
factory.Close(TimeSpan.FromMilliseconds(1500)); // Finalizer thread has about 2 secs, before being terminated
CurrentAppDomain = null; // No longer part of AppDomains
InternalLogger.Info("Logger has been shut down.");
}
catch (Exception ex)
{
if (ex.MustBeRethrownImmediately())
throw;
InternalLogger.Error(ex, "Logger failed to shut down properly.");
}
}
}