Merged PR 788364: Address issue with shutdown sequence in AzureBlobStorageLog

This commit is contained in:
Julian Bayardo 2024-06-04 17:24:02 +00:00
Родитель 8e9c7529b5
Коммит 5914404e99
1 изменённых файлов: 17 добавлений и 17 удалений

Просмотреть файл

@ -287,6 +287,23 @@ namespace BuildXL.Cache.Logging.External
{
#pragma warning disable CA1031 // Do not catch general exception types
#pragma warning disable ERP022 // Unobserved exception in generic exception handler
try
{
Flush();
LogManager.Shutdown();
}
catch (Exception exception)
{
try
{
_host.Error(exception, "Failed to dispose NLog instance");
}
catch (Exception)
{
// We just don't want to interrupt the Dispose sequence
}
}
try
{
_log.ShutdownAsync().GetAwaiter().GetResult().ThrowIfFailure();
@ -303,23 +320,6 @@ namespace BuildXL.Cache.Logging.External
catch (Exception)
{
}
try
{
Flush();
NLog.LogManager.Shutdown();
}
catch (Exception exception)
{
try
{
_host.Error(exception, "Failed to dispose NLog instance");
}
catch (Exception)
{
// We just don't want to interrupt the Dispose sequence
}
}
#pragma warning restore ERP022 // Unobserved exception in generic exception handler
#pragma warning restore CA1031 // Do not catch general exception types
}