Refactored the error params, so that exception is before the message/template so its more in sync with Serilog signature & was an easy way to find some more logs I missed too

This commit is contained in:
Warren
2018-08-17 15:41:58 +01:00
parent 38984181fc
commit 9e996c68bb
98 changed files with 219 additions and 223 deletions

View File

@@ -40,7 +40,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
}
catch (Exception ex)
{
Current.Logger.Error<PreviewContent>($"Could not load preview set {_previewSet} for user {_userId}.", ex);
Current.Logger.Error<PreviewContent>(ex, "Could not load preview set {PreviewSet} for user {UserId}.", _previewSet, _userId);
ClearPreviewSet();
@@ -146,7 +146,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
}
catch (Exception ex)
{
Current.Logger.Error<PreviewContent>($"Couldn't delete preview set {file.Name} for user {userId}", ex);
Current.Logger.Error<PreviewContent>(ex, "Couldn't delete preview set {FileName} for user {UserId}", file.Name, userId);
}
}

View File

@@ -122,13 +122,13 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
//See this thread: http://examine.cdodeplex.com/discussions/264341
//Catch the exception here for the time being, and just fallback to GetMedia
//TODO: Need to fix examine in LB scenarios!
Current.Logger.Error<PublishedMediaCache>("Could not load data from Examine index for media", ex);
Current.Logger.Error<PublishedMediaCache>(ex, "Could not load data from Examine index for media");
}
else if (ex is AlreadyClosedException)
{
//If the app domain is shutting down and the site is under heavy load the index reader will be closed and it really cannot
//be re-opened since the app domain is shutting down. In this case we have no option but to try to load the data from the db.
Current.Logger.Error<PublishedMediaCache>("Could not load data from Examine index for media, the app domain is most likely in a shutdown state", ex);
Current.Logger.Error<PublishedMediaCache>(ex, "Could not load data from Examine index for media, the app domain is most likely in a shutdown state");
}
else throw;
}
@@ -306,13 +306,13 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
//See this thread: http://examine.cdodeplex.com/discussions/264341
//Catch the exception here for the time being, and just fallback to GetMedia
//TODO: Need to fix examine in LB scenarios!
Current.Logger.Error<PublishedMediaCache>("Could not load data from Examine index for media", ex);
Current.Logger.Error<PublishedMediaCache>(ex, "Could not load data from Examine index for media");
}
else if (ex is AlreadyClosedException)
{
//If the app domain is shutting down and the site is under heavy load the index reader will be closed and it really cannot
//be re-opened since the app domain is shutting down. In this case we have no option but to try to load the data from the db.
Current.Logger.Error<PublishedMediaCache>("Could not load data from Examine index for media, the app domain is most likely in a shutdown state", ex);
Current.Logger.Error<PublishedMediaCache>(ex, "Could not load data from Examine index for media, the app domain is most likely in a shutdown state");
}
else throw;
}

View File

@@ -409,9 +409,9 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
}
dtd.Append(dtdInner);
}
catch (Exception exception)
catch (Exception ex)
{
Current.Logger.Error<ContentTypeService>("Failed to build a DTD for the Xml cache.", exception);
Current.Logger.Error<ContentTypeService>(ex, "Failed to build a DTD for the Xml cache.");
}
dtd.AppendLine("]>");
@@ -696,12 +696,12 @@ AND (umbracoNode.id=@id)";
Current.Logger.Info<XmlStore>("Saved Xml to file.");
}
catch (Exception e)
catch (Exception ex)
{
// if something goes wrong remove the file
DeleteXmlFile();
Current.Logger.Error<XmlStore>("Failed to save Xml to file.", e);
Current.Logger.Error<XmlStore>(ex, "Failed to save Xml to file '{FileName}'.", _xmlFileName);
}
}
@@ -736,12 +736,12 @@ AND (umbracoNode.id=@id)";
Current.Logger.Info<XmlStore>("Saved Xml to file.");
}
catch (Exception e)
catch (Exception ex)
{
// if something goes wrong remove the file
DeleteXmlFile();
Current.Logger.Error<XmlStore>("Failed to save Xml to file.", e);
Current.Logger.Error<XmlStore>(ex, "Failed to save Xml to file '{FileName}'.", _xmlFileName);
}
}
@@ -796,9 +796,9 @@ AND (umbracoNode.id=@id)";
Current.Logger.Warn<XmlStore>("Failed to load Xml, file does not exist.");
return null;
}
catch (Exception e)
catch (Exception ex)
{
Current.Logger.Error<XmlStore>("Failed to load Xml from file.", e);
Current.Logger.Error<XmlStore>(ex, "Failed to load Xml from file '{FileName}'.", _xmlFileName);
try
{
DeleteXmlFile();