diff --git a/src/Umbraco.Web/BatchedDatabaseServerMessenger.cs b/src/Umbraco.Web/BatchedDatabaseServerMessenger.cs index 4abb8f1e0b..8929c6edd9 100644 --- a/src/Umbraco.Web/BatchedDatabaseServerMessenger.cs +++ b/src/Umbraco.Web/BatchedDatabaseServerMessenger.cs @@ -40,8 +40,7 @@ namespace Umbraco.Web if (_databaseFactory.CanConnect == false) { - Logger.Warn( - "Cannot connect to the database, distributed calls will not be enabled for this server."); + Logger.Warn("Cannot connect to the database, distributed calls will not be enabled for this server."); } else { diff --git a/src/Umbraco.Web/Editors/PasswordChanger.cs b/src/Umbraco.Web/Editors/PasswordChanger.cs index 08f010ecd4..44042352bb 100644 --- a/src/Umbraco.Web/Editors/PasswordChanger.cs +++ b/src/Umbraco.Web/Editors/PasswordChanger.cs @@ -93,7 +93,7 @@ namespace Umbraco.Web.Editors if (resetResult.Succeeded == false) { var errors = string.Join(". ", resetResult.Errors); - _logger.Warn($"Could not reset user password {errors}"); + _logger.Warn(() => $"Could not reset user password {errors}"); return Attempt.Fail(new PasswordChangedModel { ChangeError = new ValidationResult("Could not reset password, errors: " + errors, new[] { "resetPassword" }) }); } @@ -122,7 +122,7 @@ namespace Umbraco.Web.Editors if (changeResult.Succeeded == false) { var errors = string.Join(". ", changeResult.Errors); - _logger.Warn($"Could not change user password {errors}"); + _logger.Warn(() => $"Could not change user password {errors}"); return Attempt.Fail(new PasswordChangedModel { ChangeError = new ValidationResult("Could not change password, errors: " + errors, new[] { "oldPassword" }) }); } return Attempt.Succeed(new PasswordChangedModel()); diff --git a/src/Umbraco.Web/HealthCheck/HealthCheckResults.cs b/src/Umbraco.Web/HealthCheck/HealthCheckResults.cs index 139072dcfe..74b44ea7b8 100644 --- a/src/Umbraco.Web/HealthCheck/HealthCheckResults.cs +++ b/src/Umbraco.Web/HealthCheck/HealthCheckResults.cs @@ -62,16 +62,16 @@ namespace Umbraco.Web.HealthCheck var checkIsSuccess = result.Value.All(x => x.ResultType == StatusResultType.Success); if (checkIsSuccess) { - Logger.Info($" Checks for '{checkName}' all completed succesfully."); + Logger.Info(() => $" Checks for '{checkName}' all completed succesfully."); } else { - Logger.Warn($" Checks for '{checkName}' completed with errors."); + Logger.Warn(() => $" Checks for '{checkName}' completed with errors."); } foreach (var checkResult in checkResults) { - Logger.Info($" Result: {checkResult.ResultType}, Message: '{checkResult.Message}'"); + Logger.Info(() => $" Result: {checkResult.ResultType}, Message: '{checkResult.Message}'"); } } } diff --git a/src/Umbraco.Web/Macros/UserControlMacroEngine.cs b/src/Umbraco.Web/Macros/UserControlMacroEngine.cs index 98246084f9..a0ee2166d7 100644 --- a/src/Umbraco.Web/Macros/UserControlMacroEngine.cs +++ b/src/Umbraco.Web/Macros/UserControlMacroEngine.cs @@ -64,7 +64,7 @@ namespace Umbraco.Web.Macros var controlProperty = type.GetProperty(modelProperty.Key); if (controlProperty == null) { - Current.Logger.Warn($"Control property \"{modelProperty.Key}\" doesn't exist or isn't accessible, skip."); + Current.Logger.Warn(() => $"Control property \"{modelProperty.Key}\" doesn't exist or isn't accessible, skip."); continue; } diff --git a/src/Umbraco.Web/Models/Mapping/DataTypeConfigurationFieldDisplayResolver.cs b/src/Umbraco.Web/Models/Mapping/DataTypeConfigurationFieldDisplayResolver.cs index 9cdbd6101e..d1838fc0f8 100644 --- a/src/Umbraco.Web/Models/Mapping/DataTypeConfigurationFieldDisplayResolver.cs +++ b/src/Umbraco.Web/Models/Mapping/DataTypeConfigurationFieldDisplayResolver.cs @@ -25,7 +25,7 @@ namespace Umbraco.Web.Models.Mapping if (configuration.TryGetValue(field.Key, out var value)) field.Value = value; else // weird - just leave the field without a value - but warn - Current.Logger.Warn($"Could not find a value for configuration field \"{field.Key}\"."); + Current.Logger.Warn(() => $"Could not find a value for configuration field \"{field.Key}\"."); } } diff --git a/src/Umbraco.Web/Models/Mapping/MacroMapperProfile.cs b/src/Umbraco.Web/Models/Mapping/MacroMapperProfile.cs index 6eedccf50b..e888d78c07 100644 --- a/src/Umbraco.Web/Models/Mapping/MacroMapperProfile.cs +++ b/src/Umbraco.Web/Models/Mapping/MacroMapperProfile.cs @@ -41,7 +41,7 @@ namespace Umbraco.Web.Models.Mapping { //we'll just map this to a text box paramEditor = Current.ParameterEditors[Constants.PropertyEditors.Aliases.TextBox]; - Current.Logger.Warn("Could not resolve a parameter editor with alias " + property.EditorAlias + ", a textbox will be rendered in it's place"); + Current.Logger.Warn(() => $"Could not resolve a parameter editor with alias {property.EditorAlias}, a textbox will be rendered in it's place"); } parameter.View = paramEditor.GetValueEditor().View; diff --git a/src/Umbraco.Web/PropertyEditors/ValueConverters/RelatedLinksValueConverter.cs b/src/Umbraco.Web/PropertyEditors/ValueConverters/RelatedLinksValueConverter.cs index 3a6cc6aa9b..632052d3e7 100644 --- a/src/Umbraco.Web/PropertyEditors/ValueConverters/RelatedLinksValueConverter.cs +++ b/src/Umbraco.Web/PropertyEditors/ValueConverters/RelatedLinksValueConverter.cs @@ -95,7 +95,7 @@ namespace Umbraco.Web.PropertyEditors.ValueConverters } else { - _logger.Warn($"Related Links value converter skipped a link as the node has been unpublished/deleted (Internal Link NodeId: {relatedLink.Link}, Link Caption: \"{relatedLink.Caption}\")"); + _logger.Warn(() => $"Related Links value converter skipped a link as the node has been unpublished/deleted (Internal Link NodeId: {relatedLink.Link}, Link Caption: \"{relatedLink.Caption}\")"); } } diff --git a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/DatabaseDataSource.cs b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/DatabaseDataSource.cs index fdc18b43aa..0a0c398cd6 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/DatabaseDataSource.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/DatabaseDataSource.cs @@ -186,7 +186,7 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource { if (Debugger.IsAttached) throw new Exception("Missing cmsContentNu edited content for node " + dto.Id + ", consider rebuilding."); - Current.Logger.Warn("Missing cmsContentNu edited content for node " + dto.Id + ", consider rebuilding."); + Current.Logger.Warn(() => $"Missing cmsContentNu edited content for node {dto.Id}, consider rebuilding."); } else { @@ -211,7 +211,7 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource { if (Debugger.IsAttached) throw new Exception("Missing cmsContentNu published content for node " + dto.Id + ", consider rebuilding."); - Current.Logger.Warn("Missing cmsContentNu published content for node " + dto.Id + ", consider rebuilding."); + Current.Logger.Warn(() => $"Missing cmsContentNu published content for node {dto.Id}, consider rebuilding."); } else { diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/DictionaryPublishedContent.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/DictionaryPublishedContent.cs index bc06779db7..9d4dfda461 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/DictionaryPublishedContent.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/DictionaryPublishedContent.cs @@ -108,7 +108,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache else { // this is a property that does not correspond to anything, ignore and log - Current.Logger.Warn("Dropping property \"" + i.Key + "\" because it does not belong to the content type."); + Current.Logger.Warn(() => "Dropping property \"" + i.Key + "\" because it does not belong to the content type."); } } } diff --git a/src/Umbraco.Web/Security/MembershipHelper.cs b/src/Umbraco.Web/Security/MembershipHelper.cs index 6d28680877..73eeb89936 100644 --- a/src/Umbraco.Web/Security/MembershipHelper.cs +++ b/src/Umbraco.Web/Security/MembershipHelper.cs @@ -317,7 +317,7 @@ namespace Umbraco.Web.Security if (member == null) { //this should not happen - Current.Logger.Warn("The member validated but then no member was returned with the username " + username); + Current.Logger.Warn(() => $"The member validated but then no member was returned with the username {username}"); return false; } //Log them in diff --git a/src/Umbraco.Web/Security/Providers/UmbracoMembershipProvider.cs b/src/Umbraco.Web/Security/Providers/UmbracoMembershipProvider.cs index 04df63a41f..3d45047fb2 100644 --- a/src/Umbraco.Web/Security/Providers/UmbracoMembershipProvider.cs +++ b/src/Umbraco.Web/Security/Providers/UmbracoMembershipProvider.cs @@ -149,7 +149,7 @@ namespace Umbraco.Web.Security.Providers if (MemberService.Exists(username)) { status = MembershipCreateStatus.DuplicateUserName; - Current.Logger.Warn>("Cannot create member as username already exists: " + username); + Current.Logger.Warn>(() => $"Cannot create member as username already exists: {username}"); return null; } @@ -157,8 +157,7 @@ namespace Umbraco.Web.Security.Providers if (MemberService.GetByEmail(email) != null && RequiresUniqueEmail) { status = MembershipCreateStatus.DuplicateEmail; - Current.Logger.Warn>( - "Cannot create member as a member with the same email address exists: " + email); + Current.Logger.Warn>(() => $"Cannot create member as a member with the same email address exists: {email}"); return null; } diff --git a/src/Umbraco.Web/Services/ApplicationTreeService.cs b/src/Umbraco.Web/Services/ApplicationTreeService.cs index ef717dc16b..006c0fb07d 100644 --- a/src/Umbraco.Web/Services/ApplicationTreeService.cs +++ b/src/Umbraco.Web/Services/ApplicationTreeService.cs @@ -339,7 +339,7 @@ namespace Umbraco.Web.Services var clrType = Type.GetType(type); if (clrType == null) { - _logger.Warn("The tree definition: " + addElement.ToString() + " could not be resolved to a .Net object type"); + _logger.Warn(() => $"The tree definition: {addElement} could not be resolved to a .Net object type"); continue; }