bug(logging): add full exception to logging (#4645)
* bug(logging): add full exception to logging * - remove stack trace from operation exceptions thrown --------- Co-authored-by: Nathan Lemma (Waferwire LLC) <v-nlemma@microsoft.com>
This commit is contained in:
Родитель
76d9c46620
Коммит
1d80f9a0e5
|
@ -255,7 +255,7 @@ namespace Microsoft.Health.Fhir.Api.Controllers
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError("Error parsing launch parameters: {Message}", ex.Message);
|
||||
_logger.LogError(ex, "Error parsing launch parameters: {Message}", ex.Message);
|
||||
throw new AadSmartOnFhirProxyBadRequestException(Resources.InvalidLaunchContext, ex);
|
||||
}
|
||||
|
||||
|
@ -368,7 +368,7 @@ namespace Microsoft.Health.Fhir.Api.Controllers
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError("Error decoding compound code: {Message}", ex.Message);
|
||||
_logger.LogError(ex, "Error decoding compound code: {Message}", ex.Message);
|
||||
throw new AadSmartOnFhirProxyBadRequestException(Resources.InvalidCompoundCode, ex);
|
||||
}
|
||||
|
||||
|
|
|
@ -205,7 +205,7 @@ namespace Microsoft.Health.Fhir.Azure.IntegrationDataStore
|
|||
}
|
||||
catch (RequestFailedException ex) when (ex.ErrorCode == BlobErrorCode.LeaseAlreadyPresent)
|
||||
{
|
||||
_logger.LogInformation("{Message}: {ResourceUri}", ex.Message, resourceUri);
|
||||
_logger.LogInformation(ex, "{Message}: {ResourceUri}", ex.Message, resourceUri);
|
||||
}
|
||||
catch (RequestFailedException se)
|
||||
{
|
||||
|
|
|
@ -860,7 +860,7 @@ namespace Microsoft.Health.Fhir.CosmosDb.Features.Storage
|
|||
}
|
||||
catch (CosmosException ex)
|
||||
{
|
||||
_logger.LogWarning("Failed to obtain provisioned RU throughput. Error: {Message}", ex.Message);
|
||||
_logger.LogWarning(ex, "Failed to obtain provisioned RU throughput. Error: {Message}", ex.Message);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace Microsoft.Health.Fhir.Core.Features.Resources.Patch.FhirPathPatch.Oper
|
|||
}
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
throw new InvalidOperationException($"{ex.Message} at {Operation.Path} when processing patch add operation.");
|
||||
throw new InvalidOperationException($"{ex.Message} at {Operation.Path} when processing patch add operation.", ex);
|
||||
}
|
||||
|
||||
return ResourceElement.ToPoco<Resource>();
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace Microsoft.Health.Fhir.Core.Features.Resources.Patch.FhirPathPatch.Oper
|
|||
}
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
throw new InvalidOperationException($"{ex.Message} for {Operation.Path} when processing patch delete operation.");
|
||||
throw new InvalidOperationException($"{ex.Message} for {Operation.Path} when processing patch delete operation.", ex);
|
||||
}
|
||||
|
||||
if (Target is not null)
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace Microsoft.Health.Fhir.Core.Features.Resources.Patch.FhirPathPatch.Oper
|
|||
}
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
throw new InvalidOperationException($"{ex.Message} at {Operation.Path} when processing patch insert operation.");
|
||||
throw new InvalidOperationException($"{ex.Message} at {Operation.Path} when processing patch insert operation.", ex);
|
||||
}
|
||||
|
||||
var listElements = targetParent.Children(name).ToList()
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace Microsoft.Health.Fhir.Core.Features.Resources.Patch.FhirPathPatch.Oper
|
|||
}
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
throw new InvalidOperationException($"{ex.Message} at {Operation.Path} when processing patch move operation.");
|
||||
throw new InvalidOperationException($"{ex.Message} at {Operation.Path} when processing patch move operation.", ex);
|
||||
}
|
||||
|
||||
// Check indexes
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace Microsoft.Health.Fhir.Core.Features.Resources.Patch.FhirPathPatch.Oper
|
|||
}
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
throw new InvalidOperationException($"{ex.Message} at {Operation.Path} when processing patch replace operation.");
|
||||
throw new InvalidOperationException($"{ex.Message} at {Operation.Path} when processing patch replace operation.", ex);
|
||||
}
|
||||
|
||||
return ResourceElement.ToPoco<Resource>();
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace Microsoft.Health.Fhir.Core.Features.Operations.Export
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError("Failed to fetch Anonymization configuration file: {ConfigLocation}", exportJobRecord.AnonymizationConfigurationLocation);
|
||||
_logger.LogError(ex, "Failed to fetch Anonymization configuration file: {ConfigLocation}", exportJobRecord.AnonymizationConfigurationLocation);
|
||||
throw new AnonymizationConfigurationFetchException(ex.Message, ex);
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ namespace Microsoft.Health.Fhir.Core.Features.Operations.Export
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError("Failed to parse configuration file: {Message}", ex.Message);
|
||||
_logger.LogError(ex, "Failed to parse configuration file: {Message}", ex.Message);
|
||||
throw new FailedToParseAnonymizationConfigurationException(ex.Message, ex);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace Microsoft.Health.Fhir.SqlServer.Features.Search
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogWarning("Error refreshing CustomQuery cache. This will try again on next search execution. Error: {ExceptionMessage}", ex.Message);
|
||||
logger.LogWarning(ex, "Error refreshing CustomQuery cache. This will try again on next search execution. Error: {ExceptionMessage}", ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1321,7 +1321,7 @@ SELECT isnull(min(ResourceSurrogateId), 0), isnull(max(ResourceSurrogateId), 0),
|
|||
}
|
||||
catch (SqlException ex)
|
||||
{
|
||||
logger.LogWarning("ResourceSearchParamStats.CreateStats: Exception={Exception}", ex.Message);
|
||||
logger.LogWarning(ex, "ResourceSearchParamStats.CreateStats: Exception={Exception}", ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1340,7 +1340,7 @@ SELECT isnull(min(ResourceSurrogateId), 0), isnull(max(ResourceSurrogateId), 0),
|
|||
}
|
||||
catch (SqlException ex)
|
||||
{
|
||||
logger.LogWarning("ResourceSearchParamStats.Init: Exception={Exception}", ex.Message);
|
||||
logger.LogWarning(ex, "ResourceSearchParamStats.Init: Exception={Exception}", ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -231,7 +231,7 @@ INSERT INTO dbo.Parameters (Id,Number) SELECT @LeasePeriodSecId, 10
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Trace.TraceError("Failed to delete database: " + ex.Message);
|
||||
Trace.TraceError($"Failed to delete database: {ex.Message}. Stack Trace: {ex.StackTrace}. Inner Exception: {ex.InnerException?.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -352,7 +352,7 @@ namespace FHIRDataSynth
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"ERROR! {ex.Message}");
|
||||
Console.WriteLine($"ERROR! {ex}");
|
||||
|
||||
// Console.WriteLine("Press enter to close application.");
|
||||
// Console.ReadLine();
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace FHIRDataSynth
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"ERROR: {ex.Message}");
|
||||
Console.WriteLine($"ERROR: {ex}");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ namespace FHIRDataSynth
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"ERROR: {ex.Message}");
|
||||
Console.WriteLine($"ERROR: {ex}");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ namespace FHIRDataSynth
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"ERROR: {ex.Message}");
|
||||
Console.WriteLine($"ERROR: {ex}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ namespace ResourceProcessorNamespace
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogError($"Exception: {ex.Message}");
|
||||
LogError($"Exception: {ex}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче