diff --git a/src/Umbraco.Core/Composing/ComponentCollection.cs b/src/Umbraco.Core/Composing/ComponentCollection.cs index 62b240f10f..6501a3a28c 100644 --- a/src/Umbraco.Core/Composing/ComponentCollection.cs +++ b/src/Umbraco.Core/Composing/ComponentCollection.cs @@ -51,7 +51,7 @@ namespace Umbraco.Core.Composing } catch (Exception ex) { - _logger.Error(ex, "Error while terminating component {ComponentType}.", componentType.FullName); + _logger.Error(ex, "Error while terminating component {ComponentType}.", componentType.FullName); } } } diff --git a/src/Umbraco.Core/Composing/Composers.cs b/src/Umbraco.Core/Composing/Composers.cs index b2e6c9d068..1528c6760d 100644 --- a/src/Umbraco.Core/Composing/Composers.cs +++ b/src/Umbraco.Core/Composing/Composers.cs @@ -114,7 +114,7 @@ namespace Umbraco.Core.Composing // bit verbose but should help for troubleshooting //var text = "Ordered Composers: " + Environment.NewLine + string.Join(Environment.NewLine, sortedComposerTypes) + Environment.NewLine; - _logger.Debug("Ordered Composers: {SortedComposerTypes}", sortedComposerTypes); + _logger.Debug>("Ordered Composers: {SortedComposerTypes}", sortedComposerTypes); return sortedComposerTypes; } @@ -205,7 +205,7 @@ namespace Umbraco.Core.Composing catch (Exception e) { // in case of an error, force-dump everything to log - _logger.Info("Composer Report:\r\n{ComposerReport}", GetComposersReport(requirements)); + _logger.Info("Composer Report:\r\n{ComposerReport}", GetComposersReport(requirements)); _logger.Error(e, "Failed to sort composers."); throw; } diff --git a/src/Umbraco.Core/Composing/TypeFinder.cs b/src/Umbraco.Core/Composing/TypeFinder.cs index 394d9480ae..5bf9eb89a9 100644 --- a/src/Umbraco.Core/Composing/TypeFinder.cs +++ b/src/Umbraco.Core/Composing/TypeFinder.cs @@ -11,7 +11,7 @@ using System.Web.Compilation; using System.Web.Hosting; using Umbraco.Core.Composing; using Umbraco.Core.IO; - +using Umbraco.Core.Logging; namespace Umbraco.Core.Composing { /// @@ -441,7 +441,7 @@ namespace Umbraco.Core.Composing } catch (TypeLoadException ex) { - Current.Logger.Error(typeof(TypeFinder), ex, "Could not query types on {Assembly} assembly, this is most likely due to this assembly not being compatible with the current Umbraco version", assembly); + Current.Logger.Error(typeof(TypeFinder), ex, "Could not query types on {Assembly} assembly, this is most likely due to this assembly not being compatible with the current Umbraco version", assembly); continue; } @@ -507,7 +507,7 @@ namespace Umbraco.Core.Composing } catch (TypeLoadException ex) { - Current.Logger.Error(typeof(TypeFinder), ex, "Could not query types on {Assembly} assembly, this is most likely due to this assembly not being compatible with the current Umbraco version", assembly); + Current.Logger.Error(typeof(TypeFinder), ex, "Could not query types on {Assembly} assembly, this is most likely due to this assembly not being compatible with the current Umbraco version", assembly); continue; } diff --git a/src/Umbraco.Core/Composing/TypeLoader.cs b/src/Umbraco.Core/Composing/TypeLoader.cs index 6d0b1a0514..f5c75ff607 100644 --- a/src/Umbraco.Core/Composing/TypeLoader.cs +++ b/src/Umbraco.Core/Composing/TypeLoader.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; +using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Text; using System.Threading; @@ -477,7 +478,7 @@ namespace Umbraco.Core.Composing if (--attempts == 0) throw; - _logger.Debug("Attempted to get filestream for file {Path} failed, {NumberOfAttempts} attempts left, pausing for {PauseMilliseconds} milliseconds", path, attempts, pauseMilliseconds); + _logger.Debug("Attempted to get filestream for file {Path} failed, {NumberOfAttempts} attempts left, pausing for {PauseMilliseconds} milliseconds", path, attempts, pauseMilliseconds); Thread.Sleep(pauseMilliseconds); } } @@ -498,7 +499,7 @@ namespace Umbraco.Core.Composing if (--attempts == 0) throw; - _logger.Debug("Attempted to delete file {Path} failed, {NumberOfAttempts} attempts left, pausing for {PauseMilliseconds} milliseconds", path, attempts, pauseMilliseconds); + _logger.Debug("Attempted to delete file {Path} failed, {NumberOfAttempts} attempts left, pausing for {PauseMilliseconds} milliseconds", path, attempts, pauseMilliseconds); Thread.Sleep(pauseMilliseconds); } } @@ -571,7 +572,7 @@ namespace Umbraco.Core.Composing if (!typeof(IDiscoverable).IsAssignableFrom(typeof(T))) { // warn - _logger.Debug("Running a full, " + (cache ? "" : "non-") + "cached, scan for non-discoverable type {TypeName} (slow).", typeof(T).FullName); + _logger.Debug("Running a full, " + (cache ? "" : "non-") + "cached, scan for non-discoverable type {TypeName} (slow).", typeof(T).FullName); return GetTypesInternal( typeof(T), null, @@ -589,7 +590,7 @@ namespace Umbraco.Core.Composing // warn if (!cache) - _logger.Debug("Running a non-cached, filter for discoverable type {TypeName} (slowish).", typeof(T).FullName); + _logger.Debug("Running a non-cached, filter for discoverable type {TypeName} (slowish).", typeof(T).FullName); // filter the cached discovered types (and maybe cache the result) return GetTypesInternal( @@ -621,7 +622,7 @@ namespace Umbraco.Core.Composing // if not IDiscoverable, directly get types if (!typeof(IDiscoverable).IsAssignableFrom(typeof(T))) { - _logger.Debug("Running a full, " + (cache ? "" : "non-") + "cached, scan for non-discoverable type {TypeName} / attribute {AttributeName} (slow).", typeof(T).FullName, typeof(TAttribute).FullName); + _logger.Debug("Running a full, " + (cache ? "" : "non-") + "cached, scan for non-discoverable type {TypeName} / attribute {AttributeName} (slow).", typeof(T).FullName, typeof(TAttribute).FullName); return GetTypesInternal( typeof(T), typeof(TAttribute), @@ -639,7 +640,7 @@ namespace Umbraco.Core.Composing // warn if (!cache) - _logger.Debug("Running a non-cached, filter for discoverable type {TypeName} / attribute {AttributeName} (slowish).", typeof(T).FullName, typeof(TAttribute).FullName); + _logger.Debug("Running a non-cached, filter for discoverable type {TypeName} / attribute {AttributeName} (slowish).", typeof(T).FullName, typeof(TAttribute).FullName); // filter the cached discovered types (and maybe cache the result) return GetTypesInternal( @@ -669,7 +670,7 @@ namespace Umbraco.Core.Composing cache &= specificAssemblies == null; if (!cache) - _logger.Debug("Running a full, non-cached, scan for types / attribute {AttributeName} (slow).", typeof(TAttribute).FullName); + _logger.Debug("Running a full, non-cached, scan for types / attribute {AttributeName} (slow).", typeof(TAttribute).FullName); return GetTypesInternal( typeof (object), typeof (TAttribute), @@ -725,7 +726,7 @@ namespace Umbraco.Core.Composing if (typeList != null) { // need to put some logging here to try to figure out why this is happening: http://issues.umbraco.org/issue/U4-3505 - _logger.Debug("Getting {TypeName}: found a cached type list.", GetName(baseType, attributeType)); + _logger.Debug("Getting {TypeName}: found a cached type list.", GetName(baseType, attributeType)); return typeList.Types; } @@ -756,7 +757,7 @@ namespace Umbraco.Core.Composing // so in this instance there will never be a result. if (cacheResult.Exception is CachedTypeNotFoundInFileException || cacheResult.Success == false) { - _logger.Debug("Getting {TypeName}: failed to load from cache file, must scan assemblies.", GetName(baseType, attributeType)); + _logger.Debug("Getting {TypeName}: failed to load from cache file, must scan assemblies.", GetName(baseType, attributeType)); scan = true; } else @@ -775,7 +776,7 @@ namespace Umbraco.Core.Composing catch (Exception ex) { // in case of any exception, we have to exit, and revert to scanning - _logger.Error(ex, "Getting {TypeName}: failed to load cache file type {CacheType}, reverting to scanning assemblies.", GetName(baseType, attributeType), type); + _logger.Error(ex, "Getting {TypeName}: failed to load cache file type {CacheType}, reverting to scanning assemblies.", GetName(baseType, attributeType), type); scan = true; break; } @@ -783,7 +784,7 @@ namespace Umbraco.Core.Composing if (scan == false) { - _logger.Debug("Getting {TypeName}: loaded types from cache file.", GetName(baseType, attributeType)); + _logger.Debug("Getting {TypeName}: loaded types from cache file.", GetName(baseType, attributeType)); } } } @@ -791,7 +792,7 @@ namespace Umbraco.Core.Composing if (scan) { // either we had to scan, or we could not get the types from the cache file - scan now - _logger.Debug("Getting {TypeName}: " + action + ".", GetName(baseType, attributeType)); + _logger.Debug("Getting {TypeName}: " + action + ".", GetName(baseType, attributeType)); foreach (var t in finder()) typeList.Add(t); @@ -809,11 +810,11 @@ namespace Umbraco.Core.Composing UpdateCache(); } - _logger.Debug("Got {TypeName}, caching ({CacheType}).", GetName(baseType, attributeType), added.ToString().ToLowerInvariant()); + _logger.Debug("Got {TypeName}, caching ({CacheType}).", GetName(baseType, attributeType), added.ToString().ToLowerInvariant()); } else { - _logger.Debug("Got {TypeName}.", GetName(baseType, attributeType)); + _logger.Debug("Got {TypeName}.", GetName(baseType, attributeType)); } return typeList.Types; diff --git a/src/Umbraco.Core/Configuration/Grid/GridEditorsConfig.cs b/src/Umbraco.Core/Configuration/Grid/GridEditorsConfig.cs index d434da8c70..82f9bd2afe 100644 --- a/src/Umbraco.Core/Configuration/Grid/GridEditorsConfig.cs +++ b/src/Umbraco.Core/Configuration/Grid/GridEditorsConfig.cs @@ -43,7 +43,7 @@ namespace Umbraco.Core.Configuration.Grid } catch (Exception ex) { - _logger.Error(ex, "Could not parse the contents of grid.editors.config.js into a JSON array '{Json}", sourceString); + _logger.Error(ex, "Could not parse the contents of grid.editors.config.js into a JSON array '{Json}", sourceString); } } diff --git a/src/Umbraco.Core/IO/FileSystems.cs b/src/Umbraco.Core/IO/FileSystems.cs index 8906752dd1..3b05adb20f 100644 --- a/src/Umbraco.Core/IO/FileSystems.cs +++ b/src/Umbraco.Core/IO/FileSystems.cs @@ -225,7 +225,7 @@ namespace Umbraco.Core.IO _shadowCurrentId = id; - _logger.Debug("Shadow '{ShadowId}'", _shadowCurrentId); + _logger.Debug("Shadow '{ShadowId}'", _shadowCurrentId); foreach (var wrapper in _shadowWrappers) wrapper.Shadow(_shadowCurrentId); @@ -242,7 +242,7 @@ namespace Umbraco.Core.IO if (id != _shadowCurrentId) throw new InvalidOperationException("Not the current shadow."); - _logger.Debug("UnShadow '{ShadowId}' {Status}", id, completed ? "complete" : "abort"); + _logger.Debug("UnShadow '{ShadowId}' {Status}", id, completed ? "complete" : "abort"); var exceptions = new List(); foreach (var wrapper in _shadowWrappers) diff --git a/src/Umbraco.Core/IO/MediaFileSystem.cs b/src/Umbraco.Core/IO/MediaFileSystem.cs index 05c02171ba..6743275be0 100644 --- a/src/Umbraco.Core/IO/MediaFileSystem.cs +++ b/src/Umbraco.Core/IO/MediaFileSystem.cs @@ -51,7 +51,7 @@ namespace Umbraco.Core.IO } catch (Exception e) { - _logger.Error(e, "Failed to delete media file '{File}'.", file); + _logger.Error(e, "Failed to delete media file '{File}'.", file); } }); } diff --git a/src/Umbraco.Core/IO/PhysicalFileSystem.cs b/src/Umbraco.Core/IO/PhysicalFileSystem.cs index a833ba43af..5ebe6817e5 100644 --- a/src/Umbraco.Core/IO/PhysicalFileSystem.cs +++ b/src/Umbraco.Core/IO/PhysicalFileSystem.cs @@ -74,11 +74,11 @@ namespace Umbraco.Core.IO } catch (UnauthorizedAccessException ex) { - Current.Logger.Error(ex, "Not authorized to get directories for '{Path}'", fullPath); + Current.Logger.Error(ex, "Not authorized to get directories for '{Path}'", fullPath); } catch (DirectoryNotFoundException ex) { - Current.Logger.Error(ex, "Directory not found for '{Path}'", fullPath); + Current.Logger.Error(ex, "Directory not found for '{Path}'", fullPath); } return Enumerable.Empty(); @@ -110,7 +110,7 @@ namespace Umbraco.Core.IO } catch (DirectoryNotFoundException ex) { - Current.Logger.Error(ex, "Directory not found for '{Path}'", fullPath); + Current.Logger.Error(ex, "Directory not found for '{Path}'", fullPath); } } @@ -190,11 +190,11 @@ namespace Umbraco.Core.IO } catch (UnauthorizedAccessException ex) { - Current.Logger.Error(ex, "Not authorized to get directories for '{Path}'", fullPath); + Current.Logger.Error(ex, "Not authorized to get directories for '{Path}'", fullPath); } catch (DirectoryNotFoundException ex) { - Current.Logger.Error(ex, "Directory not found for '{FullPath}'", fullPath); + Current.Logger.Error(ex, "Directory not found for '{FullPath}'", fullPath); } return Enumerable.Empty(); @@ -227,7 +227,7 @@ namespace Umbraco.Core.IO } catch (FileNotFoundException ex) { - Current.Logger.Error(ex.InnerException, "DeleteFile failed with FileNotFoundException for '{Path}'", fullPath); + Current.Logger.Error(ex.InnerException, "DeleteFile failed with FileNotFoundException for '{Path}'", fullPath); } } diff --git a/src/Umbraco.Core/Logging/DebugDiagnosticsLogger.cs b/src/Umbraco.Core/Logging/DebugDiagnosticsLogger.cs index d1bde55306..8f26f7e75c 100644 --- a/src/Umbraco.Core/Logging/DebugDiagnosticsLogger.cs +++ b/src/Umbraco.Core/Logging/DebugDiagnosticsLogger.cs @@ -129,5 +129,65 @@ namespace Umbraco.Core.Logging { System.Diagnostics.Debug.WriteLine(MessageTemplates.Render(messageTemplate, propertyValues), reporting.FullName); } + /// + public void Fatal(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, + T1 propertyValue1, T2 propertyValue2) + => Fatal(reporting, exception, messageTemplate, new object[] { propertyValue0, propertyValue1, propertyValue2 }); + /// + public void Fatal(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + => Fatal(reporting, exception, messageTemplate, new object[] { propertyValue0, propertyValue1 }); + /// + public void Fatal(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0) + => Fatal(reporting, exception, messageTemplate, new object[] { propertyValue0 }); + /// + public void Error(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, + T1 propertyValue1, T2 propertyValue2) + => Error(reporting, exception, messageTemplate, new object[] { propertyValue0, propertyValue1, propertyValue2 }); + /// + public void Error(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + => Error(reporting, exception, messageTemplate, new object[] { propertyValue0, propertyValue1 }); + /// + public void Error(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0) + => Error(reporting, exception, messageTemplate, new object[] { propertyValue0 }); + /// + public void Warn(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, + T1 propertyValue1, T2 propertyValue2) + => Warn(reporting, exception, messageTemplate, new object[] { propertyValue0, propertyValue1,propertyValue2 }); + /// + public void Warn(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + => Warn(reporting, exception, messageTemplate, new object[] { propertyValue0, propertyValue1 }); + + public void Warn(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0) + => Warn(reporting, exception, messageTemplate, new object[] { propertyValue0 }); + + public void Warn(Type reporting, string message, T0 propertyValue0) + => Warn(reporting, message, new object[] { propertyValue0 }); + + public void Info(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) + => Info(reporting, messageTemplate, new object[] { propertyValue0, propertyValue1, propertyValue2 }); + + public void Info(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + => Info(reporting, messageTemplate, new object[] { propertyValue0, propertyValue1 }); + + public void Info(Type reporting, string messageTemplate, T0 propertyValue0) + => Info(reporting, messageTemplate, new object[] { propertyValue0 }); + + public void Debug(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) + => Debug(reporting, messageTemplate, new object[] { propertyValue0, propertyValue1, propertyValue2 }); + + public void Debug(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + => Debug(reporting, messageTemplate, new object[] { propertyValue0, propertyValue1 }); + + public void Debug(Type reporting, string messageTemplate, T0 propertyValue0) + => Debug(reporting, messageTemplate, new object[] { propertyValue0 }); + + public void Verbose(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) + => Verbose(reporting, messageTemplate, new object[] { propertyValue0, propertyValue1,propertyValue2 }); + + public void Verbose(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + => Verbose(reporting, messageTemplate, new object[] { propertyValue0, propertyValue1 }); + + public void Verbose(Type reporting, string messageTemplate, T0 propertyValue0) + => Verbose(reporting, messageTemplate, new object[] { propertyValue0 }); } } diff --git a/src/Umbraco.Core/Logging/DisposableTimer.cs b/src/Umbraco.Core/Logging/DisposableTimer.cs index ed98e5cfab..63ae3c2792 100644 --- a/src/Umbraco.Core/Logging/DisposableTimer.cs +++ b/src/Umbraco.Core/Logging/DisposableTimer.cs @@ -37,10 +37,10 @@ namespace Umbraco.Core.Logging switch (_level) { case LogLevel.Debug: - logger.Debug(loggerType, "{StartMessage} [Timing {TimingId}]", startMessage, _timingId); + logger.Debug(loggerType, "{StartMessage} [Timing {TimingId}]", startMessage, _timingId); break; case LogLevel.Information: - logger.Info(loggerType, "{StartMessage} [Timing {TimingId}]", startMessage, _timingId); + logger.Info(loggerType, "{StartMessage} [Timing {TimingId}]", startMessage, _timingId); break; default: throw new ArgumentOutOfRangeException(nameof(level)); @@ -84,15 +84,15 @@ namespace Umbraco.Core.Logging { if (_failed) { - _logger.Error(_loggerType, _failException, "{FailMessage} ({Duration}ms) [Timing {TimingId}]", _failMessage, Stopwatch.ElapsedMilliseconds, _timingId); + _logger.Error(_loggerType, _failException, "{FailMessage} ({Duration}ms) [Timing {TimingId}]", _failMessage, Stopwatch.ElapsedMilliseconds, _timingId); } else switch (_level) { case LogLevel.Debug: - _logger.Debug(_loggerType, "{EndMessage} ({Duration}ms) [Timing {TimingId}]", _endMessage, Stopwatch.ElapsedMilliseconds, _timingId); + _logger.Debug(_loggerType, "{EndMessage} ({Duration}ms) [Timing {TimingId}]", _endMessage, Stopwatch.ElapsedMilliseconds, _timingId); break; case LogLevel.Information: - _logger.Info(_loggerType, "{EndMessage} ({Duration}ms) [Timing {TimingId}]", _endMessage, Stopwatch.ElapsedMilliseconds, _timingId); + _logger.Info(_loggerType, "{EndMessage} ({Duration}ms) [Timing {TimingId}]", _endMessage, Stopwatch.ElapsedMilliseconds, _timingId); break; // filtered in the ctor //default: diff --git a/src/Umbraco.Core/Logging/ILogger.cs b/src/Umbraco.Core/Logging/ILogger.cs index 4f49d0b3b4..d8272b6aa0 100644 --- a/src/Umbraco.Core/Logging/ILogger.cs +++ b/src/Umbraco.Core/Logging/ILogger.cs @@ -52,7 +52,7 @@ namespace Umbraco.Core.Logging /// A message template. /// Property values. void Fatal(Type reporting, Exception exception, string messageTemplate, params object[] propertyValues); - + /// /// Logs a fatal message. /// @@ -92,7 +92,7 @@ namespace Umbraco.Core.Logging /// A message template. /// Property values. void Error(Type reporting, Exception exception, string messageTemplate, params object[] propertyValues); - + /// /// Logs an error message. /// @@ -132,6 +132,7 @@ namespace Umbraco.Core.Logging /// A message template. /// Property values. void Warn(Type reporting, Exception exception, string messageTemplate, params object[] propertyValues); + /// /// Logs an information message. @@ -147,6 +148,7 @@ namespace Umbraco.Core.Logging /// A message template. /// Property values. void Info(Type reporting, string messageTemplate, params object[] propertyValues); + /// /// Logs a debugging message. @@ -177,5 +179,6 @@ namespace Umbraco.Core.Logging /// A message template. /// Property values. void Verbose(Type reporting, string messageTemplate, params object[] propertyValues); + } } diff --git a/src/Umbraco.Core/Logging/ILogger2.cs b/src/Umbraco.Core/Logging/ILogger2.cs new file mode 100644 index 0000000000..0db8021f58 --- /dev/null +++ b/src/Umbraco.Core/Logging/ILogger2.cs @@ -0,0 +1,240 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Umbraco.Core.Logging +{ + public interface ILogger2 : ILogger + { + /// + /// Logs a fatal message with an exception. + /// + /// The reporting type. + /// An exception. + /// A message template. + /// Property value 0 + /// Property value 1 + /// Property value 2 + void Fatal(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2); + /// + /// Logs a fatal message with an exception. + /// + /// The reporting type. + /// An exception. + /// A message template. + /// Property value 0 + /// Property value 1 + void Fatal(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1); + /// + /// Logs a fatal message with an exception. + /// + /// The reporting type. + /// An exception. + /// A message template. + /// Property value 0 + void Fatal(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0); + + /// + /// Logs an error message with an exception. + /// + /// The reporting type. + /// An exception. + /// A message template. + /// Property value 0 + /// Property value 1 + /// Property value 2 + void Error(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2); + /// + /// Logs an error message with an exception. + /// + /// The reporting type. + /// An exception. + /// A message template. + /// Property value 0 + /// Property value 1 + void Error(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1); + /// + /// Logs an error message with an exception. + /// + /// The reporting type. + /// An exception. + /// A message template. + /// Property value 0 + void Error(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0); + + /// + /// Logs a warning message with an exception. + /// + /// The reporting type. + /// An exception. + /// A message template. + /// Property value 0 + /// Property value 1 + /// Property value 2 + void Warn(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2); + /// + /// Logs a warning message with an exception. + /// + /// The reporting type. + /// An exception. + /// A message template. + /// Property value 0 + /// Property value 1 + void Warn(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1); + /// + /// Logs a warning message with an exception. + /// + /// The reporting type. + /// An exception. + /// A message template. + /// Property value 0 + void Warn(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0); + /// + /// Logs a warning message with an exception. + /// + /// The reporting type. + /// A message template. + /// Property value 0 + void Warn(Type reporting, string message, T0 propertyValue0); + + /// + /// Logs a info message. + /// + /// The reporting type. + /// A message template. + /// Property value 0 + /// Property value 1 + /// Property value 2 + void Info(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2); + /// + /// Logs a info message. + /// + /// The reporting type. + /// A message template. + /// Property value 0 + /// Property value 1 + void Info(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1); + /// + /// Logs a info message. + /// + /// The reporting type. + /// A message template. + /// Property value 0 + void Info(Type reporting, string messageTemplate, T0 propertyValue0); + + /// + /// Logs a debug message. + /// + /// The reporting type. + /// A message template. + /// Property value 0 + /// Property value 1 + /// Property value 2 + void Debug(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2); + /// + /// Logs a debug message. + /// + /// The reporting type. + /// A message template. + /// Property value 0 + /// Property value 1 + void Debug(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1); + /// + /// Logs a debug message. + /// + /// The reporting type. + /// A message template. + /// Property value 0 + void Debug(Type reporting, string messageTemplate, T0 propertyValue0); + + /// + /// Logs a verbose message. + /// + /// The reporting type. + /// A message template. + /// Property value 0 + /// Property value 1 + /// Property value 2 + void Verbose(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2); + /// + /// Logs a verbose message. + /// + /// The reporting type. + /// A message template. + /// Property value 0 + /// Property value 1 + void Verbose(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1); + /// + /// Logs a verbose message. + /// + /// The reporting type. + /// A message template. + /// Property value 0 + void Verbose(Type reporting, string messageTemplate, T0 propertyValue0); + + + /// + /// Logs a error message. + /// + /// The reporting type. + /// A message template. + /// Property value 0 + void Error(Type reporting, string messageTemplate, T0 propertyValue0); + + /// + /// Logs a error message. + /// + /// The reporting type. + /// A message template. + /// Property value 0 + /// Property value 1 + void Error(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1); + + /// + /// Logs a error message. + /// + /// The reporting type. + /// A message template. + /// Property value 0 + /// Property value 1 + /// Property value 2 + void Error(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2); + + /// + /// Logs a warning message. + /// + /// The reporting type. + /// A message template. + /// Property value 0 + /// Property value 1 + /// Property value 2 + void Warn(string messageTemplate, T0 propertyValue0, T1 propertyValue1); + /// + /// Logs a warning message. + /// + /// The reporting type. + /// A message template. + /// Property value 0 + /// Property value 1 + void Warn(string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2); + /// + /// Logs a warning message with an exception. + /// + /// The reporting type. + /// A message template. + /// Property value 0 + /// Property value 1 + /// Property value 2 + void Warn(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2); + /// + /// Logs a warning message with an exception. + /// + /// The reporting type. + /// A message template. + /// Property value 0 + /// Property value 1 + void Warn(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1); + } +} diff --git a/src/Umbraco.Core/Logging/LogProfiler.cs b/src/Umbraco.Core/Logging/LogProfiler.cs index 74dae545b4..c0f8d1b525 100644 --- a/src/Umbraco.Core/Logging/LogProfiler.cs +++ b/src/Umbraco.Core/Logging/LogProfiler.cs @@ -24,8 +24,8 @@ namespace Umbraco.Core.Logging /// public IDisposable Step(string name) { - _logger.Debug("Begin: {ProfileName}", name); - return new LightDisposableTimer(duration => _logger.Info("End {ProfileName} ({ProfileDuration}ms)", name, duration)); + _logger.Debug("Begin: {ProfileName}", name); + return new LightDisposableTimer(duration => _logger.Info("End {ProfileName} ({ProfileDuration}ms)", name, duration)); } /// diff --git a/src/Umbraco.Core/Logging/Logger2Extensions.cs b/src/Umbraco.Core/Logging/Logger2Extensions.cs new file mode 100644 index 0000000000..c6c1352055 --- /dev/null +++ b/src/Umbraco.Core/Logging/Logger2Extensions.cs @@ -0,0 +1,442 @@ +using System; + +namespace Umbraco.Core.Logging +{ + public static class Logger2Extensions + { + public static void Debug(this ILogger logger, Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) + { + if (logger is ILogger2 logger2) + { + logger2.Debug(reporting, messageTemplate, propertyValue0, propertyValue1, propertyValue2); + } + else + { + logger.Debug(reporting, messageTemplate, propertyValue0, propertyValue1, propertyValue2); + } + } + + public static void Debug(this ILogger logger, Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + { + if (logger is ILogger2 logger2) + { + logger2.Debug(reporting, messageTemplate, propertyValue0, propertyValue1); + } + else + { + logger.Debug(reporting, messageTemplate, propertyValue0, propertyValue1); + } + } + + public static void Debug(this ILogger logger, Type reporting, string messageTemplate, T0 propertyValue0) + { + if (logger is ILogger2 logger2) + { + logger2.Debug(reporting, messageTemplate, propertyValue0); + } + else + { + logger.Debug(reporting, messageTemplate, propertyValue0); + } + } + + public static void Error(this ILogger logger, Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) + { + if (logger is ILogger2 logger2) + { + logger2.Error(reporting, exception, messageTemplate, propertyValue0, propertyValue1, propertyValue2); + } + else + { + logger.Error(reporting, exception, messageTemplate, propertyValue0, propertyValue1, propertyValue2); + } + } + + public static void Error(this ILogger logger, Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + { + if (logger is ILogger2 logger2) + { + logger2.Error(reporting, exception, messageTemplate, propertyValue0, propertyValue1); + } + else + { + logger.Error(reporting, exception, messageTemplate, propertyValue0, propertyValue1); + } + } + + public static void Error(this ILogger logger, Type reporting, Exception exception, string messageTemplate, T0 propertyValue0) + { + if (logger is ILogger2 logger2) + { + logger2.Error(reporting, exception, messageTemplate, propertyValue0); + } + else + { + logger.Error(reporting, exception, messageTemplate, propertyValue0); + } + } + + public static void Fatal(this ILogger logger, Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) + { + if (logger is ILogger2 logger2) + { + logger2.Fatal(reporting, exception, messageTemplate, propertyValue0, propertyValue1, propertyValue2); + } + else + { + logger.Fatal(reporting, exception, messageTemplate, propertyValue0, propertyValue1, propertyValue2); + } + } + + public static void Fatal(this ILogger logger, Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + { + if (logger is ILogger2 logger2) + { + logger2.Fatal(reporting, exception, messageTemplate, propertyValue0, propertyValue1); + } + else + { + logger.Fatal(reporting, exception, messageTemplate, propertyValue0, propertyValue1); + } + } + + public static void Fatal(this ILogger logger, Type reporting, Exception exception, string messageTemplate, T0 propertyValue0) + { + if (logger is ILogger2 logger2) + { + logger2.Fatal(reporting, exception, messageTemplate, propertyValue0); + } + else + { + logger.Fatal(reporting, exception, messageTemplate, propertyValue0); + } + } + + public static void Info(this ILogger logger, Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) + { + if (logger is ILogger2 logger2) + { + logger2.Info(reporting, messageTemplate, propertyValue0, propertyValue1, propertyValue2); + } + else + { + logger.Info(reporting, messageTemplate, propertyValue0, propertyValue1, propertyValue2); + } + } + + public static void Info(this ILogger logger, Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + { + if (logger is ILogger2 logger2) + { + logger2.Info(reporting, messageTemplate, propertyValue0, propertyValue1); + } + else + { + logger.Info(reporting, messageTemplate, propertyValue0, propertyValue1); + } + } + + public static void Info(this ILogger logger, Type reporting, string messageTemplate, T0 propertyValue0) + { + if (logger is ILogger2 logger2) + { + logger2.Info(reporting, messageTemplate, propertyValue0); + } + else + { + logger.Info(reporting, messageTemplate, propertyValue0); + } + } + + public static void Verbose(this ILogger logger, Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) + { + if (logger is ILogger2 logger2) + { + logger2.Verbose(reporting, messageTemplate, propertyValue0, propertyValue1, propertyValue2); + } + else + { + logger.Verbose(reporting, messageTemplate, propertyValue0, propertyValue1, propertyValue2); + } + } + + public static void Verbose(this ILogger logger, Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + { + if (logger is ILogger2 logger2) + { + logger2.Verbose(reporting, messageTemplate, propertyValue0, propertyValue1); + } + else + { + logger.Verbose(reporting, messageTemplate, propertyValue0, propertyValue1); + } + } + + public static void Verbose(this ILogger logger, Type reporting, string messageTemplate, T0 propertyValue0) + { + if (logger is ILogger2 logger2) + { + logger2.Verbose(reporting, messageTemplate, propertyValue0); + } + else + { + logger.Verbose(reporting, messageTemplate, propertyValue0); + } + } + + public static void Warn(this ILogger logger, Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) + { + if (logger is ILogger2 logger2) + { + logger2.Warn(reporting, messageTemplate, exception, propertyValue0, propertyValue1, propertyValue2); + } + else + { + logger.Warn(reporting, messageTemplate, exception, propertyValue0, propertyValue1, propertyValue2); + } + } + + public static void Warn(this ILogger logger, Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + { + if (logger is ILogger2 logger2) + { + logger2.Warn(reporting, messageTemplate, exception, propertyValue0, propertyValue1); + } + else + { + logger.Warn(reporting, messageTemplate, exception, propertyValue0, propertyValue1); + } + } + + public static void Warn(this ILogger logger, Type reporting, Exception exception, string messageTemplate, T0 propertyValue0) + { + if (logger is ILogger2 logger2) + { + logger2.Warn(reporting, messageTemplate, exception, propertyValue0); + } + else + { + logger.Warn(reporting, messageTemplate, exception, propertyValue0); + } + } + + public static void Warn(this ILogger logger, Type reporting, string message, T0 propertyValue0) + { + if (logger is ILogger2 logger2) + { + logger2.Warn(reporting, message, propertyValue0); + } + else + { + logger.Warn(reporting, message, propertyValue0); + } + } + + // + public static void Error(this ILogger logger, Exception exception, string messageTemplate, T0 propertyValue0) + { + if (logger is ILogger2 logger2) + { + logger2.Error(typeof(T), exception, messageTemplate, propertyValue0); + } + else + { + logger.Error(typeof(T), exception, messageTemplate, propertyValue0); + } + } + + public static void Error(this ILogger logger, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + { + if (logger is ILogger2 logger2) + { + logger2.Error(typeof(T), exception, messageTemplate, propertyValue0, propertyValue1); + } + else + { + logger.Error(typeof(T), exception, messageTemplate, propertyValue0, propertyValue1); + } + } + + public static void Error(this ILogger logger, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) + { + if (logger is ILogger2 logger2) + { + logger2.Error(typeof(T), exception, messageTemplate, propertyValue0, propertyValue1, propertyValue2); + } + else + { + logger.Error(typeof(T), exception, messageTemplate, propertyValue0, propertyValue1, propertyValue2); + } + } + public static void Error(this ILogger logger, string messageTemplate, T0 propertyValue0) + { + if (logger is ILogger2 logger2) + { + logger2.Error(typeof(T), messageTemplate, propertyValue0); + } + else + { + logger.Error(typeof(T), messageTemplate, propertyValue0); + } + } + public static void Error(this ILogger logger, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + { + if (logger is ILogger2 logger2) + { + logger2.Error(typeof(T), messageTemplate, propertyValue0, propertyValue1); + } + else + { + logger.Error(typeof(T), messageTemplate, propertyValue0, propertyValue1); + } + } + public static void Error(this ILogger logger, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) + { + if (logger is ILogger2 logger2) + { + logger2.Error(typeof(T), messageTemplate, propertyValue0, propertyValue1, propertyValue2); + } + else + { + logger.Error(typeof(T), messageTemplate, propertyValue0, propertyValue1, propertyValue2); + } + } + public static void Warn(this ILogger logger, Exception exception, string messageTemplate, T0 propertyValue0) + { + if (logger is ILogger2 logger2) + { + logger2.Warn(typeof(T), exception, messageTemplate, propertyValue0); + } + else + { + logger.Warn(typeof(T), exception, messageTemplate, propertyValue0); + } + } + + public static void Warn(this ILogger logger, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + { + if (logger is ILogger2 logger2) + { + logger2.Warn(typeof(T), exception, messageTemplate, propertyValue0, propertyValue1); + } + else + { + logger.Warn(typeof(T), exception, messageTemplate, propertyValue0, propertyValue1); + } + } + + public static void Warn(this ILogger logger, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) + { + if (logger is ILogger2 logger2) + { + logger2.Warn(typeof(T), exception, messageTemplate, propertyValue0, propertyValue1, propertyValue2); + } + else + { + logger.Warn(typeof(T), exception, messageTemplate, propertyValue0, propertyValue1, propertyValue2); + } + } + + public static void Warn(this ILogger logger, string messageTemplate, T0 propertyValue0) + { + if (logger is ILogger2 logger2) + { + logger2.Warn(typeof(T), messageTemplate, propertyValue0); + } + else + { + logger.Warn(typeof(T), messageTemplate, propertyValue0); + } + } + public static void Warn(this ILogger logger, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + { + if (logger is ILogger2 logger2) + { + logger2.Warn(typeof(T), messageTemplate, propertyValue0, propertyValue1); + } + else + { + logger.Warn(typeof(T), messageTemplate, propertyValue0, propertyValue1); + } + } + public static void Warn(this ILogger logger, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) + { + if (logger is ILogger2 logger2) + { + logger2.Warn(typeof(T), messageTemplate, propertyValue0, propertyValue1, propertyValue2); + } + else + { + logger.Warn(typeof(T), messageTemplate, propertyValue0, propertyValue1, propertyValue2); + } + } + + + public static void Info(this ILogger logger, string messageTemplate, T0 propertyValue0) + { + if (logger is ILogger2 logger2) + { + logger2.Info(typeof(T), messageTemplate, propertyValue0); + } + else + { + logger.Info(typeof(T), messageTemplate, propertyValue0); + } + } + public static void Info(this ILogger logger, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + { + if (logger is ILogger2 logger2) + { + logger2.Info(typeof(T), messageTemplate, propertyValue0, propertyValue1); + } + else + { + logger.Info(typeof(T), messageTemplate, propertyValue0, propertyValue1); + } + } + public static void Info(this ILogger logger, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) + { + if (logger is ILogger2 logger2) + { + logger2.Info(typeof(T), messageTemplate, propertyValue0, propertyValue1, propertyValue2); + } + else + { + logger.Info(typeof(T), messageTemplate, propertyValue0, propertyValue1, propertyValue2); + } + } + public static void Debug(this ILogger logger, string messageTemplate, T0 propertyValue0) + { + if (logger is ILogger2 logger2) + { + logger2.Debug(typeof(T), messageTemplate, propertyValue0); + } + else + { + logger.Debug(typeof(T), messageTemplate, propertyValue0); + } + } + public static void Debug(this ILogger logger, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + { + if (logger is ILogger2 logger2) + { + logger2.Debug(typeof(T), messageTemplate, propertyValue0, propertyValue1); + } + else + { + logger.Debug(typeof(T), messageTemplate, propertyValue0, propertyValue1); + } + } + public static void Debug(this ILogger logger, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) + { + if (logger is ILogger2 logger2) + { + logger2.Debug(typeof(T), messageTemplate, propertyValue0, propertyValue1, propertyValue2); + } + else + { + logger.Debug(typeof(T), messageTemplate, propertyValue0, propertyValue1, propertyValue2); + } + } + } +} diff --git a/src/Umbraco.Core/Logging/OwinLogger.cs b/src/Umbraco.Core/Logging/OwinLogger.cs index 5601cb53f2..7fc36e748c 100644 --- a/src/Umbraco.Core/Logging/OwinLogger.cs +++ b/src/Umbraco.Core/Logging/OwinLogger.cs @@ -26,34 +26,34 @@ namespace Umbraco.Core.Logging switch (eventType) { case TraceEventType.Critical: - _logger.Fatal(_type.Value, exception, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state); + _logger.Fatal(_type.Value, exception, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state); return true; case TraceEventType.Error: - _logger.Error(_type.Value, exception, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state); + _logger.Error(_type.Value, exception, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state); return true; case TraceEventType.Warning: _logger.Warn(_type.Value, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state); return true; case TraceEventType.Information: - _logger.Info(_type.Value, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state); + _logger.Info(_type.Value, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state); return true; case TraceEventType.Verbose: - _logger.Debug(_type.Value, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state); + _logger.Debug(_type.Value, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state); return true; case TraceEventType.Start: - _logger.Debug(_type.Value, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state); + _logger.Debug(_type.Value, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state); return true; case TraceEventType.Stop: - _logger.Debug(_type.Value, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state); + _logger.Debug(_type.Value, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state); return true; case TraceEventType.Suspend: - _logger.Debug(_type.Value, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state); + _logger.Debug(_type.Value, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state); return true; case TraceEventType.Resume: - _logger.Debug(_type.Value, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state); + _logger.Debug(_type.Value, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state); return true; case TraceEventType.Transfer: - _logger.Debug(_type.Value, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state); + _logger.Debug(_type.Value, "[{EventType}] Event Id: {EventId}, State: {State}", eventType, eventId, state); return true; default: throw new ArgumentOutOfRangeException("eventType"); diff --git a/src/Umbraco.Core/Logging/ProfilingLogger.cs b/src/Umbraco.Core/Logging/ProfilingLogger.cs index d642926147..e49aaa26c6 100644 --- a/src/Umbraco.Core/Logging/ProfilingLogger.cs +++ b/src/Umbraco.Core/Logging/ProfilingLogger.cs @@ -127,6 +127,64 @@ namespace Umbraco.Core.Logging public void Verbose(Type reporting, string messageTemplate, params object[] propertyValues) => Logger.Verbose(reporting, messageTemplate, propertyValues); + public void Fatal(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, + T1 propertyValue1, T2 propertyValue2) + => Logger.Fatal(reporting, exception, messageTemplate, propertyValue0, propertyValue1, propertyValue2); + + public void Fatal(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + => Logger.Fatal(reporting, exception, messageTemplate, propertyValue0, propertyValue1); + + public void Fatal(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0) + => Logger.Fatal(reporting, exception, messageTemplate, propertyValue0); + + public void Error(Type reporting, Exception exception, string messageTemplate, + T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) + => Logger.Error(reporting, exception, messageTemplate, propertyValue0, propertyValue1, propertyValue2); + + public void Error(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + => Logger.Error(reporting, exception, messageTemplate, propertyValue0, propertyValue1); + + public void Error(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0) + => Logger.Error(reporting, exception, messageTemplate, propertyValue0); + + public void Warn(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) + => Logger.Warn(reporting, exception, messageTemplate, propertyValue0, propertyValue1, propertyValue2); + + public void Warn(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + => Logger.Warn(reporting, exception, messageTemplate, propertyValue0, propertyValue1); + + public void Warn(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0) + => Logger.Warn(reporting, exception, messageTemplate, propertyValue0); + + public void Warn(Type reporting, string message, T0 propertyValue0) => Logger.Warn(reporting, message, propertyValue0); + + public void Info(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) + => Logger.Info(reporting, messageTemplate, propertyValue0, propertyValue1, propertyValue2); + + public void Info(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + => Logger.Info(reporting, messageTemplate, propertyValue0, propertyValue1); + + public void Info(Type reporting, string messageTemplate, T0 propertyValue0) + => Logger.Info(reporting, messageTemplate, propertyValue0); + + public void Debug(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) + => Logger.Debug(reporting, messageTemplate, propertyValue0, propertyValue1, propertyValue2); + + public void Debug(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + => Logger.Debug(reporting, messageTemplate, propertyValue0, propertyValue1); + + public void Debug(Type reporting, string messageTemplate, T0 propertyValue0) + => Logger.Debug(reporting, messageTemplate, propertyValue0); + + public void Verbose(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) + => Logger.Verbose(reporting, messageTemplate, propertyValue0, propertyValue1, propertyValue2); + + public void Verbose(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + => Logger.Verbose(reporting, messageTemplate, propertyValue0, propertyValue1); + + public void Verbose(Type reporting, string messageTemplate, T0 propertyValue0) + => Logger.Verbose(reporting, messageTemplate, propertyValue0); + #endregion } } diff --git a/src/Umbraco.Core/Logging/Serilog/SerilogLogger.cs b/src/Umbraco.Core/Logging/Serilog/SerilogLogger.cs index a51628030e..0f6121c1ee 100644 --- a/src/Umbraco.Core/Logging/Serilog/SerilogLogger.cs +++ b/src/Umbraco.Core/Logging/Serilog/SerilogLogger.cs @@ -118,6 +118,30 @@ namespace Umbraco.Core.Logging.Serilog logger.Fatal(exception, messageTemplate, propertyValues); } + /// + public void Fatal(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0) + { + var logger = LoggerFor(reporting); + DumpThreadAborts(logger, LogEventLevel.Fatal, exception, ref messageTemplate); + logger.Fatal(exception, messageTemplate, propertyValue0); + } + + /// + public void Fatal(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + { + var logger = LoggerFor(reporting); + DumpThreadAborts(logger, LogEventLevel.Fatal, exception, ref messageTemplate); + logger.Fatal(exception, messageTemplate, propertyValue0, propertyValue1); + } + + /// + public void Fatal(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) + { + var logger = LoggerFor(reporting); + DumpThreadAborts(logger, LogEventLevel.Fatal, exception, ref messageTemplate); + logger.Fatal(exception, messageTemplate, propertyValue0, propertyValue1, propertyValue2); + } + /// public void Error(Type reporting, Exception exception, string message) { @@ -154,6 +178,29 @@ namespace Umbraco.Core.Logging.Serilog DumpThreadAborts(logger, LogEventLevel.Error, exception, ref messageTemplate); logger.Error(exception, messageTemplate, propertyValues); } + /// + public void Error(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0) + { + var logger = LoggerFor(reporting); + DumpThreadAborts(logger, LogEventLevel.Error, exception, ref messageTemplate); + logger.Error(exception, messageTemplate, propertyValue0); + } + + /// + public void Error(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + { + var logger = LoggerFor(reporting); + DumpThreadAborts(logger, LogEventLevel.Error, exception, ref messageTemplate); + logger.Error(exception, messageTemplate, propertyValue0, propertyValue1); + } + + /// + public void Error(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) + { + var logger = LoggerFor(reporting); + DumpThreadAborts(logger, LogEventLevel.Error, exception, ref messageTemplate); + logger.Error(exception, messageTemplate, propertyValue0, propertyValue1, propertyValue2); + } private static void DumpThreadAborts(global::Serilog.ILogger logger, LogEventLevel level, Exception exception, ref string messageTemplate) { @@ -224,6 +271,12 @@ namespace Umbraco.Core.Logging.Serilog LoggerFor(reporting).Warning(message, propertyValues); } + /// + public void Warn(Type reporting, string message, T0 propertyValue0) + { + LoggerFor(reporting).Warning(message, propertyValue0); + } + /// public void Warn(Type reporting, Exception exception, string message) { @@ -235,6 +288,29 @@ namespace Umbraco.Core.Logging.Serilog { LoggerFor(reporting).Warning(exception, messageTemplate, propertyValues); } + /// + public void Warn(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0) + { + var logger = LoggerFor(reporting); + DumpThreadAborts(logger, LogEventLevel.Warning, exception, ref messageTemplate); + logger.Warning(exception, messageTemplate, propertyValue0); + } + + /// + public void Warn(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + { + var logger = LoggerFor(reporting); + DumpThreadAborts(logger, LogEventLevel.Warning, exception, ref messageTemplate); + logger.Warning(exception, messageTemplate, propertyValue0, propertyValue1); + } + + /// + public void Warn(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) + { + var logger = LoggerFor(reporting); + DumpThreadAborts(logger, LogEventLevel.Warning, exception, ref messageTemplate); + logger.Warning(exception, messageTemplate, propertyValue0, propertyValue1, propertyValue2); + } /// public void Info(Type reporting, string message) @@ -248,6 +324,23 @@ namespace Umbraco.Core.Logging.Serilog LoggerFor(reporting).Information(messageTemplate, propertyValues); } + + /// + public void Info(Type reporting, string messageTemplate, T0 propertyValue0) + { + LoggerFor(reporting).Information(messageTemplate, propertyValue0); + } + /// + public void Info(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + { + LoggerFor(reporting).Information(messageTemplate, propertyValue0, propertyValue1); + } + /// + public void Info(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) + { + LoggerFor(reporting).Information(messageTemplate, propertyValue0, propertyValue1, propertyValue2); + } + /// public void Debug(Type reporting, string message) { @@ -259,6 +352,21 @@ namespace Umbraco.Core.Logging.Serilog { LoggerFor(reporting).Debug(messageTemplate, propertyValues); } + /// + public void Debug(Type reporting, string messageTemplate, T0 propertyValue0) + { + LoggerFor(reporting).Debug(messageTemplate, propertyValue0); + } + /// + public void Debug(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + { + LoggerFor(reporting).Debug(messageTemplate, propertyValue0, propertyValue1); + } + /// + public void Debug(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) + { + LoggerFor(reporting).Debug(messageTemplate, propertyValue0, propertyValue1, propertyValue2); + } /// public void Verbose(Type reporting, string message) @@ -272,6 +380,22 @@ namespace Umbraco.Core.Logging.Serilog LoggerFor(reporting).Verbose(messageTemplate, propertyValues); } + /// + public void Verbose(Type reporting, string messageTemplate, T0 propertyValue0) + { + LoggerFor(reporting).Verbose(messageTemplate, propertyValue0); + } + /// + public void Verbose(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + { + LoggerFor(reporting).Verbose(messageTemplate, propertyValue0, propertyValue1); + } + /// + public void Verbose(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) + { + LoggerFor(reporting).Verbose(messageTemplate, propertyValue0, propertyValue1, propertyValue2); + } + public void Dispose() { Log.CloseAndFlush(); diff --git a/src/Umbraco.Core/Manifest/ManifestParser.cs b/src/Umbraco.Core/Manifest/ManifestParser.cs index 1ecc738b95..9bbb0875d8 100644 --- a/src/Umbraco.Core/Manifest/ManifestParser.cs +++ b/src/Umbraco.Core/Manifest/ManifestParser.cs @@ -85,7 +85,7 @@ namespace Umbraco.Core.Manifest } catch (Exception e) { - _logger.Error(e, "Failed to parse manifest at '{Path}', ignoring.", path); + _logger.Error(e, "Failed to parse manifest at '{Path}', ignoring.", path); } } diff --git a/src/Umbraco.Core/Manifest/ManifestWatcher.cs b/src/Umbraco.Core/Manifest/ManifestWatcher.cs index 4c0ddbf822..6c195edb45 100644 --- a/src/Umbraco.Core/Manifest/ManifestWatcher.cs +++ b/src/Umbraco.Core/Manifest/ManifestWatcher.cs @@ -54,7 +54,7 @@ namespace Umbraco.Core.Manifest if (_isRestarting) return; _isRestarting = true; - _logger.Info("Manifest has changed, app pool is restarting ({Path})", e.FullPath); + _logger.Info("Manifest has changed, app pool is restarting ({Path})", e.FullPath); HttpRuntime.UnloadAppDomain(); Dispose(); // uh? if the app restarts then this should be disposed anyways? } diff --git a/src/Umbraco.Core/Migrations/Install/DatabaseBuilder.cs b/src/Umbraco.Core/Migrations/Install/DatabaseBuilder.cs index fb9b8af46d..7106ef188e 100644 --- a/src/Umbraco.Core/Migrations/Install/DatabaseBuilder.cs +++ b/src/Umbraco.Core/Migrations/Install/DatabaseBuilder.cs @@ -332,9 +332,9 @@ namespace Umbraco.Core.Migrations.Install } // save - logger.Info("Saving connection string to {ConfigFile}.", fileSource); + logger.Info("Saving connection string to {ConfigFile}.", fileSource); xml.Save(fileName, SaveOptions.DisableFormatting); - logger.Info("Saved connection string to {ConfigFile}.", fileSource); + logger.Info("Saved connection string to {ConfigFile}.", fileSource); } private static void AddOrUpdateAttribute(XElement element, string name, string value) @@ -459,7 +459,7 @@ namespace Umbraco.Core.Migrations.Install message = message + "

Installation completed!

"; //now that everything is done, we need to determine the version of SQL server that is executing - _logger.Info("Database configuration status: {DbConfigStatus}", message); + _logger.Info("Database configuration status: {DbConfigStatus}", message); return new Result { Message = message, Success = true, Percentage = "100" }; } @@ -508,7 +508,7 @@ namespace Umbraco.Core.Migrations.Install //now that everything is done, we need to determine the version of SQL server that is executing - _logger.Info("Database configuration status: {DbConfigStatus}", message); + _logger.Info("Database configuration status: {DbConfigStatus}", message); return new Result { Message = message, Success = true, Percentage = "100" }; } @@ -539,7 +539,7 @@ namespace Umbraco.Core.Migrations.Install if (_databaseSchemaValidationResult != null) { - _logger.Info("The database schema validation produced the following summary: {DbSchemaSummary}", _databaseSchemaValidationResult.GetSummary()); + _logger.Info("The database schema validation produced the following summary: {DbSchemaSummary}", _databaseSchemaValidationResult.GetSummary()); } return new Result diff --git a/src/Umbraco.Core/Migrations/Install/DatabaseDataCreator.cs b/src/Umbraco.Core/Migrations/Install/DatabaseDataCreator.cs index 9bd26749ad..44de611348 100644 --- a/src/Umbraco.Core/Migrations/Install/DatabaseDataCreator.cs +++ b/src/Umbraco.Core/Migrations/Install/DatabaseDataCreator.cs @@ -29,7 +29,7 @@ namespace Umbraco.Core.Migrations.Install /// Name of the table to create base data for public void InitializeBaseData(string tableName) { - _logger.Info("Creating data in {TableName}", tableName); + _logger.Info("Creating data in {TableName}", tableName); if (tableName.Equals(Constants.DatabaseSchema.Tables.Node)) CreateNodeData(); @@ -73,7 +73,7 @@ namespace Umbraco.Core.Migrations.Install if (tableName.Equals(Constants.DatabaseSchema.Tables.KeyValue)) CreateKeyValueData(); - _logger.Info("Done creating table {TableName} data.", tableName); + _logger.Info("Done creating table {TableName} data.", tableName); } private void CreateNodeData() diff --git a/src/Umbraco.Core/Migrations/Install/DatabaseSchemaCreator.cs b/src/Umbraco.Core/Migrations/Install/DatabaseSchemaCreator.cs index e9580da74a..c3756cfaad 100644 --- a/src/Umbraco.Core/Migrations/Install/DatabaseSchemaCreator.cs +++ b/src/Umbraco.Core/Migrations/Install/DatabaseSchemaCreator.cs @@ -100,7 +100,7 @@ namespace Umbraco.Core.Migrations.Install var tableNameAttribute = table.FirstAttribute(); var tableName = tableNameAttribute == null ? table.Name : tableNameAttribute.Value; - _logger.Info("Uninstall {TableName}", tableName); + _logger.Info("Uninstall {TableName}", tableName); try { @@ -111,7 +111,7 @@ namespace Umbraco.Core.Migrations.Install { //swallow this for now, not sure how best to handle this with diff databases... though this is internal // and only used for unit tests. If this fails its because the table doesn't exist... generally! - _logger.Error(ex, "Could not drop table {TableName}", tableName); + _logger.Error(ex, "Could not drop table {TableName}", tableName); } } } @@ -436,7 +436,7 @@ namespace Umbraco.Core.Migrations.Install var tableExist = TableExists(tableName); if (overwrite && tableExist) { - _logger.Info("Table {TableName} already exists, but will be recreated", tableName); + _logger.Info("Table {TableName} already exists, but will be recreated", tableName); DropTable(tableName); tableExist = false; @@ -445,19 +445,19 @@ namespace Umbraco.Core.Migrations.Install if (tableExist) { // The table exists and was not recreated/overwritten. - _logger.Info("Table {TableName} already exists - no changes were made", tableName); + _logger.Info("Table {TableName} already exists - no changes were made", tableName); return; } //Execute the Create Table sql _database.Execute(new Sql(createSql)); - _logger.Info("Create Table {TableName}: \n {Sql}", tableName, createSql); + _logger.Info("Create Table {TableName}: \n {Sql}", tableName, createSql); //If any statements exists for the primary key execute them here if (string.IsNullOrEmpty(createPrimaryKeySql) == false) { _database.Execute(new Sql(createPrimaryKeySql)); - _logger.Info("Create Primary Key:\n {Sql}", createPrimaryKeySql); + _logger.Info("Create Primary Key:\n {Sql}", createPrimaryKeySql); } if (SqlSyntax.SupportsIdentityInsert() && tableDefinition.Columns.Any(x => x.IsIdentity)) @@ -475,23 +475,23 @@ namespace Umbraco.Core.Migrations.Install foreach (var sql in indexSql) { _database.Execute(new Sql(sql)); - _logger.Info("Create Index:\n {Sql}", sql); + _logger.Info("Create Index:\n {Sql}", sql); } //Loop through foreignkey statements and execute sql foreach (var sql in foreignSql) { _database.Execute(new Sql(sql)); - _logger.Info("Create Foreign Key:\n {Sql}", sql); + _logger.Info("Create Foreign Key:\n {Sql}", sql); } if (overwrite) { - _logger.Info("Table {TableName} was recreated", tableName); + _logger.Info("Table {TableName} was recreated", tableName); } else { - _logger.Info("New table {TableName} was created", tableName); + _logger.Info("New table {TableName} was created", tableName); } } diff --git a/src/Umbraco.Core/Migrations/MigrationPlan.cs b/src/Umbraco.Core/Migrations/MigrationPlan.cs index 89c3c809e8..088d990221 100644 --- a/src/Umbraco.Core/Migrations/MigrationPlan.cs +++ b/src/Umbraco.Core/Migrations/MigrationPlan.cs @@ -294,11 +294,11 @@ namespace Umbraco.Core.Migrations if (migrationBuilder == null) throw new ArgumentNullException(nameof(migrationBuilder)); if (logger == null) throw new ArgumentNullException(nameof(logger)); - logger.Info("Starting '{MigrationName}'...", Name); + logger.Info("Starting '{MigrationName}'...", Name); var origState = fromState ?? string.Empty; - logger.Info("At {OrigState}", string.IsNullOrWhiteSpace(origState) ? "origin": origState); + logger.Info("At {OrigState}", string.IsNullOrWhiteSpace(origState) ? "origin": origState); if (!_transitions.TryGetValue(origState, out var transition)) ThrowOnUnknownInitialState(origState); @@ -308,7 +308,7 @@ namespace Umbraco.Core.Migrations while (transition != null) { - logger.Info("Execute {MigrationType}", transition.MigrationType.Name); + logger.Info("Execute {MigrationType}", transition.MigrationType.Name); var migration = migrationBuilder.Build(transition.MigrationType, context); migration.Migrate(); @@ -316,7 +316,7 @@ namespace Umbraco.Core.Migrations var nextState = transition.TargetState; origState = nextState; - logger.Info("At {OrigState}", origState); + logger.Info("At {OrigState}", origState); // throw a raw exception here: this should never happen as the plan has // been validated - this is just a paranoid safety test diff --git a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DataTypeMigration.cs b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DataTypeMigration.cs index 95b272dcb4..b69158e433 100644 --- a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DataTypeMigration.cs +++ b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DataTypeMigration.cs @@ -94,7 +94,7 @@ namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0 { if (!LegacyAliases.Contains(dataType.EditorAlias)) { - _logger.Warn( + _logger.Warn( "Skipping validation of configuration for data type {NodeId} : {EditorAlias}." + " Please ensure that the configuration is valid. The site may fail to start and / or load data types and run.", dataType.NodeId, dataType.EditorAlias); @@ -104,7 +104,7 @@ namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0 { if (!LegacyAliases.Contains(newAlias)) { - _logger.Warn("Skipping validation of configuration for data type {NodeId} : {NewEditorAlias} (was: {EditorAlias})" + _logger.Warn("Skipping validation of configuration for data type {NodeId} : {NewEditorAlias} (was: {EditorAlias})" + " because no property editor with that alias was found." + " Please ensure that the configuration is valid. The site may fail to start and / or load data types and run.", dataType.NodeId, newAlias, dataType.EditorAlias); @@ -119,7 +119,7 @@ namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0 } catch (Exception e) { - _logger.Warn(e, "Failed to validate configuration for data type {NodeId} : {NewEditorAlias} (was: {EditorAlias})." + _logger.Warn(e, "Failed to validate configuration for data type {NodeId} : {NewEditorAlias} (was: {EditorAlias})." + " Please fix the configuration and ensure it is valid. The site may fail to start and / or load data types and run.", dataType.NodeId, newAlias, dataType.EditorAlias); } diff --git a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DataTypes/PreValueMigratorCollection.cs b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DataTypes/PreValueMigratorCollection.cs index 06f5d45deb..2eadb6c045 100644 --- a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DataTypes/PreValueMigratorCollection.cs +++ b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DataTypes/PreValueMigratorCollection.cs @@ -19,7 +19,7 @@ namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0.DataTypes public IPreValueMigrator GetMigrator(string editorAlias) { var migrator = this.FirstOrDefault(x => x.CanMigrate(editorAlias)); - _logger.Debug(GetType(), "Getting migrator for \"{EditorAlias}\" = {MigratorType}", editorAlias, migrator == null ? "" : migrator.GetType().Name); + _logger.Debug(GetType(), "Getting migrator for \"{EditorAlias}\" = {MigratorType}", editorAlias, migrator == null ? "" : migrator.GetType().Name); return migrator; } } diff --git a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DropDownPropertyEditorsMigration.cs b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DropDownPropertyEditorsMigration.cs index d30719231a..ed2681e6f1 100644 --- a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DropDownPropertyEditorsMigration.cs +++ b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DropDownPropertyEditorsMigration.cs @@ -46,7 +46,7 @@ namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0 } catch (Exception ex) { - Logger.Error( + Logger.Error( ex, "Invalid configuration: \"{Configuration}\", cannot convert editor.", dataType.Configuration); diff --git a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/MergeDateAndDateTimePropertyEditor.cs b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/MergeDateAndDateTimePropertyEditor.cs index 37a83bdd67..d4f483c46e 100644 --- a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/MergeDateAndDateTimePropertyEditor.cs +++ b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/MergeDateAndDateTimePropertyEditor.cs @@ -36,7 +36,7 @@ namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0 } catch (Exception ex) { - Logger.Error( + Logger.Error( ex, "Invalid property editor configuration detected: \"{Configuration}\", cannot convert editor, values will be cleared", dataType.Configuration); diff --git a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/RadioAndCheckboxPropertyEditorsMigration.cs b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/RadioAndCheckboxPropertyEditorsMigration.cs index e96fa1f7e9..fadc3579f2 100644 --- a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/RadioAndCheckboxPropertyEditorsMigration.cs +++ b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/RadioAndCheckboxPropertyEditorsMigration.cs @@ -50,7 +50,7 @@ namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0 } catch (Exception ex) { - Logger.Error( + Logger.Error( ex, "Invalid configuration: \"{Configuration}\", cannot convert editor.", dataType.Configuration); diff --git a/src/Umbraco.Core/Models/Member.cs b/src/Umbraco.Core/Models/Member.cs index 49e07a486d..07f43074a7 100644 --- a/src/Umbraco.Core/Models/Member.cs +++ b/src/Umbraco.Core/Models/Member.cs @@ -501,7 +501,7 @@ namespace Umbraco.Core.Models { void DoLog(string logPropertyAlias, string logPropertyName) { - Current.Logger.Warn("Trying to access the '{PropertyName}' property on '{MemberType}' " + + Current.Logger.Warn("Trying to access the '{PropertyName}' property on '{MemberType}' " + "but the {PropertyAlias} property does not exist on the member type so a default value is returned. " + "Ensure that you have a property type with alias: {PropertyAlias} configured on your member type in order to use the '{PropertyName}' property on the model correctly.", logPropertyName, @@ -526,7 +526,7 @@ namespace Umbraco.Core.Models { void DoLog(string logPropertyAlias, string logPropertyName) { - Current.Logger.Warn("An attempt was made to set a value on the property '{PropertyName}' on type '{MemberType}' but the " + + Current.Logger.Warn("An attempt was made to set a value on the property '{PropertyName}' on type '{MemberType}' but the " + "property type {PropertyAlias} does not exist on the member type, ensure that this property type exists so that setting this property works correctly.", logPropertyName, typeof(Member), diff --git a/src/Umbraco.Core/Packaging/PackageActionRunner.cs b/src/Umbraco.Core/Packaging/PackageActionRunner.cs index 8434f52f30..41dbc5cf4c 100644 --- a/src/Umbraco.Core/Packaging/PackageActionRunner.cs +++ b/src/Umbraco.Core/Packaging/PackageActionRunner.cs @@ -34,7 +34,7 @@ namespace Umbraco.Core.Packaging catch (Exception ex) { e.Add($"{ipa.Alias()} - {ex.Message}"); - _logger.Error(ex, "Error loading package action '{PackageActionAlias}' for package {PackageName}", ipa.Alias(), packageName); + _logger.Error(ex, "Error loading package action '{PackageActionAlias}' for package {PackageName}", ipa.Alias(), packageName); } } @@ -56,7 +56,7 @@ namespace Umbraco.Core.Packaging catch (Exception ex) { e.Add($"{ipa.Alias()} - {ex.Message}"); - _logger.Error(ex, "Error undoing package action '{PackageActionAlias}' for package {PackageName}", ipa.Alias(), packageName); + _logger.Error(ex, "Error undoing package action '{PackageActionAlias}' for package {PackageName}", ipa.Alias(), packageName); } } errors = e; diff --git a/src/Umbraco.Core/Packaging/PackageDataInstallation.cs b/src/Umbraco.Core/Packaging/PackageDataInstallation.cs index 6262f99c56..016b349282 100644 --- a/src/Umbraco.Core/Packaging/PackageDataInstallation.cs +++ b/src/Umbraco.Core/Packaging/PackageDataInstallation.cs @@ -564,7 +564,7 @@ namespace Umbraco.Core.Packaging var tryCreateFolder = _contentTypeService.CreateContainer(-1, rootFolder); if (tryCreateFolder == false) { - _logger.Error(tryCreateFolder.Exception, "Could not create folder: {FolderName}", rootFolder); + _logger.Error(tryCreateFolder.Exception, "Could not create folder: {FolderName}", rootFolder); throw tryCreateFolder.Exception; } var rootFolderId = tryCreateFolder.Result.Entity.Id; @@ -598,7 +598,7 @@ namespace Umbraco.Core.Packaging var tryCreateFolder = _contentTypeService.CreateContainer(current.Id, folderName); if (tryCreateFolder == false) { - _logger.Error(tryCreateFolder.Exception, "Could not create folder: {FolderName}", folderName); + _logger.Error(tryCreateFolder.Exception, "Could not create folder: {FolderName}", folderName); throw tryCreateFolder.Exception; } return _contentTypeService.GetContainer(tryCreateFolder.Result.Entity.Id); @@ -713,7 +713,7 @@ namespace Umbraco.Core.Packaging } else { - _logger.Warn("Packager: Error handling allowed templates. Template with alias '{TemplateAlias}' could not be found.", alias); + _logger.Warn("Packager: Error handling allowed templates. Template with alias '{TemplateAlias}' could not be found.", alias); } } @@ -729,7 +729,7 @@ namespace Umbraco.Core.Packaging } else { - _logger.Warn("Packager: Error handling default template. Default template with alias '{DefaultTemplateAlias}' could not be found.", defaultTemplateElement.Value); + _logger.Warn("Packager: Error handling default template. Default template with alias '{DefaultTemplateAlias}' could not be found.", defaultTemplateElement.Value); } } } @@ -801,7 +801,7 @@ namespace Umbraco.Core.Packaging if (dataTypeDefinition == null) { // TODO: We should expose this to the UI during install! - _logger.Warn("Packager: Error handling creation of PropertyType '{PropertyType}'. Could not find DataTypeDefintion with unique id '{DataTypeDefinitionId}' nor one referencing the DataType with a property editor alias (or legacy control id) '{PropertyEditorAlias}'. Did the package creator forget to package up custom datatypes? This property will be converted to a label/readonly editor if one exists.", + _logger.Warn("Packager: Error handling creation of PropertyType '{PropertyType}'. Could not find DataTypeDefintion with unique id '{DataTypeDefinitionId}' nor one referencing the DataType with a property editor alias (or legacy control id) '{PropertyEditorAlias}'. Did the package creator forget to package up custom datatypes? This property will be converted to a label/readonly editor if one exists.", property.Element("Name").Value, dataTypeDefinitionId, property.Element("Type").Value.Trim()); //convert to a label! @@ -863,7 +863,7 @@ namespace Umbraco.Core.Packaging var allowedChild = importedContentTypes.ContainsKey(alias) ? importedContentTypes[alias] : _contentTypeService.Get(alias); if (allowedChild == null) { - _logger.Warn( + _logger.Warn( "Packager: Error handling DocumentType structure. DocumentType with alias '{DoctypeAlias}' could not be found and was not added to the structure for '{DoctypeStructureAlias}'.", alias, contentType.Alias); continue; @@ -984,7 +984,7 @@ namespace Umbraco.Core.Packaging var tryCreateFolder = _dataTypeService.CreateContainer(-1, rootFolder); if (tryCreateFolder == false) { - _logger.Error(tryCreateFolder.Exception, "Could not create folder: {FolderName}", rootFolder); + _logger.Error(tryCreateFolder.Exception, "Could not create folder: {FolderName}", rootFolder); throw tryCreateFolder.Exception; } current = _dataTypeService.GetContainer(tryCreateFolder.Result.Entity.Id); @@ -1017,7 +1017,7 @@ namespace Umbraco.Core.Packaging var tryCreateFolder = _dataTypeService.CreateContainer(current.Id, folderName); if (tryCreateFolder == false) { - _logger.Error(tryCreateFolder.Exception, "Could not create folder: {FolderName}", folderName); + _logger.Error(tryCreateFolder.Exception, "Could not create folder: {FolderName}", folderName); throw tryCreateFolder.Exception; } return _dataTypeService.GetContainer(tryCreateFolder.Result.Entity.Id); @@ -1322,7 +1322,7 @@ namespace Umbraco.Core.Packaging else if (string.IsNullOrEmpty((string)elementCopy.Element("Master")) == false && templateElements.Any(x => (string)x.Element("Alias") == (string)elementCopy.Element("Master")) == false) { - _logger.Info( + _logger.Info( "Template '{TemplateAlias}' has an invalid Master '{TemplateMaster}', so the reference has been ignored.", (string)elementCopy.Element("Alias"), (string)elementCopy.Element("Master")); diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/ContentRepositoryBase.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/ContentRepositoryBase.cs index a78a073554..ddac0ee3d6 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/ContentRepositoryBase.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/ContentRepositoryBase.cs @@ -701,7 +701,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement { if (ContentRepositoryBase.ThrowOnWarning) throw new InvalidOperationException($"The query returned multiple property sets for content {temp.Id}, {temp.ContentType.Name}"); - Logger.Warn>("The query returned multiple property sets for content {ContentId}, {ContentTypeName}", temp.Id, temp.ContentType.Name); + Logger.Warn, int, string>("The query returned multiple property sets for content {ContentId}, {ContentTypeName}", temp.Id, temp.ContentType.Name); } result[temp.VersionId] = new PropertyCollection(properties); diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepository.cs index 483f2393af..6571a847a9 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepository.cs @@ -228,7 +228,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement if (string.IsNullOrWhiteSpace(entity.Alias)) { var ex = new Exception($"ContentType '{entity.Name}' cannot have an empty Alias. This is most likely due to invalid characters stripped from the Alias."); - Logger.Error("ContentType '{EntityName}' cannot have an empty Alias. This is most likely due to invalid characters stripped from the Alias.", entity.Name); + Logger.Error("ContentType '{EntityName}' cannot have an empty Alias. This is most likely due to invalid characters stripped from the Alias.", entity.Name); throw ex; } diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs index ed0c288691..a061337127 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs @@ -1203,7 +1203,7 @@ AND umbracoNode.id <> @id", { var ex = new InvalidOperationException($"Property Type '{pt.Name}' cannot have an empty Alias. This is most likely due to invalid characters stripped from the Alias."); - Logger.Error>("Property Type '{PropertyTypeName}' cannot have an empty Alias. This is most likely due to invalid characters stripped from the Alias.", + Logger.Error, string>("Property Type '{PropertyTypeName}' cannot have an empty Alias. This is most likely due to invalid characters stripped from the Alias.", pt.Name); throw ex; @@ -1216,7 +1216,7 @@ AND umbracoNode.id <> @id", { var ex = new InvalidOperationException($"{typeof(TEntity).Name} '{entity.Name}' cannot have an empty Alias. This is most likely due to invalid characters stripped from the Alias."); - Logger.Error>("{EntityTypeName} '{EntityName}' cannot have an empty Alias. This is most likely due to invalid characters stripped from the Alias.", + Logger.Error, string, string>("{EntityTypeName} '{EntityName}' cannot have an empty Alias. This is most likely due to invalid characters stripped from the Alias.", typeof(TEntity).Name, entity.Name); @@ -1248,7 +1248,7 @@ AND umbracoNode.id <> @id", } else { - Logger.Warn>("Could not assign a data type for the property type {PropertyTypeAlias} since no data type was found with a property editor {PropertyEditorAlias}", propertyType.Alias, propertyType.PropertyEditorAlias); + Logger.Warn, string, string>("Could not assign a data type for the property type {PropertyTypeAlias} since no data type was found with a property editor {PropertyEditorAlias}", propertyType.Alias, propertyType.PropertyEditorAlias); } } } diff --git a/src/Umbraco.Core/Persistence/UmbracoDatabase.cs b/src/Umbraco.Core/Persistence/UmbracoDatabase.cs index a95d95ea08..5e6192eb5c 100644 --- a/src/Umbraco.Core/Persistence/UmbracoDatabase.cs +++ b/src/Umbraco.Core/Persistence/UmbracoDatabase.cs @@ -203,10 +203,10 @@ namespace Umbraco.Core.Persistence protected override void OnException(Exception ex) { - _logger.Error(ex, "Exception ({InstanceId}).", InstanceId); - _logger.Debug("At:\r\n{StackTrace}", Environment.StackTrace); + _logger.Error(ex, "Exception ({InstanceId}).", InstanceId); + _logger.Debug("At:\r\n{StackTrace}", Environment.StackTrace); if (EnableSqlTrace == false) - _logger.Debug("Sql:\r\n{Sql}", CommandToString(LastSQL, LastArgs)); + _logger.Debug("Sql:\r\n{Sql}", CommandToString(LastSQL, LastArgs)); base.OnException(ex); } @@ -219,7 +219,7 @@ namespace Umbraco.Core.Persistence cmd.CommandTimeout = cmd.Connection.ConnectionTimeout; if (EnableSqlTrace) - _logger.Debug("SQL Trace:\r\n{Sql}", CommandToString(cmd).Replace("{", "{{").Replace("}", "}}")); // TODO: these escapes should be builtin + _logger.Debug("SQL Trace:\r\n{Sql}", CommandToString(cmd).Replace("{", "{{").Replace("}", "}}")); // TODO: these escapes should be builtin #if DEBUG_DATABASES // detects whether the command is already in use (eg still has an open reader...) diff --git a/src/Umbraco.Core/Persistence/UmbracoDatabaseFactory.cs b/src/Umbraco.Core/Persistence/UmbracoDatabaseFactory.cs index baab8c486e..b113769a1a 100644 --- a/src/Umbraco.Core/Persistence/UmbracoDatabaseFactory.cs +++ b/src/Umbraco.Core/Persistence/UmbracoDatabaseFactory.cs @@ -162,7 +162,7 @@ namespace Umbraco.Core.Persistence // else leave unchanged } - _logger.Debug("SqlServer {SqlServerVersion}, DatabaseType is {DatabaseType} ({Source}).", + _logger.Debug("SqlServer {SqlServerVersion}, DatabaseType is {DatabaseType} ({Source}).", versionName, _databaseType, fromSettings ? "settings" : "detected"); } diff --git a/src/Umbraco.Core/PropertyEditors/DataValueEditor.cs b/src/Umbraco.Core/PropertyEditors/DataValueEditor.cs index eebe5f5722..fbcd5ec440 100644 --- a/src/Umbraco.Core/PropertyEditors/DataValueEditor.cs +++ b/src/Umbraco.Core/PropertyEditors/DataValueEditor.cs @@ -219,7 +219,7 @@ namespace Umbraco.Core.PropertyEditors var result = TryConvertValueToCrlType(editorValue.Value); if (result.Success == false) { - Current.Logger.Warn("The value {EditorValue} cannot be converted to the type {StorageTypeValue}", editorValue.Value, ValueTypes.ToStorageType(ValueType)); + Current.Logger.Warn("The value {EditorValue} cannot be converted to the type {StorageTypeValue}", editorValue.Value, ValueTypes.ToStorageType(ValueType)); return null; } return result.Result; diff --git a/src/Umbraco.Core/PropertyEditors/ValueConverters/GridValueConverter.cs b/src/Umbraco.Core/PropertyEditors/ValueConverters/GridValueConverter.cs index b3685457ec..fdb0a8c842 100644 --- a/src/Umbraco.Core/PropertyEditors/ValueConverters/GridValueConverter.cs +++ b/src/Umbraco.Core/PropertyEditors/ValueConverters/GridValueConverter.cs @@ -96,7 +96,7 @@ namespace Umbraco.Core.PropertyEditors.ValueConverters } catch (Exception ex) { - Current.Logger.Error(ex, "Could not parse the string '{JsonString}' to a json object", sourceString); + Current.Logger.Error(ex, "Could not parse the string '{JsonString}' to a json object", sourceString); } } diff --git a/src/Umbraco.Core/PropertyEditors/ValueConverters/ImageCropperValueConverter.cs b/src/Umbraco.Core/PropertyEditors/ValueConverters/ImageCropperValueConverter.cs index 29e501f993..f8ef82076e 100644 --- a/src/Umbraco.Core/PropertyEditors/ValueConverters/ImageCropperValueConverter.cs +++ b/src/Umbraco.Core/PropertyEditors/ValueConverters/ImageCropperValueConverter.cs @@ -44,8 +44,8 @@ namespace Umbraco.Core.PropertyEditors.ValueConverters } catch (Exception ex) { - // cannot deserialize, assume it may be a raw image URL - Current.Logger.Error(ex, "Could not deserialize string '{JsonString}' into an image cropper value.", sourceString); + // cannot deserialize, assume it may be a raw image url + Current.Logger.Error(ex, "Could not deserialize string '{JsonString}' into an image cropper value.", sourceString); value = new ImageCropperValue { Src = sourceString }; } diff --git a/src/Umbraco.Core/PropertyEditors/ValueConverters/JsonValueConverter.cs b/src/Umbraco.Core/PropertyEditors/ValueConverters/JsonValueConverter.cs index 12e6238705..270c8c3b0b 100644 --- a/src/Umbraco.Core/PropertyEditors/ValueConverters/JsonValueConverter.cs +++ b/src/Umbraco.Core/PropertyEditors/ValueConverters/JsonValueConverter.cs @@ -57,7 +57,7 @@ namespace Umbraco.Core.PropertyEditors.ValueConverters } catch (Exception ex) { - Current.Logger.Error(ex, "Could not parse the string '{JsonString}' to a json object", sourceString); + Current.Logger.Error(ex, "Could not parse the string '{JsonString}' to a json object", sourceString); } } diff --git a/src/Umbraco.Core/Runtime/CoreRuntime.cs b/src/Umbraco.Core/Runtime/CoreRuntime.cs index 60e7851251..25bb5d3151 100644 --- a/src/Umbraco.Core/Runtime/CoreRuntime.cs +++ b/src/Umbraco.Core/Runtime/CoreRuntime.cs @@ -98,7 +98,7 @@ namespace Umbraco.Core.Runtime HostingEnvironment.ApplicationID, HostingEnvironment.ApplicationPhysicalPath, NetworkHelper.MachineName); - logger.Debug("Runtime: {Runtime}", GetType().FullName); + logger.Debug("Runtime: {Runtime}", GetType().FullName); // application environment ConfigureUnhandledException(); @@ -359,7 +359,7 @@ namespace Umbraco.Core.Runtime { _state.DetermineRuntimeLevel(databaseFactory); - profilingLogger.Debug("Runtime level: {RuntimeLevel} - {RuntimeLevelReason}", _state.Level, _state.Reason); + profilingLogger.Debug("Runtime level: {RuntimeLevel} - {RuntimeLevelReason}", _state.Level, _state.Reason); if (_state.Level == RuntimeLevel.Upgrade) { diff --git a/src/Umbraco.Core/Runtime/MainDom.cs b/src/Umbraco.Core/Runtime/MainDom.cs index 71842905dd..d930841289 100644 --- a/src/Umbraco.Core/Runtime/MainDom.cs +++ b/src/Umbraco.Core/Runtime/MainDom.cs @@ -101,14 +101,14 @@ namespace Umbraco.Core.Runtime lock (_locko) { - _logger.Debug("Signaled ({Signaled}) ({SignalSource})", _signaled ? "again" : "first", source); + _logger.Debug("Signaled ({Signaled}) ({SignalSource})", _signaled ? "again" : "first", source); if (_signaled) return; if (_isMainDom == false) return; // probably not needed _signaled = true; try { - _logger.Info("Stopping ({SignalSource})", source); + _logger.Info("Stopping ({SignalSource})", source); foreach (var callback in _callbacks.OrderBy(x => x.Key).Select(x => x.Value)) { try @@ -122,14 +122,14 @@ namespace Umbraco.Core.Runtime } } - _logger.Debug("Stopped ({SignalSource})", source); + _logger.Debug("Stopped ({SignalSource})", source); } finally { // in any case... _isMainDom = false; _mainDomLock.Dispose(); - _logger.Info("Released ({SignalSource})", source); + _logger.Info("Released ({SignalSource})", source); } } diff --git a/src/Umbraco.Core/Runtime/SqlMainDomLock.cs b/src/Umbraco.Core/Runtime/SqlMainDomLock.cs index f58b279a8d..d98d62cb20 100644 --- a/src/Umbraco.Core/Runtime/SqlMainDomLock.cs +++ b/src/Umbraco.Core/Runtime/SqlMainDomLock.cs @@ -100,7 +100,7 @@ namespace Umbraco.Core.Runtime // if we've inserted, then there was no MainDom so we can instantly acquire InsertLockRecord(_lockId, db); // so update with our appdomain id - _logger.Debug("Acquired with ID {LockId}", _lockId); + _logger.Debug("Acquired with ID {LockId}", _lockId); return true; } @@ -300,7 +300,7 @@ namespace Umbraco.Core.Runtime // so now we update the row with our appdomain id InsertLockRecord(_lockId, db); - _logger.Debug("Acquired with ID {LockId}", _lockId); + _logger.Debug("Acquired with ID {LockId}", _lockId); return true; } else if (mainDomRows.Count == 1 && !mainDomRows[0].Value.StartsWith(tempId)) @@ -359,7 +359,7 @@ namespace Umbraco.Core.Runtime // so now we update the row with our appdomain id InsertLockRecord(_lockId, db); - _logger.Debug("Acquired with ID {LockId}", _lockId); + _logger.Debug("Acquired with ID {LockId}", _lockId); return true; } catch (Exception ex) diff --git a/src/Umbraco.Core/RuntimeState.cs b/src/Umbraco.Core/RuntimeState.cs index c7a1a18d44..bfc125e44f 100644 --- a/src/Umbraco.Core/RuntimeState.cs +++ b/src/Umbraco.Core/RuntimeState.cs @@ -144,13 +144,13 @@ namespace Umbraco.Core { // there *is* a local version, but it does not match the code version // need to upgrade - _logger.Debug("Local version '{LocalVersion}' < code version '{CodeVersion}', need to upgrade Umbraco.", localVersion, codeVersion); + _logger.Debug("Local version '{LocalVersion}' < code version '{CodeVersion}', need to upgrade Umbraco.", localVersion, codeVersion); Level = RuntimeLevel.Upgrade; Reason = RuntimeLevelReason.UpgradeOldVersion; } else if (localVersion > codeVersion) { - _logger.Warn("Local version '{LocalVersion}' > code version '{CodeVersion}', downgrading is not supported.", localVersion, codeVersion); + _logger.Warn("Local version '{LocalVersion}' > code version '{CodeVersion}', downgrading is not supported.", localVersion, codeVersion); // in fact, this is bad enough that we want to throw Reason = RuntimeLevelReason.BootFailedCannotDowngrade; @@ -290,7 +290,7 @@ namespace Umbraco.Core CurrentMigrationState = KeyValueService.GetValue(database, stateValueKey); FinalMigrationState = upgrader.Plan.FinalState; - _logger.Debug("Final upgrade state is {FinalMigrationState}, database contains {DatabaseState}", FinalMigrationState, CurrentMigrationState ?? ""); + _logger.Debug("Final upgrade state is {FinalMigrationState}, database contains {DatabaseState}", FinalMigrationState, CurrentMigrationState ?? ""); return CurrentMigrationState != FinalMigrationState; } diff --git a/src/Umbraco.Core/Scoping/Scope.cs b/src/Umbraco.Core/Scoping/Scope.cs index 24ef92278c..f69d62e649 100644 --- a/src/Umbraco.Core/Scoping/Scope.cs +++ b/src/Umbraco.Core/Scoping/Scope.cs @@ -311,7 +311,7 @@ namespace Umbraco.Core.Scoping if (completed.HasValue == false || completed.Value == false) { if (LogUncompletedScopes) - _logger.Debug("Uncompleted Child Scope at\r\n {StackTrace}", Environment.StackTrace); + _logger.Debug("Uncompleted Child Scope at\r\n {StackTrace}", Environment.StackTrace); _completed = false; } diff --git a/src/Umbraco.Core/Scoping/ScopeProvider.cs b/src/Umbraco.Core/Scoping/ScopeProvider.cs index 3c0fa94327..bf4e27bdb6 100644 --- a/src/Umbraco.Core/Scoping/ScopeProvider.cs +++ b/src/Umbraco.Core/Scoping/ScopeProvider.cs @@ -117,7 +117,7 @@ namespace Umbraco.Core.Scoping } // hard to inject into a static method :( - Current.Logger.Warn("Missed {TypeName} Object {ObjectKey}", typeof(T).Name, objectKey.ToString("N").Substring(0, 8)); + Current.Logger.Warn("Missed {TypeName} Object {ObjectKey}", typeof(T).Name, objectKey.ToString("N").Substring(0, 8)); #if DEBUG_SCOPES //Current.Logger.Debug("At:\r\n" + Head(Environment.StackTrace, 24)); #endif diff --git a/src/Umbraco.Core/Services/Implement/ContentService.cs b/src/Umbraco.Core/Services/Implement/ContentService.cs index 8b1af5ca31..e5363d0e2b 100644 --- a/src/Umbraco.Core/Services/Implement/ContentService.cs +++ b/src/Umbraco.Core/Services/Implement/ContentService.cs @@ -1415,7 +1415,7 @@ namespace Umbraco.Core.Services.Implement var result = CommitDocumentChangesInternal(scope, d, saveEventArgs, allLangs.Value, d.WriterId); if (result.Success == false) - Logger.Error(null, "Failed to publish document id={DocumentId}, reason={Reason}.", d.Id, result.Result); + Logger.Error(null, "Failed to publish document id={DocumentId}, reason={Reason}.", d.Id, result.Result); results.Add(result); } @@ -1425,7 +1425,7 @@ namespace Umbraco.Core.Services.Implement d.ContentSchedule.Clear(ContentScheduleAction.Expire, date); var result = Unpublish(d, userId: d.WriterId); if (result.Success == false) - Logger.Error(null, "Failed to unpublish document id={DocumentId}, reason={Reason}.", d.Id, result.Result); + Logger.Error(null, "Failed to unpublish document id={DocumentId}, reason={Reason}.", d.Id, result.Result); results.Add(result); } } @@ -1479,7 +1479,7 @@ namespace Umbraco.Core.Services.Implement var impact = CultureImpact.Explicit(culture, IsDefaultCulture(allLangs.Value, culture)); var tryPublish = d.PublishCulture(impact) && _propertyValidationService.Value.IsPropertyDataValid(d, out invalidProperties, impact); if (invalidProperties != null && invalidProperties.Length > 0) - Logger.Warn("Scheduled publishing will fail for document {DocumentId} and culture {Culture} because of invalid properties {InvalidProperties}", + Logger.Warn("Scheduled publishing will fail for document {DocumentId} and culture {Culture} because of invalid properties {InvalidProperties}", d.Id, culture, string.Join(",", invalidProperties.Select(x => x.Alias))); publishing &= tryPublish; //set the culture to be published @@ -1496,7 +1496,7 @@ namespace Umbraco.Core.Services.Implement result = CommitDocumentChangesInternal(scope, d, saveEventArgs, allLangs.Value, d.WriterId); if (result.Success == false) - Logger.Error(null, "Failed to publish document id={DocumentId}, reason={Reason}.", d.Id, result.Result); + Logger.Error(null, "Failed to publish document id={DocumentId}, reason={Reason}.", d.Id, result.Result); results.Add(result); } @@ -1510,7 +1510,7 @@ namespace Umbraco.Core.Services.Implement : SaveAndPublish(d, userId: d.WriterId); if (result.Success == false) - Logger.Error(null, "Failed to publish document id={DocumentId}, reason={Reason}.", d.Id, result.Result); + Logger.Error(null, "Failed to publish document id={DocumentId}, reason={Reason}.", d.Id, result.Result); results.Add(result); } @@ -2640,7 +2640,7 @@ namespace Umbraco.Core.Services.Implement // raise Publishing event if (scope.Events.DispatchCancelable(Publishing, this, savingEventArgs.ToContentPublishingEventArgs())) { - Logger.Info("Document {ContentName} (id={ContentId}) cannot be published: {Reason}", content.Name, content.Id, "publishing was cancelled"); + Logger.Info("Document {ContentName} (id={ContentId}) cannot be published: {Reason}", content.Name, content.Id, "publishing was cancelled"); return new PublishResult(PublishResultType.FailedPublishCancelledByEvent, evtMsgs, content); } @@ -2692,7 +2692,7 @@ namespace Umbraco.Core.Services.Implement // either because it is 'publishing' or because it already has a published version if (content.PublishedState != PublishedState.Publishing && content.PublishedVersionId == 0) { - Logger.Info("Document {ContentName} (id={ContentId}) cannot be published: {Reason}", content.Name, content.Id, "document does not have published values"); + Logger.Info("Document {ContentName} (id={ContentId}) cannot be published: {Reason}", content.Name, content.Id, "document does not have published values"); return new PublishResult(PublishResultType.FailedPublishNothingToPublish, evtMsgs, content); } @@ -2705,20 +2705,20 @@ namespace Umbraco.Core.Services.Implement { case ContentStatus.Expired: if (!variesByCulture) - Logger.Info("Document {ContentName} (id={ContentId}) cannot be published: {Reason}", content.Name, content.Id, "document has expired"); + Logger.Info("Document {ContentName} (id={ContentId}) cannot be published: {Reason}", content.Name, content.Id, "document has expired"); else Logger.Info("Document {ContentName} (id={ContentId}) culture {Culture} cannot be published: {Reason}", content.Name, content.Id, culture, "document culture has expired"); return new PublishResult(!variesByCulture ? PublishResultType.FailedPublishHasExpired : PublishResultType.FailedPublishCultureHasExpired, evtMsgs, content); case ContentStatus.AwaitingRelease: if (!variesByCulture) - Logger.Info("Document {ContentName} (id={ContentId}) cannot be published: {Reason}", content.Name, content.Id, "document is awaiting release"); + Logger.Info("Document {ContentName} (id={ContentId}) cannot be published: {Reason}", content.Name, content.Id, "document is awaiting release"); else Logger.Info("Document {ContentName} (id={ContentId}) culture {Culture} cannot be published: {Reason}", content.Name, content.Id, culture, "document is culture awaiting release"); return new PublishResult(!variesByCulture ? PublishResultType.FailedPublishAwaitingRelease : PublishResultType.FailedPublishCultureAwaitingRelease, evtMsgs, content); case ContentStatus.Trashed: - Logger.Info("Document {ContentName} (id={ContentId}) cannot be published: {Reason}", content.Name, content.Id, "document is trashed"); + Logger.Info("Document {ContentName} (id={ContentId}) cannot be published: {Reason}", content.Name, content.Id, "document is trashed"); return new PublishResult(PublishResultType.FailedPublishIsTrashed, evtMsgs, content); } } @@ -2731,7 +2731,7 @@ namespace Umbraco.Core.Services.Implement var pathIsOk = content.ParentId == Constants.System.Root || IsPathPublished(GetParent(content)); if (!pathIsOk) { - Logger.Info("Document {ContentName} (id={ContentId}) cannot be published: {Reason}", content.Name, content.Id, "parent is not published"); + Logger.Info("Document {ContentName} (id={ContentId}) cannot be published: {Reason}", content.Name, content.Id, "parent is not published"); return new PublishResult(PublishResultType.FailedPublishPathNotPublished, evtMsgs, content); } } @@ -2768,11 +2768,11 @@ namespace Umbraco.Core.Services.Implement return new PublishResult(PublishResultType.FailedPublishNothingToPublish, evtMsgs, content); if (culturesUnpublishing.Count > 0) - Logger.Info("Document {ContentName} (id={ContentId}) cultures: {Cultures} have been unpublished.", + Logger.Info("Document {ContentName} (id={ContentId}) cultures: {Cultures} have been unpublished.", content.Name, content.Id, string.Join(",", culturesUnpublishing)); if (culturesPublishing.Count > 0) - Logger.Info("Document {ContentName} (id={ContentId}) cultures: {Cultures} have been published.", + Logger.Info("Document {ContentName} (id={ContentId}) cultures: {Cultures} have been published.", content.Name, content.Id, string.Join(",", culturesPublishing)); if (culturesUnpublishing.Count > 0 && culturesPublishing.Count > 0) @@ -2784,7 +2784,7 @@ namespace Umbraco.Core.Services.Implement return new PublishResult(PublishResultType.SuccessPublishCulture, evtMsgs, content); } - Logger.Info("Document {ContentName} (id={ContentId}) has been published.", content.Name, content.Id); + Logger.Info("Document {ContentName} (id={ContentId}) has been published.", content.Name, content.Id); return new PublishResult(evtMsgs, content); } @@ -2800,7 +2800,7 @@ namespace Umbraco.Core.Services.Implement // raise Unpublishing event if (scope.Events.DispatchCancelable(Unpublishing, this, new PublishEventArgs(content, evtMsgs))) { - Logger.Info("Document {ContentName} (id={ContentId}) cannot be unpublished: unpublishing was cancelled.", content.Name, content.Id); + Logger.Info("Document {ContentName} (id={ContentId}) cannot be unpublished: unpublishing was cancelled.", content.Name, content.Id); return new PublishResult(PublishResultType.FailedUnpublishCancelledByEvent, evtMsgs, content); } @@ -2832,12 +2832,12 @@ namespace Umbraco.Core.Services.Implement foreach (var p in pastReleases) content.ContentSchedule.Remove(p); if (pastReleases.Count > 0) - Logger.Info("Document {ContentName} (id={ContentId}) had its release date removed, because it was unpublished.", content.Name, content.Id); + Logger.Info("Document {ContentName} (id={ContentId}) had its release date removed, because it was unpublished.", content.Name, content.Id); // change state to unpublishing content.PublishedState = PublishedState.Unpublishing; - Logger.Info("Document {ContentName} (id={ContentId}) has been unpublished.", content.Name, content.Id); + Logger.Info("Document {ContentName} (id={ContentId}) has been unpublished.", content.Name, content.Id); return attempt; } @@ -3169,7 +3169,7 @@ namespace Umbraco.Core.Services.Implement if (rollbackSaveResult.Success == false) { //Log the error/warning - Logger.Error("User '{UserId}' was unable to rollback content '{ContentId}' to version '{VersionId}'", userId, id, versionId); + Logger.Error("User '{UserId}' was unable to rollback content '{ContentId}' to version '{VersionId}'", userId, id, versionId); } else { @@ -3178,7 +3178,7 @@ namespace Umbraco.Core.Services.Implement scope.Events.Dispatch(RolledBack, this, rollbackEventArgs); //Logging & Audit message - Logger.Info("User '{UserId}' rolled back content '{ContentId}' to version '{VersionId}'", userId, id, versionId); + Logger.Info("User '{UserId}' rolled back content '{ContentId}' to version '{VersionId}'", userId, id, versionId); Audit(AuditType.RollBack, userId, id, $"Content '{content.Name}' was rolled back to version '{versionId}'"); } diff --git a/src/Umbraco.Core/Services/Implement/LocalizedTextService.cs b/src/Umbraco.Core/Services/Implement/LocalizedTextService.cs index 4f5121def7..8f58de53bd 100644 --- a/src/Umbraco.Core/Services/Implement/LocalizedTextService.cs +++ b/src/Umbraco.Core/Services/Implement/LocalizedTextService.cs @@ -104,7 +104,7 @@ namespace Umbraco.Core.Services.Implement { if (xmlSource.ContainsKey(culture) == false) { - _logger.Warn("The culture specified {Culture} was not found in any configured sources for this service", culture); + _logger.Warn("The culture specified {Culture} was not found in any configured sources for this service", culture); return result; } @@ -124,7 +124,7 @@ namespace Umbraco.Core.Services.Implement { if (_dictionarySource.ContainsKey(culture) == false) { - _logger.Warn("The culture specified {Culture} was not found in any configured sources for this service", culture); + _logger.Warn("The culture specified {Culture} was not found in any configured sources for this service", culture); return result; } @@ -207,7 +207,7 @@ namespace Umbraco.Core.Services.Implement { if (_dictionarySource.ContainsKey(culture) == false) { - _logger.Warn("The culture specified {Culture} was not found in any configured sources for this service", culture); + _logger.Warn("The culture specified {Culture} was not found in any configured sources for this service", culture); return "[" + key + "]"; } @@ -245,7 +245,7 @@ namespace Umbraco.Core.Services.Implement { if (xmlSource.ContainsKey(culture) == false) { - _logger.Warn("The culture specified {Culture} was not found in any configured sources for this service", culture); + _logger.Warn("The culture specified {Culture} was not found in any configured sources for this service", culture); return "[" + key + "]"; } diff --git a/src/Umbraco.Core/Services/Implement/LocalizedTextServiceFileSources.cs b/src/Umbraco.Core/Services/Implement/LocalizedTextServiceFileSources.cs index 86913071fd..e25fbed509 100644 --- a/src/Umbraco.Core/Services/Implement/LocalizedTextServiceFileSources.cs +++ b/src/Umbraco.Core/Services/Implement/LocalizedTextServiceFileSources.cs @@ -88,7 +88,7 @@ namespace Umbraco.Core.Services.Implement } catch (CultureNotFoundException) { - Current.Logger.Warn("The culture {CultureValue} found in the file {CultureFile} is not a valid culture", cultureVal, fileInfo.FullName); + Current.Logger.Warn("The culture {CultureValue} found in the file {CultureFile} is not a valid culture", cultureVal, fileInfo.FullName); //If the culture in the file is invalid, we'll just hope the file name is a valid culture below, otherwise // an exception will be thrown. } @@ -125,7 +125,7 @@ namespace Umbraco.Core.Services.Implement if (fileSourceFolder.Exists == false) { - Current.Logger.Warn("The folder does not exist: {FileSourceFolder}, therefore no sources will be discovered", fileSourceFolder.FullName); + Current.Logger.Warn("The folder does not exist: {FileSourceFolder}, therefore no sources will be discovered", fileSourceFolder.FullName); } else { @@ -203,7 +203,7 @@ namespace Umbraco.Core.Services.Implement } catch (Exception ex) { - _logger.Error(ex, "Could not load file into XML {File}", supplementaryFile.File.FullName); + _logger.Error(ex, "Could not load file into XML {File}", supplementaryFile.File.FullName); continue; } diff --git a/src/Umbraco.Core/Services/Implement/NotificationService.cs b/src/Umbraco.Core/Services/Implement/NotificationService.cs index 3c5f91e932..b6e42520f0 100644 --- a/src/Umbraco.Core/Services/Implement/NotificationService.cs +++ b/src/Umbraco.Core/Services/Implement/NotificationService.cs @@ -517,7 +517,7 @@ namespace Umbraco.Core.Services.Implement try { if (Sendmail != null) Sendmail(s, request.Mail, _logger); else s.Send(request.Mail); - _logger.Debug("Notification '{Action}' sent to {Username} ({Email})", request.Action, request.UserName, request.Email); + _logger.Debug("Notification '{Action}' sent to {Username} ({Email})", request.Action, request.UserName, request.Email); } catch (Exception ex) { diff --git a/src/Umbraco.Core/Sync/DatabaseServerMessenger.cs b/src/Umbraco.Core/Sync/DatabaseServerMessenger.cs index 7442169b44..49b0d23862 100644 --- a/src/Umbraco.Core/Sync/DatabaseServerMessenger.cs +++ b/src/Umbraco.Core/Sync/DatabaseServerMessenger.cs @@ -192,7 +192,7 @@ namespace Umbraco.Core.Sync if (count > Options.MaxProcessingInstructionCount) { //too many instructions, proceed to cold boot - Logger.Warn( + Logger.Warn( "The instruction count ({InstructionCount}) exceeds the specified MaxProcessingInstructionCount ({MaxProcessingInstructionCount})." + " The server will skip existing instructions, rebuild its caches and indexes entirely, adjust its last synced Id" + " to the latest found in the database and maintain cache updates based on that Id.", @@ -352,7 +352,7 @@ namespace Umbraco.Core.Sync } catch (JsonException ex) { - Logger.Error(ex, "Failed to deserialize instructions ({DtoId}: '{DtoInstructions}').", + Logger.Error(ex, "Failed to deserialize instructions ({DtoId}: '{DtoInstructions}').", dto.Id, dto.Instructions); @@ -410,7 +410,7 @@ namespace Umbraco.Core.Sync //} catch (Exception ex) { - Logger.Error( + Logger.Error ( ex, "DISTRIBUTED CACHE IS NOT UPDATED. Failed to execute instructions ({DtoId}: '{DtoInstructions}'). Instruction is being skipped/ignored", dto.Id, diff --git a/src/Umbraco.Core/Sync/ServerMessengerBase.cs b/src/Umbraco.Core/Sync/ServerMessengerBase.cs index bbf00c3a6b..1b13b49434 100644 --- a/src/Umbraco.Core/Sync/ServerMessengerBase.cs +++ b/src/Umbraco.Core/Sync/ServerMessengerBase.cs @@ -157,7 +157,7 @@ namespace Umbraco.Core.Sync { if (refresher == null) throw new ArgumentNullException(nameof(refresher)); - Current.Logger.Debug("Invoking refresher {RefresherType} on local server for message type RefreshByPayload", refresher.GetType()); + Current.Logger.Debug("Invoking refresher {RefresherType} on local server for message type RefreshByPayload", refresher.GetType()); var payloadRefresher = refresher as IPayloadCacheRefresher; if (payloadRefresher == null) @@ -179,7 +179,7 @@ namespace Umbraco.Core.Sync { if (refresher == null) throw new ArgumentNullException(nameof(refresher)); - Current.Logger.Debug("Invoking refresher {RefresherType} on local server for message type {MessageType}", refresher.GetType(), messageType); + Current.Logger.Debug("Invoking refresher {RefresherType} on local server for message type {MessageType}", refresher.GetType(), messageType); switch (messageType) { @@ -240,7 +240,7 @@ namespace Umbraco.Core.Sync { if (refresher == null) throw new ArgumentNullException(nameof(refresher)); - Current.Logger.Debug("Invoking refresher {RefresherType} on local server for message type {MessageType}", refresher.GetType(), messageType); + Current.Logger.Debug("Invoking refresher {RefresherType} on local server for message type {MessageType}", refresher.GetType(), messageType); var typedRefresher = refresher as ICacheRefresher; diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 569fdb4638..1cbf8a7b3f 100755 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -131,6 +131,8 @@ + + diff --git a/src/Umbraco.Core/UriExtensions.cs b/src/Umbraco.Core/UriExtensions.cs index 60d9cd6ead..96e24e89db 100644 --- a/src/Umbraco.Core/UriExtensions.cs +++ b/src/Umbraco.Core/UriExtensions.cs @@ -4,6 +4,7 @@ using System.Linq; using Umbraco.Core.Composing; using Umbraco.Core.Configuration; using Umbraco.Core.IO; +using Umbraco.Core.Logging; namespace Umbraco.Core { @@ -154,7 +155,7 @@ namespace Umbraco.Core } catch (ArgumentException) { - Current.Logger.Debug(typeof(UriExtensions), "Failed to determine if request was client side (invalid chars in path \"{Path}\"?)", url.LocalPath); + Current.Logger.Debug(typeof(UriExtensions), "Failed to determine if request was client side (invalid chars in path \"{Path}\"?)", url.LocalPath); return false; } } diff --git a/src/Umbraco.Examine/IndexRebuilder.cs b/src/Umbraco.Examine/IndexRebuilder.cs index b14ff25c57..1f953c8cbd 100644 --- a/src/Umbraco.Examine/IndexRebuilder.cs +++ b/src/Umbraco.Examine/IndexRebuilder.cs @@ -69,7 +69,7 @@ namespace Umbraco.Examine } catch (Exception e) { - _logger.Error(e, "Index populating failed for populator {Populator}", populator.GetType()); + _logger.Error(e, "Index populating failed for populator {Populator}", populator.GetType()); } } } diff --git a/src/Umbraco.Examine/UmbracoContentIndex.cs b/src/Umbraco.Examine/UmbracoContentIndex.cs index 88033b1407..2da35201b2 100644 --- a/src/Umbraco.Examine/UmbracoContentIndex.cs +++ b/src/Umbraco.Examine/UmbracoContentIndex.cs @@ -133,7 +133,7 @@ namespace Umbraco.Examine var filtered = c.NativeQuery(rawQuery); var results = filtered.Execute(); - ProfilingLogger.Debug(GetType(), "DeleteFromIndex with query: {Query} (found {TotalItems} results)", rawQuery, results.TotalItemCount); + ProfilingLogger.Debug(GetType(), "DeleteFromIndex with query: {Query} (found {TotalItems} results)", rawQuery, results.TotalItemCount); //need to queue a delete item for each one found QueueIndexOperation(results.Select(r => new IndexOperation(new ValueSet(r.Id), IndexOperationType.Delete))); diff --git a/src/Umbraco.Examine/UmbracoExamineIndex.cs b/src/Umbraco.Examine/UmbracoExamineIndex.cs index e1dd77b994..cc97178e5c 100644 --- a/src/Umbraco.Examine/UmbracoExamineIndex.cs +++ b/src/Umbraco.Examine/UmbracoExamineIndex.cs @@ -159,7 +159,7 @@ namespace Umbraco.Examine ///
protected override void AddDocument(Document doc, ValueSet valueSet, IndexWriter writer) { - ProfilingLogger.Debug(GetType(), + ProfilingLogger.Debug(GetType(), "Write lucene doc id:{DocumentId}, category:{DocumentCategory}, type:{DocumentItemType}", valueSet.Id, valueSet.Category, diff --git a/src/Umbraco.Tests.Benchmarks/LoggerAllocationBenchmark.cs b/src/Umbraco.Tests.Benchmarks/LoggerAllocationBenchmark.cs new file mode 100644 index 0000000000..818eeec7f1 --- /dev/null +++ b/src/Umbraco.Tests.Benchmarks/LoggerAllocationBenchmark.cs @@ -0,0 +1,58 @@ +using BenchmarkDotNet.Attributes; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Umbraco.Core.Logging; +using Umbraco.Tests.Benchmarks.Config; + +namespace Umbraco.Tests.Benchmarks +{ + [QuickRunWithMemoryDiagnoserConfig] + public class LoggerAllocationBenchmark + { + private string rawQuery = ""; + private int totalItemCount; + [Benchmark(Baseline = true)] + public void Baseline() + { + for (int i = 0; i < 1000; i++) + { + OriginalDebugSignature(GetType(), "DeleteFromIndex with query: {Query} (found {TotalItems} results)", rawQuery, totalItemCount); + } + + } + + [Benchmark()] + public void NewOverload2() + { + for (int i = 0; i < 1000; i++) + { + NewDebugSignature(GetType(), "DeleteFromIndex with query: {Query} (found {TotalItems} results)", rawQuery, totalItemCount); + } + } + public void OriginalDebugSignature(Type reporting, string messageTemplate, params object[] propertyValues) + { + + } + + public void NewDebugSignature(Type reporting, string messageTemplate, T1 param1, T2 param2) + { + + } + + // BenchmarkDotNet=v0.11.3, OS=Windows 10.0.18362 + //Intel Core i5-8265U CPU 1.60GHz(Kaby Lake R), 1 CPU, 8 logical and 4 physical cores + // [Host] : .NET Framework 4.7.2 (CLR 4.0.30319.42000), 32bit LegacyJIT-v4.8.4180.0 + // Job-JIATTD : .NET Framework 4.7.2 (CLR 4.0.30319.42000), 32bit LegacyJIT-v4.8.4180.0 + + //IterationCount=3 IterationTime=100.0000 ms LaunchCount = 1 + //WarmupCount=3 + + // Method | Mean | Error | StdDev | Ratio | Gen 0/1k Op | Gen 1/1k Op | Gen 2/1k Op | Allocated Memory/Op | + //------------- |----------:|----------:|----------:|------:|------------:|------------:|------------:|--------------------:| + // Baseline | 14.599 us | 1.0882 us | 0.0596 us | 1.00 | 10.0420 | - | - | 32048 B | + // NewOverload2 | 1.775 us | 0.4056 us | 0.0222 us | 0.12 | - | - | - | - | + } +} diff --git a/src/Umbraco.Tests.Benchmarks/Umbraco.Tests.Benchmarks.csproj b/src/Umbraco.Tests.Benchmarks/Umbraco.Tests.Benchmarks.csproj index 58b45aa743..e349354dd8 100644 --- a/src/Umbraco.Tests.Benchmarks/Umbraco.Tests.Benchmarks.csproj +++ b/src/Umbraco.Tests.Benchmarks/Umbraco.Tests.Benchmarks.csproj @@ -55,6 +55,7 @@ + diff --git a/src/Umbraco.Tests/LegacyXmlPublishedCache/DictionaryPublishedContent.cs b/src/Umbraco.Tests/LegacyXmlPublishedCache/DictionaryPublishedContent.cs index db8dc38d6d..d13bda9703 100644 --- a/src/Umbraco.Tests/LegacyXmlPublishedCache/DictionaryPublishedContent.cs +++ b/src/Umbraco.Tests/LegacyXmlPublishedCache/DictionaryPublishedContent.cs @@ -109,7 +109,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache else { // this is a property that does not correspond to anything, ignore and log - Current.Logger.Warn("Dropping property '{PropertyKey}' because it does not belong to the content type.", i.Key); + Current.Logger.Warn("Dropping property '{PropertyKey}' because it does not belong to the content type.", i.Key); } } } diff --git a/src/Umbraco.Tests/LegacyXmlPublishedCache/PreviewContent.cs b/src/Umbraco.Tests/LegacyXmlPublishedCache/PreviewContent.cs index 84b6f2b91c..4bedfc9416 100644 --- a/src/Umbraco.Tests/LegacyXmlPublishedCache/PreviewContent.cs +++ b/src/Umbraco.Tests/LegacyXmlPublishedCache/PreviewContent.cs @@ -40,7 +40,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache } catch (Exception ex) { - Current.Logger.Error(ex, "Could not load preview set {PreviewSet} for user {UserId}.", _previewSet, _userId); + Current.Logger.Error(ex, "Could not load preview set {PreviewSet} for user {UserId}.", _previewSet, _userId); ClearPreviewSet(); @@ -146,7 +146,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache } catch (Exception ex) { - Current.Logger.Error(ex, "Couldn't delete preview set {FileName} for user {UserId}", file.Name, userId); + Current.Logger.Error(ex, "Couldn't delete preview set {FileName} for user {UserId}", file.Name, userId); } } diff --git a/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedMediaCache.cs b/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedMediaCache.cs index 56033e6b0a..2b4ae40550 100644 --- a/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedMediaCache.cs +++ b/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedMediaCache.cs @@ -338,7 +338,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache var miss = Interlocked.CompareExchange(ref _examineIndexMiss, 0, 0); // volatile read if (miss < ExamineIndexMissMax && Interlocked.Increment(ref _examineIndexMiss) == ExamineIndexMissMax) - Current.Logger.Warn("Failed ({ExamineIndexMissMax} times) to retrieve medias from Examine index and had to load" + Current.Logger.Warn("Failed ({ExamineIndexMissMax} times) to retrieve medias from Examine index and had to load" + " them from DB. This may indicate that the Examine index is corrupted.", ExamineIndexMissMax); return ConvertFromIMedia(media); @@ -356,7 +356,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache : ConvertFromXPathNavigator(media.Current); } - Current.Logger.Warn("Could not retrieve media {MediaId} from Examine index or from legacy library.GetMedia method", id); + Current.Logger.Warn("Could not retrieve media {MediaId} from Examine index or from legacy library.GetMedia method", id); return null; } diff --git a/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlStore.cs b/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlStore.cs index 803b86aec5..a7e1f8598e 100644 --- a/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlStore.cs +++ b/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlStore.cs @@ -702,7 +702,7 @@ AND (umbracoNode.id=@id)"; // if something goes wrong remove the file DeleteXmlFile(); - Current.Logger.Error(ex, "Failed to save Xml to file '{FileName}'.", _xmlFileName); + Current.Logger.Error(ex, "Failed to save Xml to file '{FileName}'.", _xmlFileName); } } @@ -742,7 +742,7 @@ AND (umbracoNode.id=@id)"; // if something goes wrong remove the file DeleteXmlFile(); - Current.Logger.Error(ex, "Failed to save Xml to file '{FileName}'.", _xmlFileName); + Current.Logger.Error(ex, "Failed to save Xml to file '{FileName}'.", _xmlFileName); } } @@ -799,7 +799,7 @@ AND (umbracoNode.id=@id)"; } catch (Exception ex) { - Current.Logger.Error(ex, "Failed to load Xml from file '{FileName}'.", _xmlFileName); + Current.Logger.Error(ex, "Failed to load Xml from file '{FileName}'.", _xmlFileName); try { DeleteXmlFile(); @@ -1039,7 +1039,7 @@ ORDER BY umbracoNode.level, umbracoNode.sortOrder"; { foreach (var payload in payloads) { - Current.Logger.Debug("Notified {ChangeTypes} for content {ContentId}", payload.ChangeTypes, payload.Id); + Current.Logger.Debug("Notified {ChangeTypes} for content {ContentId}", payload.ChangeTypes, payload.Id); if (payload.ChangeTypes.HasType(TreeChangeTypes.RefreshAll)) { @@ -1072,7 +1072,7 @@ ORDER BY umbracoNode.level, umbracoNode.sortOrder"; if (content == null || content.Published == false || content.Trashed) { // no published version - Current.Logger.Debug("Notified, content {ContentId} has no published version.", payload.Id); + Current.Logger.Debug("Notified, content {ContentId} has no published version.", payload.Id); if (current != null) { @@ -1111,7 +1111,7 @@ ORDER BY umbracoNode.level, umbracoNode.sortOrder"; if (dtos.MoveNext() == false) { // gone fishing, remove (possible race condition) - Current.Logger.Debug("Notified, content {ContentId} gone fishing.", payload.Id); + Current.Logger.Debug("Notified, content {ContentId} gone fishing.", payload.Id); if (current != null) { @@ -1225,7 +1225,7 @@ ORDER BY umbracoNode.level, umbracoNode.sortOrder"; .ToArray(); foreach (var payload in payloads) - Current.Logger.Debug("Notified {ChangeTypes} for content type {ContentTypeId}", payload.ChangeTypes, payload.Id); + Current.Logger.Debug("Notified {ChangeTypes} for content type {ContentTypeId}", payload.ChangeTypes, payload.Id); if (ids.Length > 0) // must have refreshes, not only removes RefreshContentTypes(ids); @@ -1244,7 +1244,7 @@ ORDER BY umbracoNode.level, umbracoNode.sortOrder"; _contentTypeCache.ClearDataType(payload.Id); foreach (var payload in payloads) - Current.Logger.Debug("Notified {RemovedStatus} for data type {payload.Id}", + Current.Logger.Debug("Notified {RemovedStatus} for data type {payload.Id}", payload.Removed ? "Removed" : "Refreshed", payload.Id); diff --git a/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlStoreFilePersister.cs b/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlStoreFilePersister.cs index 56c09b18ac..09dc0e17ef 100644 --- a/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlStoreFilePersister.cs +++ b/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlStoreFilePersister.cs @@ -61,7 +61,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache if (touched == false) return; - _logger.Debug("Created, save in {WaitMilliseconds}ms.", WaitMilliseconds); + _logger.Debug("Created, save in {WaitMilliseconds}ms.", WaitMilliseconds); _initialTouch = DateTime.Now; _timer = new Timer(_ => TimerRelease()); _timer.Change(WaitMilliseconds, 0); @@ -106,7 +106,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache else if (_timer == null) // we don't have a timer yet { - _logger.Debug("Touched, was idle, start and save in {WaitMilliseconds}ms.", WaitMilliseconds); + _logger.Debug("Touched, was idle, start and save in {WaitMilliseconds}ms.", WaitMilliseconds); _initialTouch = DateTime.Now; _timer = new Timer(_ => TimerRelease()); _timer.Change(WaitMilliseconds, 0); @@ -119,7 +119,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache if (DateTime.Now - _initialTouch < TimeSpan.FromMilliseconds(MaxWaitMilliseconds)) { - _logger.Debug("Touched, was waiting, can delay, save in {WaitMilliseconds}ms.", WaitMilliseconds); + _logger.Debug("Touched, was waiting, can delay, save in {WaitMilliseconds}ms.", WaitMilliseconds); _timer.Change(WaitMilliseconds, 0); } else diff --git a/src/Umbraco.Tests/Services/ContentServicePerformanceTest.cs b/src/Umbraco.Tests/Services/ContentServicePerformanceTest.cs index 9f4304ebee..a3955f11aa 100644 --- a/src/Umbraco.Tests/Services/ContentServicePerformanceTest.cs +++ b/src/Umbraco.Tests/Services/ContentServicePerformanceTest.cs @@ -128,7 +128,7 @@ namespace Umbraco.Tests.Services total.AddRange(ServiceContext.ContentService.GetPagedDescendants(content.Id, 0, int.MaxValue, out var _)); } TestProfiler.Disable(); - Current.Logger.Info("Returned {Total} items", total.Count); + Current.Logger.Info("Returned {Total} items", total.Count); } } diff --git a/src/Umbraco.Tests/TestHelpers/ConsoleLogger.cs b/src/Umbraco.Tests/TestHelpers/ConsoleLogger.cs index a3e36db363..f571f876b7 100644 --- a/src/Umbraco.Tests/TestHelpers/ConsoleLogger.cs +++ b/src/Umbraco.Tests/TestHelpers/ConsoleLogger.cs @@ -115,5 +115,62 @@ namespace Umbraco.Tests.TestHelpers { Console.WriteLine("VERBOSE {0} - {1}", reporting.Name, MessageTemplates.Render(messageTemplate, propertyValues)); } + + public void Fatal(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) + => Fatal(reporting, exception, messageTemplate, new object[] { propertyValue0, propertyValue1, propertyValue2 }); + + public void Fatal(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + => Fatal(reporting, exception, messageTemplate, new object[] { propertyValue0, propertyValue1 }); + + public void Fatal(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0) + => Fatal(reporting, exception, messageTemplate, new object[] { propertyValue0 }); + + public void Error(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) + => Error(reporting, exception, messageTemplate, new object[] { propertyValue0, propertyValue1, propertyValue2 }); + + public void Error(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + => Error(reporting, exception, messageTemplate, new object[] { propertyValue0, propertyValue1 }); + + public void Error(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0) + => Error(reporting, exception, messageTemplate, new object[] { propertyValue0 }); + + public void Warn(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) + => Warn(reporting, exception, messageTemplate, new object[] { propertyValue0, propertyValue1, propertyValue2 }); + + public void Warn(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + => Warn(reporting, exception, messageTemplate, new object[] { propertyValue0, propertyValue1 }); + + public void Warn(Type reporting, Exception exception, string messageTemplate, T0 propertyValue0) + => Warn(reporting, exception, messageTemplate, new object[] { propertyValue0 }); + + public void Warn(Type reporting, string message, T0 propertyValue0) + => Warn(reporting, message, new object[] { propertyValue0 }); + + public void Info(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) + => Info(reporting, messageTemplate, new object[] { propertyValue0, propertyValue1, propertyValue2 }); + + public void Info(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + => Info(reporting, messageTemplate, new object[] { propertyValue0, propertyValue1 }); + + public void Info(Type reporting, string messageTemplate, T0 propertyValue0) + => Info(reporting, messageTemplate, new object[] { propertyValue0 }); + + public void Debug(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) + => Debug(reporting, messageTemplate, new object[] { propertyValue0, propertyValue1, propertyValue2 }); + + public void Debug(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + => Debug(reporting, messageTemplate, new object[] { propertyValue0, propertyValue1 }); + + public void Debug(Type reporting, string messageTemplate, T0 propertyValue0) + => Debug(reporting, messageTemplate, new object[] { propertyValue0 }); + + public void Verbose(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1, T2 propertyValue2) + => Verbose(reporting, messageTemplate, new object[] { propertyValue0, propertyValue1, propertyValue2 }); + + public void Verbose(Type reporting, string messageTemplate, T0 propertyValue0, T1 propertyValue1) + => Verbose(reporting, messageTemplate, new object[] { propertyValue0, propertyValue1 }); + + public void Verbose(Type reporting, string messageTemplate, T0 propertyValue0) + => Verbose(reporting, messageTemplate, new object[] { propertyValue0 }); } } diff --git a/src/Umbraco.Web/Cache/DistributedCacheBinder.cs b/src/Umbraco.Web/Cache/DistributedCacheBinder.cs index 5f8d77f3b2..3ee24a23bf 100644 --- a/src/Umbraco.Web/Cache/DistributedCacheBinder.cs +++ b/src/Umbraco.Web/Cache/DistributedCacheBinder.cs @@ -72,7 +72,7 @@ namespace Umbraco.Web.Cache { // TODO: should this be fatal (ie, an exception)? var name = e.Sender.GetType().Name + "_" + e.EventName; - _logger.Warn("Dropping event {EventName} because no corresponding handler was found.", name); + _logger.Warn("Dropping event {EventName} because no corresponding handler was found.", name); continue; } diff --git a/src/Umbraco.Web/ContentApps/ContentAppFactoryCollection.cs b/src/Umbraco.Web/ContentApps/ContentAppFactoryCollection.cs index 07987aea3e..da587f672a 100644 --- a/src/Umbraco.Web/ContentApps/ContentAppFactoryCollection.cs +++ b/src/Umbraco.Web/ContentApps/ContentAppFactoryCollection.cs @@ -50,7 +50,7 @@ namespace Umbraco.Web.ContentApps // dying is not user-friendly, so let's write to log instead, and wish people read logs... //throw new InvalidOperationException($"Duplicate content app aliases found: {string.Join(",", dups)}"); - _logger.Warn("Duplicate content app aliases found: {DuplicateAliases}", string.Join(",", dups)); + _logger.Warn("Duplicate content app aliases found: {DuplicateAliases}", string.Join(",", dups)); } return apps; diff --git a/src/Umbraco.Web/Editors/AuthenticationController.cs b/src/Umbraco.Web/Editors/AuthenticationController.cs index e2ab829427..c354dd25ef 100644 --- a/src/Umbraco.Web/Editors/AuthenticationController.cs +++ b/src/Umbraco.Web/Editors/AuthenticationController.cs @@ -433,19 +433,19 @@ namespace Umbraco.Web.Editors var lockedOut = await UserManager.IsLockedOutAsync(model.UserId); if (lockedOut) { - Logger.Info("User {UserId} is currently locked out, unlocking and resetting AccessFailedCount", model.UserId); + Logger.Info("User {UserId} is currently locked out, unlocking and resetting AccessFailedCount", model.UserId); //// var user = await UserManager.FindByIdAsync(model.UserId); var unlockResult = await UserManager.SetLockoutEndDateAsync(model.UserId, DateTimeOffset.Now); if (unlockResult.Succeeded == false) { - Logger.Warn("Could not unlock for user {UserId} - error {UnlockError}", model.UserId, unlockResult.Errors.First()); + Logger.Warn("Could not unlock for user {UserId} - error {UnlockError}", model.UserId, unlockResult.Errors.First()); } var resetAccessFailedCountResult = await UserManager.ResetAccessFailedCountAsync(model.UserId); if (resetAccessFailedCountResult.Succeeded == false) { - Logger.Warn("Could not reset access failed count {UserId} - error {UnlockError}", model.UserId, unlockResult.Errors.First()); + Logger.Warn("Could not reset access failed count {UserId} - error {UnlockError}", model.UserId, unlockResult.Errors.First()); } } @@ -499,7 +499,7 @@ namespace Umbraco.Web.Editors Core.Constants.Security.BackOfficeAuthenticationType, Core.Constants.Security.BackOfficeExternalAuthenticationType); - Logger.Info("User {UserName} from IP address {RemoteIpAddress} has logged out", User.Identity == null ? "UNKNOWN" : User.Identity.Name, owinContext.Request.RemoteIpAddress); + Logger.Info("User {UserName} from IP address {RemoteIpAddress} has logged out", User.Identity == null ? "UNKNOWN" : User.Identity.Name, owinContext.Request.RemoteIpAddress); if (UserManager != null) { diff --git a/src/Umbraco.Web/Editors/BackOfficeController.cs b/src/Umbraco.Web/Editors/BackOfficeController.cs index ff618ba0a6..bf3c9d083b 100644 --- a/src/Umbraco.Web/Editors/BackOfficeController.cs +++ b/src/Umbraco.Web/Editors/BackOfficeController.cs @@ -129,7 +129,7 @@ namespace Umbraco.Web.Editors if (parts.Length != 2) { - Logger.Warn("VerifyUser endpoint reached with invalid token: {Invite}", invite); + Logger.Warn("VerifyUser endpoint reached with invalid token: {Invite}", invite); return RedirectToAction("Default"); } @@ -138,7 +138,7 @@ namespace Umbraco.Web.Editors var decoded = token.FromUrlBase64(); if (decoded.IsNullOrWhiteSpace()) { - Logger.Warn("VerifyUser endpoint reached with invalid token: {Invite}", invite); + Logger.Warn("VerifyUser endpoint reached with invalid token: {Invite}", invite); return RedirectToAction("Default"); } @@ -146,14 +146,14 @@ namespace Umbraco.Web.Editors int intId; if (int.TryParse(id, out intId) == false) { - Logger.Warn("VerifyUser endpoint reached with invalid token: {Invite}", invite); + Logger.Warn("VerifyUser endpoint reached with invalid token: {Invite}", invite); return RedirectToAction("Default"); } var identityUser = await UserManager.FindByIdAsync(intId); if (identityUser == null) { - Logger.Warn("VerifyUser endpoint reached with non existing user: {UserId}", id); + Logger.Warn("VerifyUser endpoint reached with non existing user: {UserId}", id); return RedirectToAction("Default"); } @@ -161,7 +161,7 @@ namespace Umbraco.Web.Editors if (result.Succeeded == false) { - Logger.Warn("Could not verify email, Error: {Errors}, Token: {Invite}", string.Join(",", result.Errors), invite); + Logger.Warn("Could not verify email, Error: {Errors}, Token: {Invite}", string.Join(",", result.Errors), invite); return new RedirectResult(Url.Action("Default") + "#/login/false?invite=3"); } @@ -434,7 +434,7 @@ namespace Umbraco.Web.Editors var authType = OwinContext.Authentication.GetExternalAuthenticationTypes().FirstOrDefault(x => x.AuthenticationType == loginInfo.Login.LoginProvider); if (authType == null) { - Logger.Warn("Could not find external authentication provider registered: {LoginProvider}", loginInfo.Login.LoginProvider); + Logger.Warn("Could not find external authentication provider registered: {LoginProvider}", loginInfo.Login.LoginProvider); } else { @@ -451,7 +451,7 @@ namespace Umbraco.Web.Editors shouldSignIn = autoLinkOptions.OnExternalLogin(user, loginInfo); if (shouldSignIn == false) { - Logger.Warn("The AutoLinkOptions of the external authentication provider '{LoginProvider}' have refused the login based on the OnExternalLogin method. Affected user id: '{UserId}'", loginInfo.Login.LoginProvider, user.Id); + Logger.Warn("The AutoLinkOptions of the external authentication provider '{LoginProvider}' have refused the login based on the OnExternalLogin method. Affected user id: '{UserId}'", loginInfo.Login.LoginProvider, user.Id); } } diff --git a/src/Umbraco.Web/Editors/ContentController.cs b/src/Umbraco.Web/Editors/ContentController.cs index 7093edf23d..edc5077558 100644 --- a/src/Umbraco.Web/Editors/ContentController.cs +++ b/src/Umbraco.Web/Editors/ContentController.cs @@ -1978,7 +1978,7 @@ namespace Umbraco.Web.Editors if (template == null) { //ModelState.AddModelError("Template", "No template exists with the specified alias: " + contentItem.TemplateAlias); - Logger.Warn("No template exists with the specified alias: {TemplateAlias}", contentSave.TemplateAlias); + Logger.Warn("No template exists with the specified alias: {TemplateAlias}", contentSave.TemplateAlias); } else if (template.Id != contentSave.PersistedContent.TemplateId) { diff --git a/src/Umbraco.Web/Editors/ContentControllerBase.cs b/src/Umbraco.Web/Editors/ContentControllerBase.cs index 893c9f5941..d94ab8058f 100644 --- a/src/Umbraco.Web/Editors/ContentControllerBase.cs +++ b/src/Umbraco.Web/Editors/ContentControllerBase.cs @@ -62,7 +62,7 @@ namespace Umbraco.Web.Editors // get the property editor if (propertyDto.PropertyEditor == null) { - Logger.Warn("No property editor found for property {PropertyAlias}", propertyDto.Alias); + Logger.Warn("No property editor found for property {PropertyAlias}", propertyDto.Alias); continue; } diff --git a/src/Umbraco.Web/Editors/ContentTypeController.cs b/src/Umbraco.Web/Editors/ContentTypeController.cs index 5074a14782..a72e27b903 100644 --- a/src/Umbraco.Web/Editors/ContentTypeController.cs +++ b/src/Umbraco.Web/Editors/ContentTypeController.cs @@ -359,7 +359,7 @@ namespace Umbraco.Web.Editors var tryCreateTemplate = Services.FileService.CreateTemplateForContentType(contentTypeAlias, contentTypeName); if (tryCreateTemplate == false) { - Logger.Warn("Could not create a template for Content Type: \"{ContentTypeAlias}\", status: {Status}", + Logger.Warn("Could not create a template for Content Type: \"{ContentTypeAlias}\", status: {Status}", contentTypeAlias, tryCreateTemplate.Result.Result); } @@ -544,7 +544,7 @@ namespace Umbraco.Web.Editors } catch (Exception ex) { - Logger.Error(ex, "Error cleaning up temporary udt file in App_Data: {File}", filePath); + Logger.Error(ex, "Error cleaning up temporary udt file in App_Data: {File}", filePath); } return Request.CreateResponse(HttpStatusCode.OK); @@ -591,7 +591,7 @@ namespace Umbraco.Web.Editors } catch (Exception ex) { - Logger.Error(ex, "Error uploading udt file to App_Data: {File}", destFileName); + Logger.Error(ex, "Error uploading udt file to App_Data: {File}", destFileName); } if (ext.InvariantEquals("udt")) diff --git a/src/Umbraco.Web/Editors/DashboardController.cs b/src/Umbraco.Web/Editors/DashboardController.cs index eef0b5df93..da620eb5ac 100644 --- a/src/Umbraco.Web/Editors/DashboardController.cs +++ b/src/Umbraco.Web/Editors/DashboardController.cs @@ -76,7 +76,7 @@ namespace Umbraco.Web.Editors } catch (HttpRequestException ex) { - Logger.Error(ex.InnerException ?? ex, "Error getting dashboard content from {Url}", url); + Logger.Error(ex.InnerException ?? ex, "Error getting dashboard content from {Url}", url); //it's still new JObject() - we return it like this to avoid error codes which triggers UI warnings AppCaches.RuntimeCache.InsertCacheItem(key, () => result, new TimeSpan(0, 5, 0)); @@ -114,7 +114,7 @@ namespace Umbraco.Web.Editors } catch (HttpRequestException ex) { - Logger.Error(ex.InnerException ?? ex, "Error getting dashboard CSS from {Url}", url); + Logger.Error(ex.InnerException ?? ex, "Error getting dashboard CSS from {Url}", url); //it's still string.Empty - we return it like this to avoid error codes which triggers UI warnings AppCaches.RuntimeCache.InsertCacheItem(key, () => result, new TimeSpan(0, 5, 0)); @@ -178,7 +178,7 @@ namespace Umbraco.Web.Editors } catch (HttpRequestException ex) { - Logger.Error(ex.InnerException ?? ex, "Error getting remote dashboard data from {UrlPrefix}{Url}", urlPrefix, url); + Logger.Error(ex.InnerException ?? ex, "Error getting remote dashboard data from {UrlPrefix}{Url}", urlPrefix, url); //it's still string.Empty - we return it like this to avoid error codes which triggers UI warnings AppCaches.RuntimeCache.InsertCacheItem(key, () => result, new TimeSpan(0, 5, 0)); diff --git a/src/Umbraco.Web/Editors/DictionaryController.cs b/src/Umbraco.Web/Editors/DictionaryController.cs index f3246276b1..fcc2e2af02 100644 --- a/src/Umbraco.Web/Editors/DictionaryController.cs +++ b/src/Umbraco.Web/Editors/DictionaryController.cs @@ -124,7 +124,7 @@ namespace Umbraco.Web.Editors } catch (Exception ex) { - Logger.Error(GetType(), ex, "Error creating dictionary with {Name} under {ParentId}", key, parentId); + Logger.Error(GetType(), ex, "Error creating dictionary with {Name} under {ParentId}", key, parentId); return Request.CreateNotificationValidationErrorResponse("Error creating dictionary item"); } } @@ -254,7 +254,7 @@ namespace Umbraco.Web.Editors } catch (Exception ex) { - Logger.Error(GetType(), ex, "Error saving dictionary with {Name} under {ParentId}", dictionary.Name, dictionary.ParentId); + Logger.Error(GetType(), ex, "Error saving dictionary with {Name} under {ParentId}", dictionary.Name, dictionary.ParentId); throw new HttpResponseException(Request.CreateNotificationValidationErrorResponse("Something went wrong saving dictionary")); } } diff --git a/src/Umbraco.Web/Editors/ExamineManagementController.cs b/src/Umbraco.Web/Editors/ExamineManagementController.cs index cf1dfd5d5d..49599bc8b9 100644 --- a/src/Umbraco.Web/Editors/ExamineManagementController.cs +++ b/src/Umbraco.Web/Editors/ExamineManagementController.cs @@ -131,7 +131,7 @@ namespace Umbraco.Web.Editors if (!validate.IsSuccessStatusCode) return validate; - _logger.Info("Rebuilding index '{IndexName}'", indexName); + _logger.Info("Rebuilding index '{IndexName}'", indexName); //remove it in case there's a handler there already index.IndexOperationComplete -= Indexer_IndexOperationComplete; @@ -253,7 +253,7 @@ namespace Umbraco.Web.Editors { var indexer = (IIndex)sender; - _logger.Debug("Logging operation completed for index {IndexName}", indexer.Name); + _logger.Debug("Logging operation completed for index {IndexName}", indexer.Name); //ensure it's not listening anymore indexer.IndexOperationComplete -= Indexer_IndexOperationComplete; diff --git a/src/Umbraco.Web/Editors/PasswordChanger.cs b/src/Umbraco.Web/Editors/PasswordChanger.cs index 2698a68b40..816325fe56 100644 --- a/src/Umbraco.Web/Editors/PasswordChanger.cs +++ b/src/Umbraco.Web/Editors/PasswordChanger.cs @@ -95,7 +95,7 @@ namespace Umbraco.Web.Editors if (resetResult.Succeeded == false) { var errors = string.Join(". ", resetResult.Errors); - _logger.Warn("Could not reset user password {PasswordErrors}", errors); + _logger.Warn("Could not reset user password {PasswordErrors}", errors); return Attempt.Fail(new PasswordChangedModel { ChangeError = new ValidationResult(errors, new[] { "resetPassword" }) }); } @@ -136,7 +136,7 @@ namespace Umbraco.Web.Editors { //no, fail with error messages for "password" var errors = string.Join(". ", changeResult.Errors); - _logger.Warn("Could not change user password {PasswordErrors}", errors); + _logger.Warn("Could not change user password {PasswordErrors}", errors); return Attempt.Fail(new PasswordChangedModel { ChangeError = new ValidationResult(errors, new[] { "password" }) }); } return Attempt.Succeed(new PasswordChangedModel()); @@ -197,7 +197,7 @@ namespace Umbraco.Web.Editors } catch (Exception ex) { - _logger.Warn("Could not change member password", ex); + _logger.Warn(ex,"Could not change member password"); return Attempt.Fail(new PasswordChangedModel { ChangeError = new ValidationResult("Could not change password, error: " + ex.Message + " (see log for full details)", new[] { "value" }) }); } } diff --git a/src/Umbraco.Web/Editors/RelationTypeController.cs b/src/Umbraco.Web/Editors/RelationTypeController.cs index 3e45600be9..e56d856933 100644 --- a/src/Umbraco.Web/Editors/RelationTypeController.cs +++ b/src/Umbraco.Web/Editors/RelationTypeController.cs @@ -155,7 +155,7 @@ namespace Umbraco.Web.Editors } catch (Exception ex) { - Logger.Error(GetType(), ex, "Error creating relation type with {Name}", relationType.Name); + Logger.Error(GetType(), ex, "Error creating relation type with {Name}", relationType.Name); return Request.CreateNotificationValidationErrorResponse("Error creating relation type."); } } @@ -186,7 +186,7 @@ namespace Umbraco.Web.Editors } catch (Exception ex) { - Logger.Error(GetType(), ex, "Error saving relation type with {Id}", relationType.Id); + Logger.Error(GetType(), ex, "Error saving relation type with {Id}", relationType.Id); throw new HttpResponseException(Request.CreateNotificationValidationErrorResponse("Something went wrong when saving the relation type")); } } diff --git a/src/Umbraco.Web/Editors/TinyMceController.cs b/src/Umbraco.Web/Editors/TinyMceController.cs index 1d292c64fd..1ceb4f0a1f 100644 --- a/src/Umbraco.Web/Editors/TinyMceController.cs +++ b/src/Umbraco.Web/Editors/TinyMceController.cs @@ -100,7 +100,7 @@ namespace Umbraco.Web.Editors catch (Exception ex) { // IOException, PathTooLong, DirectoryNotFound, UnathorizedAccess - Logger.Error(ex, "Error when trying to move {CurrentFilePath} to {NewFilePath}", currentFile, newFilePath); + Logger.Error(ex, "Error when trying to move {CurrentFilePath} to {NewFilePath}", currentFile, newFilePath); return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, $"Error when trying to move {currentFile} to {newFilePath}", ex); } diff --git a/src/Umbraco.Web/HealthCheck/HealthCheckController.cs b/src/Umbraco.Web/HealthCheck/HealthCheckController.cs index 2f72b946de..770b41c323 100644 --- a/src/Umbraco.Web/HealthCheck/HealthCheckController.cs +++ b/src/Umbraco.Web/HealthCheck/HealthCheckController.cs @@ -73,7 +73,7 @@ namespace Umbraco.Web.HealthCheck } catch (Exception ex) { - _logger.Error(ex, "Exception in health check: {HealthCheckName}", check.Name); + _logger.Error(ex, "Exception in health check: {HealthCheckName}", check.Name); throw; } } diff --git a/src/Umbraco.Web/HealthCheck/HealthCheckResults.cs b/src/Umbraco.Web/HealthCheck/HealthCheckResults.cs index 61028699f0..9f58e04f79 100644 --- a/src/Umbraco.Web/HealthCheck/HealthCheckResults.cs +++ b/src/Umbraco.Web/HealthCheck/HealthCheckResults.cs @@ -27,7 +27,7 @@ namespace Umbraco.Web.HealthCheck } catch (Exception ex) { - Logger.Error(ex, "Error running scheduled health check: {HealthCheckName}", t.Name); + Logger.Error(ex, "Error running scheduled health check: {HealthCheckName}", t.Name); var message = $"Health check failed with exception: {ex.Message}. See logs for details."; return new List { @@ -62,16 +62,16 @@ namespace Umbraco.Web.HealthCheck var checkIsSuccess = result.Value.All(x => x.ResultType == StatusResultType.Success); if (checkIsSuccess) { - Logger.Info("Checks for '{HealthCheckName}' all completed successfully.", checkName); + Logger.Info("Checks for '{HealthCheckName}' all completed successfully.", checkName); } else { - Logger.Warn("Checks for '{HealthCheckName}' completed with errors.", checkName); + Logger.Warn("Checks for '{HealthCheckName}' completed with errors.", checkName); } foreach (var checkResult in checkResults) { - Logger.Info("Result for {HealthCheckName}: {HealthCheckResult}, Message: '{HealthCheckMessage}'", checkName, checkResult.ResultType, checkResult.Message); + Logger.Info("Result for {HealthCheckName}: {HealthCheckResult}, Message: '{HealthCheckMessage}'", checkName, checkResult.ResultType, checkResult.Message); } } } diff --git a/src/Umbraco.Web/ImageCropperTemplateExtensions.cs b/src/Umbraco.Web/ImageCropperTemplateExtensions.cs index 78b55a8930..dad2f9e3f3 100644 --- a/src/Umbraco.Web/ImageCropperTemplateExtensions.cs +++ b/src/Umbraco.Web/ImageCropperTemplateExtensions.cs @@ -9,6 +9,7 @@ using Umbraco.Core.Models; using Umbraco.Core.Models.PublishedContent; using Umbraco.Core.PropertyEditors.ValueConverters; using Umbraco.Web.Models; +using Umbraco.Core.Logging; namespace Umbraco.Web { @@ -270,7 +271,7 @@ namespace Umbraco.Web } catch (Exception ex) { - Current.Logger.Error(typeof(ImageCropperTemplateExtensions), ex, "Could not parse the json string: {Json}", json); + Current.Logger.Error(typeof(ImageCropperTemplateExtensions), ex, "Could not parse the json string: {Json}", json); } } diff --git a/src/Umbraco.Web/Install/Controllers/InstallApiController.cs b/src/Umbraco.Web/Install/Controllers/InstallApiController.cs index d151df46f7..924bd3ff99 100644 --- a/src/Umbraco.Web/Install/Controllers/InstallApiController.cs +++ b/src/Umbraco.Web/Install/Controllers/InstallApiController.cs @@ -120,7 +120,7 @@ namespace Umbraco.Web.Install.Controllers catch (Exception ex) { - _logger.Error(ex, "An error occurred during installation step {Step}", step.Name); + _logger.Error(ex, "An error occurred during installation step {Step}", step.Name); if (ex is TargetInvocationException && ex.InnerException != null) { @@ -210,7 +210,7 @@ namespace Umbraco.Web.Install.Controllers } catch (Exception ex) { - _logger.Error(ex, "Checking if step requires execution ({Step}) failed.", step.Name); + _logger.Error(ex, "Checking if step requires execution ({Step}) failed.", step.Name); throw; } } @@ -232,7 +232,7 @@ namespace Umbraco.Web.Install.Controllers } catch (Exception ex) { - _logger.Error(ex, "Installation step {Step} failed.", step.Name); + _logger.Error(ex, "Installation step {Step} failed.", step.Name); throw; } } diff --git a/src/Umbraco.Web/JavaScript/ClientDependencyConfiguration.cs b/src/Umbraco.Web/JavaScript/ClientDependencyConfiguration.cs index 2bf069b06d..019c7e29a6 100644 --- a/src/Umbraco.Web/JavaScript/ClientDependencyConfiguration.cs +++ b/src/Umbraco.Web/JavaScript/ClientDependencyConfiguration.cs @@ -79,7 +79,7 @@ namespace Umbraco.Web.JavaScript versionAttribute.SetValue(newVersion); clientDependencyConfigXml.Save(_fileName, SaveOptions.DisableFormatting); - _logger.Info("Updated version number from {OldVersion} to {NewVersion}", oldVersion, newVersion); + _logger.Info("Updated version number from {OldVersion} to {NewVersion}", oldVersion, newVersion); return true; } } diff --git a/src/Umbraco.Web/Macros/MacroRenderer.cs b/src/Umbraco.Web/Macros/MacroRenderer.cs index 54ce640855..e6c94ef3cf 100755 --- a/src/Umbraco.Web/Macros/MacroRenderer.cs +++ b/src/Umbraco.Web/Macros/MacroRenderer.cs @@ -89,7 +89,7 @@ namespace Umbraco.Web.Macros if (macroContent == null) return null; - _plogger.Debug("Macro content loaded from cache '{MacroCacheId}'", model.CacheIdentifier); + _plogger.Debug("Macro content loaded from cache '{MacroCacheId}'", model.CacheIdentifier); // ensure that the source has not changed // note: does not handle dependencies, and never has @@ -149,7 +149,7 @@ namespace Umbraco.Web.Macros priority: CacheItemPriority.NotRemovable ); - _plogger.Debug("Macro content saved to cache '{MacroCacheId}'", model.CacheIdentifier); + _plogger.Debug("Macro content saved to cache '{MacroCacheId}'", model.CacheIdentifier); } // gets the macro source file name @@ -284,7 +284,7 @@ namespace Umbraco.Web.Macros } catch (Exception e) { - _plogger.Warn(e, "Failed {MsgIn}", msgIn); + _plogger.Warn(e, "Failed {MsgIn}", msgIn); var macroErrorEventArgs = new MacroErrorEventArgs { diff --git a/src/Umbraco.Web/Media/UploadAutoFillProperties.cs b/src/Umbraco.Web/Media/UploadAutoFillProperties.cs index 60de03b450..4e0201ad99 100644 --- a/src/Umbraco.Web/Media/UploadAutoFillProperties.cs +++ b/src/Umbraco.Web/Media/UploadAutoFillProperties.cs @@ -74,7 +74,7 @@ namespace Umbraco.Web.Media } catch (Exception ex) { - _logger.Error(typeof(UploadAutoFillProperties), ex, "Could not populate upload auto-fill properties for file '{File}'.", filepath); + _logger.Error(typeof(UploadAutoFillProperties), ex, "Could not populate upload auto-fill properties for file '{File}'.", filepath); ResetProperties(content, autoFillConfig, culture, segment); } } diff --git a/src/Umbraco.Web/Models/Mapping/ContentPropertyBasicMapper.cs b/src/Umbraco.Web/Models/Mapping/ContentPropertyBasicMapper.cs index 2e035430df..bcfeb5e330 100644 --- a/src/Umbraco.Web/Models/Mapping/ContentPropertyBasicMapper.cs +++ b/src/Umbraco.Web/Models/Mapping/ContentPropertyBasicMapper.cs @@ -38,7 +38,7 @@ namespace Umbraco.Web.Models.Mapping var editor = _propertyEditors[property.PropertyType.PropertyEditorAlias]; if (editor == null) { - _logger.Error>( + _logger.Error, string>( new NullReferenceException("The property editor with alias " + property.PropertyType.PropertyEditorAlias + " does not exist"), "No property editor '{PropertyEditorAlias}' found, converting to a Label", property.PropertyType.PropertyEditorAlias); diff --git a/src/Umbraco.Web/Models/Mapping/DataTypeMapDefinition.cs b/src/Umbraco.Web/Models/Mapping/DataTypeMapDefinition.cs index 6b5797e05b..817d99c0fd 100644 --- a/src/Umbraco.Web/Models/Mapping/DataTypeMapDefinition.cs +++ b/src/Umbraco.Web/Models/Mapping/DataTypeMapDefinition.cs @@ -173,7 +173,7 @@ namespace Umbraco.Web.Models.Mapping else { // weird - just leave the field without a value - but warn - _logger.Warn("Could not find a value for configuration field '{ConfigField}'", field.Key); + _logger.Warn("Could not find a value for configuration field '{ConfigField}'", field.Key); } } } diff --git a/src/Umbraco.Web/Models/Mapping/MacroMapDefinition.cs b/src/Umbraco.Web/Models/Mapping/MacroMapDefinition.cs index e654fc16a1..216e1e100e 100644 --- a/src/Umbraco.Web/Models/Mapping/MacroMapDefinition.cs +++ b/src/Umbraco.Web/Models/Mapping/MacroMapDefinition.cs @@ -73,7 +73,7 @@ namespace Umbraco.Web.Models.Mapping { //we'll just map this to a text box paramEditor = _parameterEditors[Constants.PropertyEditors.Aliases.TextBox]; - _logger.Warn("Could not resolve a parameter editor with alias {PropertyEditorAlias}, a textbox will be rendered in it's place", source.EditorAlias); + _logger.Warn("Could not resolve a parameter editor with alias {PropertyEditorAlias}, a textbox will be rendered in it's place", source.EditorAlias); } target.View = paramEditor.GetValueEditor().View; diff --git a/src/Umbraco.Web/Mvc/RenderMvcController.cs b/src/Umbraco.Web/Mvc/RenderMvcController.cs index 64c9ad52c4..7c0345c300 100644 --- a/src/Umbraco.Web/Mvc/RenderMvcController.cs +++ b/src/Umbraco.Web/Mvc/RenderMvcController.cs @@ -68,7 +68,7 @@ namespace Umbraco.Web.Mvc var result = ViewEngines.Engines.FindView(ControllerContext, template, null); if (result.View != null) return true; - Logger.Warn("No physical template file was found for template {Template}", template); + Logger.Warn("No physical template file was found for template {Template}", template); return false; } diff --git a/src/Umbraco.Web/PropertyEditors/BlockEditorPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/BlockEditorPropertyEditor.cs index 8c4ebf49c3..9a3ec99fd4 100644 --- a/src/Umbraco.Web/PropertyEditors/BlockEditorPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/BlockEditorPropertyEditor.cs @@ -148,7 +148,7 @@ namespace Umbraco.Web.PropertyEditors { // deal with weird situations by ignoring them (no comment) row.PropertyValues.Remove(prop.Key); - _logger.Warn( + _logger.Warn( "ToEditor removed property value {PropertyKey} in row {RowId} for property type {PropertyTypeAlias}", prop.Key, row.Key, property.PropertyType.Alias); continue; diff --git a/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyEditor.cs index b0e5bf30bd..e66af480f8 100644 --- a/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyEditor.cs @@ -91,7 +91,7 @@ namespace Umbraco.Web.PropertyEditors catch (Exception ex) { if (writeLog) - Logger.Error(ex, "Could not parse image cropper value '{Json}'", value); + Logger.Error(ex, "Could not parse image cropper value '{Json}'", value); return null; } } diff --git a/src/Umbraco.Web/PropertyEditors/NestedContentPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/NestedContentPropertyEditor.cs index ca3c5a2a04..1047c4317d 100644 --- a/src/Umbraco.Web/PropertyEditors/NestedContentPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/NestedContentPropertyEditor.cs @@ -126,7 +126,7 @@ namespace Umbraco.Web.PropertyEditors { // deal with weird situations by ignoring them (no comment) row.RawPropertyValues.Remove(prop.Key); - _logger.Warn( + _logger.Warn( ex, "ConvertDbToString removed property value {PropertyKey} in row {RowId} for property type {PropertyTypeAlias}", prop.Key, row.Id, propertyType.Alias); @@ -195,7 +195,7 @@ namespace Umbraco.Web.PropertyEditors { // deal with weird situations by ignoring them (no comment) row.RawPropertyValues.Remove(prop.Key); - _logger.Warn( + _logger.Warn( ex, "ToEditor removed property value {PropertyKey} in row {RowId} for property type {PropertyTypeAlias}", prop.Key, row.Id, property.PropertyType.Alias); diff --git a/src/Umbraco.Web/PropertyEditors/RichTextEditorPastedImages.cs b/src/Umbraco.Web/PropertyEditors/RichTextEditorPastedImages.cs index 5a3334685c..c21e2dae20 100644 --- a/src/Umbraco.Web/PropertyEditors/RichTextEditorPastedImages.cs +++ b/src/Umbraco.Web/PropertyEditors/RichTextEditorPastedImages.cs @@ -132,7 +132,7 @@ namespace Umbraco.Web.PropertyEditors } catch (Exception ex) { - _logger.Error(typeof(HtmlImageSourceParser), ex, "Could not delete temp file or folder {FileName}", absoluteTempImagePath); + _logger.Error(typeof(HtmlImageSourceParser), ex, "Could not delete temp file or folder {FileName}", absoluteTempImagePath); } } } diff --git a/src/Umbraco.Web/PropertyEditors/RteEmbedController.cs b/src/Umbraco.Web/PropertyEditors/RteEmbedController.cs index ca3bd36374..9c9cd929bf 100644 --- a/src/Umbraco.Web/PropertyEditors/RteEmbedController.cs +++ b/src/Umbraco.Web/PropertyEditors/RteEmbedController.cs @@ -60,7 +60,7 @@ namespace Umbraco.Web.PropertyEditors } catch(Exception ex) { - Logger.Error(ex, "Error embedding URL {Url} - width: {Width} height: {Height}", url, width, height); + Logger.Error(ex, "Error embedding url {Url} - width: {Width} height: {Height}", url, width, height); result.OEmbedStatus = OEmbedStatus.Error; } diff --git a/src/Umbraco.Web/PublishedCache/NuCache/ContentStore.cs b/src/Umbraco.Web/PublishedCache/NuCache/ContentStore.cs index f25e7fa1c3..1de53e9c6e 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/ContentStore.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/ContentStore.cs @@ -598,7 +598,7 @@ namespace Umbraco.Web.PublishedCache.NuCache throw new ArgumentException("Kit content cannot have children.", nameof(kit)); // ReSharper restore LocalizableElement - _logger.Debug("Set content ID: {KitNodeId}", kit.Node.Id); + _logger.Debug("Set content ID: {KitNodeId}", kit.Node.Id); // get existing _contentNodes.TryGetValue(kit.Node.Id, out var link); @@ -863,7 +863,7 @@ namespace Umbraco.Web.PublishedCache.NuCache if (link?.Value == null) return false; var content = link.Value; - _logger.Debug("Clear content ID: {ContentId}", content.Id); + _logger.Debug("Clear content ID: {ContentId}", content.Id); // clear the entire branch ClearBranchLocked(content); @@ -1670,7 +1670,7 @@ namespace Umbraco.Web.PublishedCache.NuCache { if (_gen < 0) return; #if DEBUG - _logger.Debug("Dispose snapshot ({Snapshot})", _genRef?.GenObj.Count.ToString() ?? "live"); + _logger.Debug("Dispose snapshot ({Snapshot})", _genRef?.GenObj.Count.ToString() ?? "live"); #endif _gen = -1; if (_genRef != null) diff --git a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/DatabaseDataSource.cs b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/DatabaseDataSource.cs index f9ad0ac715..8079363548 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/DatabaseDataSource.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/DatabaseDataSource.cs @@ -209,7 +209,7 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource { if (Debugger.IsAttached) throw new InvalidOperationException("Missing cmsContentNu edited content for node " + dto.Id + ", consider rebuilding."); - Current.Logger.Warn("Missing cmsContentNu edited content for node {NodeId}, consider rebuilding.", dto.Id); + Current.Logger.Warn("Missing cmsContentNu edited content for node {NodeId}, consider rebuilding.", dto.Id); } else { @@ -236,7 +236,7 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource { if (Debugger.IsAttached) throw new InvalidOperationException("Missing cmsContentNu published content for node " + dto.Id + ", consider rebuilding."); - Current.Logger.Warn("Missing cmsContentNu published content for node {NodeId}, consider rebuilding.", dto.Id); + Current.Logger.Warn("Missing cmsContentNu published content for node {NodeId}, consider rebuilding.", dto.Id); } else { diff --git a/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs b/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs index a39e26e2b1..15e45cfa71 100755 --- a/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs @@ -131,9 +131,9 @@ namespace Umbraco.Web.PublishedCache.NuCache // stores need to be populated, happens in OnResolutionFrozen which uses _localDbExists to // figure out whether it can read the databases or it should populate them from sql - _logger.Info("Creating the content store, localContentDbExists? {LocalContentDbExists}", _localContentDbExists); + _logger.Info("Creating the content store, localContentDbExists? {LocalContentDbExists}", _localContentDbExists); _contentStore = new ContentStore(publishedSnapshotAccessor, variationContextAccessor, logger, _localContentDb); - _logger.Info("Creating the media store, localMediaDbExists? {LocalMediaDbExists}", _localMediaDbExists); + _logger.Info("Creating the media store, localMediaDbExists? {LocalMediaDbExists}", _localMediaDbExists); _mediaStore = new ContentStore(publishedSnapshotAccessor, variationContextAccessor, logger, _localMediaDb); } else @@ -182,7 +182,7 @@ namespace Umbraco.Web.PublishedCache.NuCache _localContentDb = BTree.GetTree(localContentDbPath, _localContentDbExists); _localMediaDb = BTree.GetTree(localMediaDbPath, _localMediaDbExists); - _logger.Info("Registered with MainDom, localContentDbExists? {LocalContentDbExists}, localMediaDbExists? {LocalMediaDbExists}", _localContentDbExists, _localMediaDbExists); + _logger.Info("Registered with MainDom, localContentDbExists? {LocalContentDbExists}, localMediaDbExists? {LocalMediaDbExists}", _localContentDbExists, _localMediaDbExists); } /// @@ -690,7 +690,7 @@ namespace Umbraco.Web.PublishedCache.NuCache foreach (var payload in payloads) { - _logger.Debug("Notified {ChangeTypes} for content {ContentId}", payload.ChangeTypes, payload.Id); + _logger.Debug("Notified {ChangeTypes} for content {ContentId}", payload.ChangeTypes, payload.Id); if (payload.ChangeTypes.HasType(TreeChangeTypes.RefreshAll)) { @@ -783,7 +783,7 @@ namespace Umbraco.Web.PublishedCache.NuCache foreach (var payload in payloads) { - _logger.Debug("Notified {ChangeTypes} for media {MediaId}", payload.ChangeTypes, payload.Id); + _logger.Debug("Notified {ChangeTypes} for media {MediaId}", payload.ChangeTypes, payload.Id); if (payload.ChangeTypes.HasType(TreeChangeTypes.RefreshAll)) { @@ -854,7 +854,7 @@ namespace Umbraco.Web.PublishedCache.NuCache return; foreach (var payload in payloads) - _logger.Debug("Notified {ChangeTypes} for {ItemType} {ItemId}", payload.ChangeTypes, payload.ItemType, payload.Id); + _logger.Debug("Notified {ChangeTypes} for {ItemType} {ItemId}", payload.ChangeTypes, payload.ItemType, payload.Id); Notify(_contentStore, payloads, RefreshContentTypesLocked); Notify(_mediaStore, payloads, RefreshMediaTypesLocked); @@ -938,7 +938,7 @@ namespace Umbraco.Web.PublishedCache.NuCache var idsA = payloads.Select(x => x.Id).ToArray(); foreach (var payload in payloads) - _logger.Debug("Notified {RemovedStatus} for data type {DataTypeId}", + _logger.Debug("Notified {RemovedStatus} for data type {DataTypeId}", payload.Removed ? "Removed" : "Refreshed", payload.Id); diff --git a/src/Umbraco.Web/PublishedCache/PublishedContentTypeCache.cs b/src/Umbraco.Web/PublishedCache/PublishedContentTypeCache.cs index 8eb50b0588..0f6e9af6bd 100644 --- a/src/Umbraco.Web/PublishedCache/PublishedContentTypeCache.cs +++ b/src/Umbraco.Web/PublishedCache/PublishedContentTypeCache.cs @@ -72,7 +72,7 @@ namespace Umbraco.Web.PublishedCache /// An identifier. public void ClearContentType(int id) { - _logger.Debug("Clear content type w/id {ContentTypeId}", id); + _logger.Debug("Clear content type w/id {ContentTypeId}", id); try { @@ -107,7 +107,7 @@ namespace Umbraco.Web.PublishedCache /// A data type identifier. public void ClearDataType(int id) { - _logger.Debug("Clear data type w/id {DataTypeId}.", id); + _logger.Debug("Clear data type w/id {DataTypeId}.", id); // there is no recursion to handle here because a PublishedContentType contains *all* its // properties ie both its own properties and those that were inherited (it's based upon an diff --git a/src/Umbraco.Web/Routing/ContentFinderByConfigured404.cs b/src/Umbraco.Web/Routing/ContentFinderByConfigured404.cs index eae198bb59..5255da6521 100644 --- a/src/Umbraco.Web/Routing/ContentFinderByConfigured404.cs +++ b/src/Umbraco.Web/Routing/ContentFinderByConfigured404.cs @@ -69,7 +69,7 @@ namespace Umbraco.Web.Routing if (error404.HasValue) { - _logger.Debug("Got id={ErrorNodeId}.", error404.Value); + _logger.Debug("Got id={ErrorNodeId}.", error404.Value); content = frequest.UmbracoContext.Content.GetById(error404.Value); diff --git a/src/Umbraco.Web/Routing/ContentFinderByIdPath.cs b/src/Umbraco.Web/Routing/ContentFinderByIdPath.cs index b339198928..8cc52054f3 100644 --- a/src/Umbraco.Web/Routing/ContentFinderByIdPath.cs +++ b/src/Umbraco.Web/Routing/ContentFinderByIdPath.cs @@ -49,7 +49,7 @@ namespace Umbraco.Web.Routing if (nodeId > 0) { - _logger.Debug("Id={NodeId}", nodeId); + _logger.Debug("Id={NodeId}", nodeId); node = frequest.UmbracoContext.Content.GetById(nodeId); if (node != null) @@ -62,7 +62,7 @@ namespace Umbraco.Web.Routing } frequest.PublishedContent = node; - _logger.Debug("Found node with id={PublishedContentId}", frequest.PublishedContent.Id); + _logger.Debug("Found node with id={PublishedContentId}", frequest.PublishedContent.Id); } else { diff --git a/src/Umbraco.Web/Routing/ContentFinderByRedirectUrl.cs b/src/Umbraco.Web/Routing/ContentFinderByRedirectUrl.cs index 6c1195d222..265d6ff3a4 100644 --- a/src/Umbraco.Web/Routing/ContentFinderByRedirectUrl.cs +++ b/src/Umbraco.Web/Routing/ContentFinderByRedirectUrl.cs @@ -42,7 +42,7 @@ namespace Umbraco.Web.Routing if (redirectUrl == null) { - _logger.Debug("No match for route: {Route}", route); + _logger.Debug("No match for route: {Route}", route); return false; } @@ -50,14 +50,14 @@ namespace Umbraco.Web.Routing var url = content == null ? "#" : content.Url(redirectUrl.Culture); if (url.StartsWith("#")) { - _logger.Debug("Route {Route} matches content {ContentId} which has no URL.", route, redirectUrl.ContentId); + _logger.Debug("Route {Route} matches content {ContentId} which has no URL.", route, redirectUrl.ContentId); return false; } // Appending any querystring from the incoming request to the redirect URL url = string.IsNullOrEmpty(frequest.Uri.Query) ? url : url + frequest.Uri.Query; - _logger.Debug("Route {Route} matches content {ContentId} with URL '{Url}', redirecting.", route, content.Id, url); + _logger.Debug("Route {Route} matches content {ContentId} with url '{Url}', redirecting.", route, content.Id, url); frequest.SetRedirectPermanent(url); diff --git a/src/Umbraco.Web/Routing/ContentFinderByUrl.cs b/src/Umbraco.Web/Routing/ContentFinderByUrl.cs index 074193417a..571dfddd2e 100644 --- a/src/Umbraco.Web/Routing/ContentFinderByUrl.cs +++ b/src/Umbraco.Web/Routing/ContentFinderByUrl.cs @@ -46,13 +46,13 @@ namespace Umbraco.Web.Routing { if (docreq == null) throw new System.ArgumentNullException(nameof(docreq)); - Logger.Debug("Test route {Route}", route); + Logger.Debug("Test route {Route}", route); var node = docreq.UmbracoContext.Content.GetByRoute(docreq.UmbracoContext.InPreviewMode, route, culture: docreq.Culture?.Name); if (node != null) { docreq.PublishedContent = node; - Logger.Debug("Got content, id={NodeId}", node.Id); + Logger.Debug("Got content, id={NodeId}", node.Id); } else { diff --git a/src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs b/src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs index 0ee5f3d42d..9f470b83ac 100644 --- a/src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs +++ b/src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs @@ -44,7 +44,7 @@ namespace Umbraco.Web.Routing if (node != null) { frequest.PublishedContent = node; - Logger.Debug("Path '{UriAbsolutePath}' is an alias for id={PublishedContentId}", frequest.Uri.AbsolutePath, frequest.PublishedContent.Id); + Logger.Debug("Path '{UriAbsolutePath}' is an alias for id={PublishedContentId}", frequest.Uri.AbsolutePath, frequest.PublishedContent.Id); } } diff --git a/src/Umbraco.Web/Routing/ContentFinderByUrlAndTemplate.cs b/src/Umbraco.Web/Routing/ContentFinderByUrlAndTemplate.cs index a02ebbb2a8..bb5cea063a 100644 --- a/src/Umbraco.Web/Routing/ContentFinderByUrlAndTemplate.cs +++ b/src/Umbraco.Web/Routing/ContentFinderByUrlAndTemplate.cs @@ -56,11 +56,11 @@ namespace Umbraco.Web.Routing if (template == null) { - Logger.Debug("Not a valid template: '{TemplateAlias}'", templateAlias); + Logger.Debug("Not a valid template: '{TemplateAlias}'", templateAlias); return false; } - Logger.Debug("Valid template: '{TemplateAlias}'", templateAlias); + Logger.Debug("Valid template: '{TemplateAlias}'", templateAlias); // look for node corresponding to the rest of the route var route = frequest.HasDomain ? (frequest.Domain.ContentId + path) : path; @@ -68,14 +68,14 @@ namespace Umbraco.Web.Routing if (node == null) { - Logger.Debug("Not a valid route to node: '{Route}'", route); + Logger.Debug("Not a valid route to node: '{Route}'", route); return false; } // IsAllowedTemplate deals both with DisableAlternativeTemplates and ValidateAlternativeTemplates settings if (!node.IsAllowedTemplate(template.Id)) { - Logger.Warn("Alternative template '{TemplateAlias}' is not allowed on node {NodeId}.", template.Alias, node.Id); + Logger.Warn("Alternative template '{TemplateAlias}' is not allowed on node {NodeId}.", template.Alias, node.Id); frequest.PublishedContent = null; // clear return false; } diff --git a/src/Umbraco.Web/Routing/DefaultUrlProvider.cs b/src/Umbraco.Web/Routing/DefaultUrlProvider.cs index f26f05c36c..fdd76a9160 100644 --- a/src/Umbraco.Web/Routing/DefaultUrlProvider.cs +++ b/src/Umbraco.Web/Routing/DefaultUrlProvider.cs @@ -44,7 +44,7 @@ namespace Umbraco.Web.Routing { if (string.IsNullOrWhiteSpace(route)) { - _logger.Debug("Couldn't find any page with nodeId={NodeId}. This is most likely caused by the page not being published.", id); + _logger.Debug("Couldn't find any page with nodeId={NodeId}. This is most likely caused by the page not being published.", id); return null; } diff --git a/src/Umbraco.Web/Routing/NotFoundHandlerHelper.cs b/src/Umbraco.Web/Routing/NotFoundHandlerHelper.cs index 9fefeeb843..f2494696cf 100644 --- a/src/Umbraco.Web/Routing/NotFoundHandlerHelper.cs +++ b/src/Umbraco.Web/Routing/NotFoundHandlerHelper.cs @@ -107,7 +107,7 @@ namespace Umbraco.Web.Routing } catch (Exception ex) { - Current.Logger.Error(ex, "Could not parse xpath expression: {ContentXPath}", errorPage.ContentXPath); + Current.Logger.Error(ex, "Could not parse xpath expression: {ContentXPath}", errorPage.ContentXPath); return null; } } diff --git a/src/Umbraco.Web/Routing/PublishedRouter.cs b/src/Umbraco.Web/Routing/PublishedRouter.cs index 676b973271..a02fd5872a 100644 --- a/src/Umbraco.Web/Routing/PublishedRouter.cs +++ b/src/Umbraco.Web/Routing/PublishedRouter.cs @@ -253,7 +253,7 @@ namespace Umbraco.Web.Routing // note - we are not handling schemes nor ports here. - _logger.Debug("{TracePrefix}Uri={RequestUri}", tracePrefix, request.Uri); + _logger.Debug("{TracePrefix}Uri={RequestUri}", tracePrefix, request.Uri); var domainsCache = request.UmbracoContext.PublishedSnapshot.Domains; var domains = domainsCache.GetAll(includeWildcards: false).ToList(); @@ -305,12 +305,12 @@ namespace Umbraco.Web.Routing else { // not matching any existing domain - _logger.Debug("{TracePrefix}Matches no domain", tracePrefix); + _logger.Debug("{TracePrefix}Matches no domain", tracePrefix); request.Culture = defaultCulture == null ? CultureInfo.CurrentUICulture : new CultureInfo(defaultCulture); } - _logger.Debug("{TracePrefix}Culture={CultureName}", tracePrefix, request.Culture.Name); + _logger.Debug("{TracePrefix}Culture={CultureName}", tracePrefix, request.Culture.Name); return request.Domain != null; } @@ -326,7 +326,7 @@ namespace Umbraco.Web.Routing return; var nodePath = request.PublishedContent.Path; - _logger.Debug("{TracePrefix}Path={NodePath}", tracePrefix, nodePath); + _logger.Debug("{TracePrefix}Path={NodePath}", tracePrefix, nodePath); var rootNodeId = request.HasDomain ? request.Domain.ContentId : (int?)null; var domain = DomainUtilities.FindWildcardDomainInPath(request.UmbracoContext.PublishedSnapshot.Domains.GetAll(true), nodePath, rootNodeId); @@ -334,11 +334,11 @@ namespace Umbraco.Web.Routing if (domain != null) { request.Culture = domain.Culture; - _logger.Debug("{TracePrefix}Got domain on node {DomainContentId}, set culture to {CultureName}", tracePrefix, domain.ContentId, request.Culture.Name); + _logger.Debug("{TracePrefix}Got domain on node {DomainContentId}, set culture to {CultureName}", tracePrefix, domain.ContentId, request.Culture.Name); } else { - _logger.Debug("{TracePrefix}No match.", tracePrefix); + _logger.Debug("{TracePrefix}No match.", tracePrefix); } } @@ -380,7 +380,7 @@ namespace Umbraco.Web.Routing /// A value indicating whether a document and template were found. private void FindPublishedContentAndTemplate(PublishedRequest request) { - _logger.Debug("FindPublishedContentAndTemplate: Path={UriAbsolutePath}", request.Uri.AbsolutePath); + _logger.Debug("FindPublishedContentAndTemplate: Path={UriAbsolutePath}", request.Uri.AbsolutePath); // run the document finders FindPublishedContent(request); @@ -423,7 +423,7 @@ namespace Umbraco.Web.Routing //iterate but return on first one that finds it var found = _contentFinders.Any(finder => { - _logger.Debug("Finder {ContentFinderType}", finder.GetType().FullName); + _logger.Debug("Finder {ContentFinderType}", finder.GetType().FullName); return finder.TryFindContent(request); }); @@ -457,7 +457,7 @@ namespace Umbraco.Web.Routing const int maxLoop = 8; do { - _logger.Debug("HandlePublishedContent: Loop {LoopCounter}", i); + _logger.Debug("HandlePublishedContent: Loop {LoopCounter}", i); // handle not found if (request.HasPublishedContent == false) @@ -543,13 +543,13 @@ namespace Umbraco.Web.Routing if (valid == false) { // bad redirect - log and display the current page (legacy behavior) - _logger.Debug("FollowInternalRedirects: Failed to redirect to id={InternalRedirectId}: value is not an int nor a GuidUdi.", + _logger.Debug("FollowInternalRedirects: Failed to redirect to id={InternalRedirectId}: value is not an int nor a GuidUdi.", request.PublishedContent.GetProperty(Constants.Conventions.Content.InternalRedirectId).GetSourceValue()); } if (internalRedirectNode == null) { - _logger.Debug("FollowInternalRedirects: Failed to redirect to id={InternalRedirectId}: no such published document.", + _logger.Debug("FollowInternalRedirects: Failed to redirect to id={InternalRedirectId}: no such published document.", request.PublishedContent.GetProperty(Constants.Conventions.Content.InternalRedirectId).GetSourceValue()); } else if (internalRedirectId == request.PublishedContent.Id) @@ -561,7 +561,7 @@ namespace Umbraco.Web.Routing { request.SetInternalRedirectPublishedContent(internalRedirectNode); // don't use .PublishedContent here redirect = true; - _logger.Debug("FollowInternalRedirects: Redirecting to id={InternalRedirectId}", internalRedirectId); + _logger.Debug("FollowInternalRedirects: Redirecting to id={InternalRedirectId}", internalRedirectId); } return redirect; @@ -701,7 +701,7 @@ namespace Umbraco.Web.Routing if (request.HasTemplate) _logger.Debug("FindTemplate: Has a template already, but also an alternative template."); - _logger.Debug("FindTemplate: Look for alternative template alias={AltTemplate}", altTemplate); + _logger.Debug("FindTemplate: Look for alternative template alias={AltTemplate}", altTemplate); // IsAllowedTemplate deals both with DisableAlternativeTemplates and ValidateAlternativeTemplates settings if (request.PublishedContent.IsAllowedTemplate(altTemplate)) @@ -712,16 +712,16 @@ namespace Umbraco.Web.Routing if (template != null) { request.TemplateModel = template; - _logger.Debug("FindTemplate: Got alternative template id={TemplateId} alias={TemplateAlias}", template.Id, template.Alias); + _logger.Debug("FindTemplate: Got alternative template id={TemplateId} alias={TemplateAlias}", template.Id, template.Alias); } else { - _logger.Debug("FindTemplate: The alternative template with alias={AltTemplate} does not exist, ignoring.", altTemplate); + _logger.Debug("FindTemplate: The alternative template with alias={AltTemplate} does not exist, ignoring.", altTemplate); } } else { - _logger.Warn("FindTemplate: Alternative template {TemplateAlias} is not allowed on node {NodeId}, ignoring.", altTemplate, request.PublishedContent.Id); + _logger.Warn("FindTemplate: Alternative template {TemplateAlias} is not allowed on node {NodeId}, ignoring.", altTemplate, request.PublishedContent.Id); // no allowed, back to default var templateId = request.PublishedContent.TemplateId; @@ -744,7 +744,7 @@ namespace Umbraco.Web.Routing } else { - _logger.Debug("FindTemplate: Running with template id={TemplateId} alias={TemplateAlias}", request.TemplateModel.Id, request.TemplateModel.Alias); + _logger.Debug("FindTemplate: Running with template id={TemplateId} alias={TemplateAlias}", request.TemplateModel.Id, request.TemplateModel.Alias); } } @@ -756,7 +756,7 @@ namespace Umbraco.Web.Routing return null; } - _logger.Debug("GetTemplateModel: Get template id={TemplateId}", templateId); + _logger.Debug("GetTemplateModel: Get template id={TemplateId}", templateId); if (templateId == null) throw new InvalidOperationException("The template is not set, the page cannot render."); @@ -764,7 +764,7 @@ namespace Umbraco.Web.Routing var template = _services.FileService.GetTemplate(templateId.Value); if (template == null) throw new InvalidOperationException("The template with Id " + templateId + " does not exist, the page cannot render."); - _logger.Debug("GetTemplateModel: Got template id={TemplateId} alias={TemplateAlias}", template.Id, template.Alias); + _logger.Debug("GetTemplateModel: Got template id={TemplateId} alias={TemplateAlias}", template.Id, template.Alias); return template; } diff --git a/src/Umbraco.Web/Scheduling/BackgroundTaskRunner.cs b/src/Umbraco.Web/Scheduling/BackgroundTaskRunner.cs index 81bb45e270..a126592ffc 100644 --- a/src/Umbraco.Web/Scheduling/BackgroundTaskRunner.cs +++ b/src/Umbraco.Web/Scheduling/BackgroundTaskRunner.cs @@ -239,7 +239,7 @@ namespace Umbraco.Web.Scheduling throw new InvalidOperationException("The task runner has completed."); // add task - _logger.Debug("{LogPrefix} Task Added {TaskType}", _logPrefix , task.GetType().FullName); + _logger.Debug("{LogPrefix} Task Added {TaskType}", _logPrefix , task.GetType().FullName); _tasks.Post(task); // start @@ -259,12 +259,12 @@ namespace Umbraco.Web.Scheduling { if (_completed) { - _logger.Debug("{LogPrefix} Task cannot be added {TaskType}, the task runner has already shutdown", _logPrefix, task.GetType().FullName); + _logger.Debug("{LogPrefix} Task cannot be added {TaskType}, the task runner has already shutdown", _logPrefix, task.GetType().FullName); return false; } // add task - _logger.Debug("{LogPrefix} Task added {TaskType}", _logPrefix, task.GetType().FullName); + _logger.Debug("{LogPrefix} Task added {TaskType}", _logPrefix, task.GetType().FullName); _tasks.Post(task); // start @@ -321,7 +321,7 @@ namespace Umbraco.Web.Scheduling _shutdownToken = _shutdownTokenSource.Token; _runningTask = Task.Run(async () => await Pump().ConfigureAwait(false), _shutdownToken); - _logger.Debug("{LogPrefix} Starting", _logPrefix); + _logger.Debug("{LogPrefix} Starting", _logPrefix); } /// @@ -342,7 +342,7 @@ namespace Umbraco.Web.Scheduling var hasTasks = TaskCount > 0; if (!force && hasTasks) - _logger.Info("{LogPrefix} Waiting for tasks to complete", _logPrefix); + _logger.Info("{LogPrefix} Waiting for tasks to complete", _logPrefix); // complete the queue // will stop waiting on the queue or on a latch @@ -408,7 +408,7 @@ namespace Umbraco.Web.Scheduling } catch (Exception ex) { - _logger.Error(ex, "{LogPrefix} Task runner exception", _logPrefix); + _logger.Error(ex, "{LogPrefix} Task runner exception", _logPrefix); } } } @@ -440,7 +440,7 @@ namespace Umbraco.Web.Scheduling if (_shutdownToken.IsCancellationRequested == false && TaskCount > 0) continue; // if we really have nothing to do, stop - _logger.Debug("{LogPrefix} Stopping", _logPrefix); + _logger.Debug("{LogPrefix} Stopping", _logPrefix); if (_options.PreserveRunningTask == false) _runningTask = null; @@ -567,7 +567,7 @@ namespace Umbraco.Web.Scheduling catch (Exception ex) { - _logger.Error(ex, "{LogPrefix} Task has failed", _logPrefix); + _logger.Error(ex, "{LogPrefix} Task has failed", _logPrefix); } } @@ -601,7 +601,7 @@ namespace Umbraco.Web.Scheduling private void OnEvent(TypedEventHandler, TArgs> handler, string name, TArgs e) { - _logger.Debug("{LogPrefix} OnEvent {EventName}", _logPrefix, name); + _logger.Debug("{LogPrefix} OnEvent {EventName}", _logPrefix, name); if (handler == null) return; @@ -611,7 +611,7 @@ namespace Umbraco.Web.Scheduling } catch (Exception ex) { - _logger.Error(ex, "{LogPrefix} {Name} exception occurred", _logPrefix, name); + _logger.Error(ex, "{LogPrefix} {Name} exception occurred", _logPrefix, name); } } @@ -698,7 +698,7 @@ namespace Umbraco.Web.Scheduling if (_terminating == false) { _terminating = true; - _logger.Info("{LogPrefix} Terminating {Immediate}", _logPrefix, immediate ? immediate.ToString() : string.Empty); + _logger.Info("{LogPrefix} Terminating {Immediate}", _logPrefix, immediate ? immediate.ToString() : string.Empty); onTerminating = true; } } @@ -791,7 +791,7 @@ namespace Umbraco.Web.Scheduling /// private void StopImmediate() { - _logger.Info("{LogPrefix} Canceling tasks", _logPrefix); + _logger.Info("{LogPrefix} Canceling tasks", _logPrefix); try { Shutdown(true, true); // cancel all tasks, wait for the current one to end @@ -825,7 +825,7 @@ namespace Umbraco.Web.Scheduling terminatedSource = _terminatedSource; } - _logger.Info("{LogPrefix} Tasks {TaskStatus}, terminated", + _logger.Info("{LogPrefix} Tasks {TaskStatus}, terminated", _logPrefix, immediate ? "cancelled" : "completed"); diff --git a/src/Umbraco.Web/Scheduling/KeepAlive.cs b/src/Umbraco.Web/Scheduling/KeepAlive.cs index 2dcf9a24a7..5ee10e4c2a 100644 --- a/src/Umbraco.Web/Scheduling/KeepAlive.cs +++ b/src/Umbraco.Web/Scheduling/KeepAlive.cs @@ -70,7 +70,7 @@ namespace Umbraco.Web.Scheduling } catch (Exception ex) { - _logger.Error(ex, "Keep alive failed (at '{keepAlivePingUrl}').", keepAlivePingUrl); + _logger.Error(ex, "Keep alive failed (at '{keepAlivePingUrl}').", keepAlivePingUrl); } } diff --git a/src/Umbraco.Web/Scheduling/ScheduledPublishing.cs b/src/Umbraco.Web/Scheduling/ScheduledPublishing.cs index 97afe25e22..b7ec7ffc0e 100644 --- a/src/Umbraco.Web/Scheduling/ScheduledPublishing.cs +++ b/src/Umbraco.Web/Scheduling/ScheduledPublishing.cs @@ -67,7 +67,7 @@ namespace Umbraco.Web.Scheduling // run var result = _contentService.PerformScheduledPublish(DateTime.Now); foreach (var grouped in result.GroupBy(x => x.Result)) - _logger.Info("Scheduled publishing result: '{StatusCount}' items with status {Status}", grouped.Count(), grouped.Key); + _logger.Info("Scheduled publishing result: '{StatusCount}' items with status {Status}", grouped.Count(), grouped.Key); } finally { diff --git a/src/Umbraco.Web/Scheduling/TempFileCleanup.cs b/src/Umbraco.Web/Scheduling/TempFileCleanup.cs index d2a254dfd6..05f96f0e75 100644 --- a/src/Umbraco.Web/Scheduling/TempFileCleanup.cs +++ b/src/Umbraco.Web/Scheduling/TempFileCleanup.cs @@ -50,7 +50,7 @@ namespace Umbraco.Web.Scheduling dir.Refresh(); //in case it's changed during runtime if (!dir.Exists) { - _logger.Debug("The cleanup folder doesn't exist {Folder}", dir.FullName); + _logger.Debug("The cleanup folder doesn't exist {Folder}", dir.FullName); return; } @@ -66,7 +66,7 @@ namespace Umbraco.Web.Scheduling } catch (Exception ex) { - _logger.Error(ex, "Could not delete temp file {FileName}", file.FullName); + _logger.Error(ex, "Could not delete temp file {FileName}", file.FullName); } } } diff --git a/src/Umbraco.Web/Search/ExamineComponent.cs b/src/Umbraco.Web/Search/ExamineComponent.cs index eb6b81ba16..16cc8c210a 100644 --- a/src/Umbraco.Web/Search/ExamineComponent.cs +++ b/src/Umbraco.Web/Search/ExamineComponent.cs @@ -107,7 +107,7 @@ namespace Umbraco.Web.Search var registeredIndexers = _examineManager.Indexes.OfType().Count(x => x.EnableDefaultEventHandler); - _logger.Info("Adding examine event handlers for {RegisteredIndexers} index providers.", registeredIndexers); + _logger.Info("Adding examine event handlers for {RegisteredIndexers} index providers.", registeredIndexers); // don't bind event handlers if we're not suppose to listen if (registeredIndexers == 0) diff --git a/src/Umbraco.Web/Security/MembershipHelper.cs b/src/Umbraco.Web/Security/MembershipHelper.cs index e655b87767..49ed6f6f99 100644 --- a/src/Umbraco.Web/Security/MembershipHelper.cs +++ b/src/Umbraco.Web/Security/MembershipHelper.cs @@ -315,7 +315,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}", username); + Current.Logger.Warn("The member validated but then no member was returned with the username {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 bf9ee654c4..dd10e576e0 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}", username); + Current.Logger.Warn, string>("Cannot create member as username already exists: {Username}", username); return null; } @@ -157,7 +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}", email); + Current.Logger.Warn, string>("Cannot create member as a member with the same email address exists: {Email}", email); return null; } @@ -525,7 +525,7 @@ namespace Umbraco.Web.Security.Providers if (member == null) { - Current.Logger.Info("Login attempt failed for username {Username} from IP address {IpAddress}, the user does not exist", username, GetCurrentRequestIpAddress()); + Current.Logger.Info("Login attempt failed for username {Username} from IP address {IpAddress}, the user does not exist", username, GetCurrentRequestIpAddress()); return new ValidateUserResult { @@ -535,7 +535,7 @@ namespace Umbraco.Web.Security.Providers if (member.IsApproved == false) { - Current.Logger.Info("Login attempt failed for username {Username} from IP address {IpAddress}, the user is not approved", username, GetCurrentRequestIpAddress()); + Current.Logger.Info("Login attempt failed for username {Username} from IP address {IpAddress}, the user is not approved", username, GetCurrentRequestIpAddress()); return new ValidateUserResult { @@ -545,7 +545,7 @@ namespace Umbraco.Web.Security.Providers } if (member.IsLockedOut) { - Current.Logger.Info("Login attempt failed for username {Username} from IP address {IpAddress}, the user is locked", username, GetCurrentRequestIpAddress()); + Current.Logger.Info("Login attempt failed for username {Username} from IP address {IpAddress}, the user is locked", username, GetCurrentRequestIpAddress()); return new ValidateUserResult { @@ -571,11 +571,11 @@ namespace Umbraco.Web.Security.Providers member.IsLockedOut = true; member.LastLockoutDate = DateTime.Now; - Current.Logger.Info("Login attempt failed for username {Username} from IP address {IpAddress}, the user is now locked out, max invalid password attempts exceeded", username, GetCurrentRequestIpAddress()); + Current.Logger.Info("Login attempt failed for username {Username} from IP address {IpAddress}, the user is now locked out, max invalid password attempts exceeded", username, GetCurrentRequestIpAddress()); } else { - Current.Logger.Info("Login attempt failed for username {Username} from IP address {IpAddress}", username, GetCurrentRequestIpAddress()); + Current.Logger.Info("Login attempt failed for username {Username} from IP address {IpAddress}", username, GetCurrentRequestIpAddress()); } requiresFullSave = true; @@ -591,7 +591,7 @@ namespace Umbraco.Web.Security.Providers member.LastLoginDate = DateTime.Now; - Current.Logger.Info("Login attempt succeeded for username {Username} from IP address {IpAddress}", username, GetCurrentRequestIpAddress()); + Current.Logger.Info("Login attempt succeeded for username {Username} from IP address {IpAddress}", username, GetCurrentRequestIpAddress()); } // don't raise events for this! It just sets the member dates, if we do raise events this will diff --git a/src/Umbraco.Web/Templates/HtmlUrlParser.cs b/src/Umbraco.Web/Templates/HtmlUrlParser.cs index 0692b75fa7..721e8c04f4 100644 --- a/src/Umbraco.Web/Templates/HtmlUrlParser.cs +++ b/src/Umbraco.Web/Templates/HtmlUrlParser.cs @@ -36,7 +36,7 @@ namespace Umbraco.Web.Templates { // find all relative URLs (ie. URLs that contain ~) var tags = ResolveUrlPattern.Matches(text); - _logger.Debug(typeof(IOHelper), "After regex: {Duration} matched: {TagsCount}", timer.Stopwatch.ElapsedMilliseconds, tags.Count); + _logger.Debug(typeof(IOHelper), "After regex: {Duration} matched: {TagsCount}", timer.Stopwatch.ElapsedMilliseconds, tags.Count); foreach (Match tag in tags) { var url = ""; diff --git a/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs b/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs index 57c7027598..ea78ef7aa0 100644 --- a/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs +++ b/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs @@ -175,7 +175,7 @@ namespace Umbraco.Web.Trees // TODO: in the future we could return a validation statement so we can have some UI to notify the user they don't have access if (ignoreUserStartNodes == false && HasPathAccess(id, queryStrings) == false) { - Logger.Warn("User {Username} does not have access to node with id {Id}", Security.CurrentUser.Username, id); + Logger.Warn("User {Username} does not have access to node with id {Id}", Security.CurrentUser.Username, id); return nodes; } diff --git a/src/Umbraco.Web/UmbracoApplicationBase.cs b/src/Umbraco.Web/UmbracoApplicationBase.cs index 32a949e972..c9a4e18dd6 100644 --- a/src/Umbraco.Web/UmbracoApplicationBase.cs +++ b/src/Umbraco.Web/UmbracoApplicationBase.cs @@ -132,7 +132,7 @@ namespace Umbraco.Web BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField, null, runtime, null); - Current.Logger.Info("Application shutdown. Details: {ShutdownReason}\r\n\r\n_shutDownMessage={ShutdownMessage}\r\n\r\n_shutDownStack={ShutdownStack}", + Current.Logger.Info("Application shutdown. Details: {ShutdownReason}\r\n\r\n_shutDownMessage={ShutdownMessage}\r\n\r\n_shutDownStack={ShutdownStack}", HostingEnvironment.ShutdownReason, shutDownMessage, shutDownStack); @@ -140,7 +140,7 @@ namespace Umbraco.Web catch (Exception) { //if for some reason that fails, then log the normal output - Current.Logger.Info("Application shutdown. Reason: {ShutdownReason}", HostingEnvironment.ShutdownReason); + Current.Logger.Info("Application shutdown. Reason: {ShutdownReason}", HostingEnvironment.ShutdownReason); } Current.Logger.DisposeIfDisposable(); @@ -195,7 +195,7 @@ namespace Umbraco.Web } catch (Exception ex) { - Current.Logger.Error(ex, "Error in {Name} handler.", name); + Current.Logger.Error(ex, "Error in {Name} handler.", name); throw; } } diff --git a/src/Umbraco.Web/UmbracoModule.cs b/src/Umbraco.Web/UmbracoModule.cs index 2ec4141f5a..bfa5361a8a 100644 --- a/src/Umbraco.Web/UmbracoModule.cs +++ b/src/Umbraco.Web/UmbracoModule.cs @@ -50,7 +50,7 @@ namespace Umbraco.Web var end = false; var response = context.Response; - logger.Debug("Response status: Redirect={Redirect}, Is404={Is404}, StatusCode={ResponseStatusCode}", + logger.Debug("Response status: Redirect={Redirect}, Is404={Is404}, StatusCode={ResponseStatusCode}", pcr.IsRedirect ? (pcr.IsRedirectPermanent ? "permanent" : "redirect") : "none", pcr.Is404 ? "true" : "false", pcr.ResponseStatusCode); diff --git a/src/Umbraco.Web/WebApi/Filters/FileUploadCleanupFilterAttribute.cs b/src/Umbraco.Web/WebApi/Filters/FileUploadCleanupFilterAttribute.cs index 1646c8a426..a5c0c2bc17 100644 --- a/src/Umbraco.Web/WebApi/Filters/FileUploadCleanupFilterAttribute.cs +++ b/src/Umbraco.Web/WebApi/Filters/FileUploadCleanupFilterAttribute.cs @@ -57,7 +57,7 @@ namespace Umbraco.Web.WebApi.Filters } catch (System.Exception ex) { - Current.Logger.Error(ex, "Could not delete temp file {FileName}", f.TempFilePath); + Current.Logger.Error(ex, "Could not delete temp file {FileName}", f.TempFilePath); } } } @@ -111,7 +111,7 @@ namespace Umbraco.Web.WebApi.Filters tempFolders.Add(dir); } - Current.Logger.Debug("Removing temp file {FileName}", f.TempFilePath); + Current.Logger.Debug("Removing temp file {FileName}", f.TempFilePath); try { @@ -119,7 +119,7 @@ namespace Umbraco.Web.WebApi.Filters } catch (System.Exception ex) { - Current.Logger.Error(ex, "Could not delete temp file {FileName}", f.TempFilePath); + Current.Logger.Error(ex, "Could not delete temp file {FileName}", f.TempFilePath); } //clear out the temp path so it's not returned in the response @@ -138,12 +138,12 @@ namespace Umbraco.Web.WebApi.Filters } else { - Current.Logger.Warn("The actionExecutedContext.Request.Content.Value is not IHaveUploadedFiles, it is {ObjectType}", objectContent.Value.GetType()); + Current.Logger.Warn("The actionExecutedContext.Request.Content.Value is not IHaveUploadedFiles, it is {ObjectType}", objectContent.Value.GetType()); } } else { - Current.Logger.Warn("The actionExecutedContext.Request.Content is not ObjectContent, it is {RequestObjectType}", actionExecutedContext.Request.Content.GetType()); + Current.Logger.Warn("The actionExecutedContext.Request.Content is not ObjectContent, it is {RequestObjectType}", actionExecutedContext.Request.Content.GetType()); } } } diff --git a/src/Umbraco.Web/WebApi/UnhandledExceptionLogger.cs b/src/Umbraco.Web/WebApi/UnhandledExceptionLogger.cs index 1dd43f5b2a..983c377e80 100644 --- a/src/Umbraco.Web/WebApi/UnhandledExceptionLogger.cs +++ b/src/Umbraco.Web/WebApi/UnhandledExceptionLogger.cs @@ -29,7 +29,7 @@ namespace Umbraco.Web.WebApi var requestUrl = context.ExceptionContext?.ControllerContext?.Request?.RequestUri?.AbsoluteUri; var controllerType = context.ExceptionContext?.ActionContext?.ControllerContext?.Controller?.GetType(); - _logger.Error(controllerType, context.Exception, "Unhandled controller exception occurred for request '{RequestUrl}'", requestUrl); + _logger.Error(controllerType, context.Exception, "Unhandled controller exception occurred for request '{RequestUrl}'", requestUrl); } }