From a18580c7f6e07efd0fcdb007dfd28fe4401ce83c Mon Sep 17 00:00:00 2001 From: Nikolaj Date: Wed, 16 Sep 2020 10:24:05 +0200 Subject: [PATCH] Remove Debug from LoggerExtensions --- src/Umbraco.Core/IO/FileSystems.cs | 4 ++-- src/Umbraco.Core/Logging/LogProfiler.cs | 2 +- src/Umbraco.Core/Logging/LoggerExtensions.cs | 19 ------------------ .../Routing/ContentFinderByIdPath.cs | 6 +++--- .../Routing/ContentFinderByRedirectUrl.cs | 6 +++--- .../Routing/ContentFinderByUrl.cs | 6 +++--- .../Routing/ContentFinderByUrlAlias.cs | 2 +- .../Routing/ContentFinderByUrlAndTemplate.cs | 8 ++++---- .../Routing/DefaultUrlProvider.cs | 2 +- src/Umbraco.Core/Runtime/MainDom.cs | 4 ++-- .../Persistence/UmbracoDatabase.cs | 8 ++++---- .../Persistence/UmbracoDatabaseFactory.cs | 12 +++++------ .../Routing/ContentFinderByConfigured404.cs | 8 ++++---- .../Runtime/CoreRuntime.cs | 2 +- .../Runtime/SqlMainDomLock.cs | 18 ++++++++--------- src/Umbraco.Infrastructure/RuntimeState.cs | 10 +++++----- .../Scheduling/BackgroundTaskRunner.cs | 12 +++++------ src/Umbraco.Infrastructure/Scoping/Scope.cs | 2 +- .../Services/Implement/NotificationService.cs | 6 +++--- .../Sync/ServerMessengerBase.cs | 8 ++++---- .../LiveModelsProvider.cs | 4 ++-- .../Integration/ContentEventsTests.cs | 2 +- .../LegacyXmlPublishedCache/XmlStore.cs | 14 ++++++------- .../XmlStoreFilePersister.cs | 20 +++++++++---------- .../ExamineManagementController.cs | 2 +- .../RedirectUrlManagementController.cs | 2 +- .../FileUploadCleanupFilterAttribute.cs | 2 +- src/Umbraco.Web/CdfLogger.cs | 2 +- src/Umbraco.Web/UmbracoModule.cs | 4 ++-- .../FileUploadCleanupFilterAttribute.cs | 2 +- 30 files changed, 90 insertions(+), 109 deletions(-) diff --git a/src/Umbraco.Core/IO/FileSystems.cs b/src/Umbraco.Core/IO/FileSystems.cs index ba5fcb91f3..acb0f2c895 100644 --- a/src/Umbraco.Core/IO/FileSystems.cs +++ b/src/Umbraco.Core/IO/FileSystems.cs @@ -233,7 +233,7 @@ namespace Umbraco.Core.IO _shadowCurrentId = id; - _logger.Debug("Shadow '{ShadowId}'", _shadowCurrentId); + _logger.LogDebug("Shadow '{ShadowId}'", _shadowCurrentId); foreach (var wrapper in _shadowWrappers) wrapper.Shadow(_shadowCurrentId); @@ -250,7 +250,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.LogDebug("UnShadow '{ShadowId}' {Status}", id, completed ? "complete" : "abort"); var exceptions = new List(); foreach (var wrapper in _shadowWrappers) diff --git a/src/Umbraco.Core/Logging/LogProfiler.cs b/src/Umbraco.Core/Logging/LogProfiler.cs index 81e250895b..23a9cd5d50 100644 --- a/src/Umbraco.Core/Logging/LogProfiler.cs +++ b/src/Umbraco.Core/Logging/LogProfiler.cs @@ -18,7 +18,7 @@ namespace Umbraco.Core.Logging /// public IDisposable Step(string name) { - _logger.Debug("Begin: {ProfileName}", name); + _logger.LogDebug("Begin: {ProfileName}", name); return new LightDisposableTimer(duration => _logger.LogInformation("End {ProfileName} ({ProfileDuration}ms)", name, duration)); } diff --git a/src/Umbraco.Core/Logging/LoggerExtensions.cs b/src/Umbraco.Core/Logging/LoggerExtensions.cs index f40c090c0a..5c4112ffaf 100644 --- a/src/Umbraco.Core/Logging/LoggerExtensions.cs +++ b/src/Umbraco.Core/Logging/LoggerExtensions.cs @@ -15,24 +15,5 @@ namespace Umbraco.Core.Logging /// The level. public static bool IsEnabled(this ILogger logger, LogLevel level) => logger.IsEnabled(typeof(T), level); - - /// - /// Logs a debugging message. - /// - /// The reporting type. - /// The logger. - /// A message. - public static void Debug(this ILogger logger, string message) - => logger.LogDebug(message); - - /// - /// Logs a debugging message. - /// - /// The reporting type - /// The logger. - /// A message template. - /// Property values. - public static void Debug(this ILogger logger, string messageTemplate, params object[] propertyValues) - => logger.LogDebug(messageTemplate, propertyValues); } } diff --git a/src/Umbraco.Core/Routing/ContentFinderByIdPath.cs b/src/Umbraco.Core/Routing/ContentFinderByIdPath.cs index 4b58832e8e..52787ffc0c 100644 --- a/src/Umbraco.Core/Routing/ContentFinderByIdPath.cs +++ b/src/Umbraco.Core/Routing/ContentFinderByIdPath.cs @@ -51,7 +51,7 @@ namespace Umbraco.Web.Routing if (nodeId > 0) { - _logger.Debug("Id={NodeId}", nodeId); + _logger.LogDebug("Id={NodeId}", nodeId); node = frequest.UmbracoContext.Content.GetById(nodeId); if (node != null) @@ -67,7 +67,7 @@ namespace Umbraco.Web.Routing } frequest.PublishedContent = node; - _logger.Debug("Found node with id={PublishedContentId}", frequest.PublishedContent.Id); + _logger.LogDebug("Found node with id={PublishedContentId}", frequest.PublishedContent.Id); } else { @@ -77,7 +77,7 @@ namespace Umbraco.Web.Routing } if (nodeId == -1) - _logger.Debug("Not a node id"); + _logger.LogDebug("Not a node id"); return node != null; } diff --git a/src/Umbraco.Core/Routing/ContentFinderByRedirectUrl.cs b/src/Umbraco.Core/Routing/ContentFinderByRedirectUrl.cs index 4e67779c1c..97b0de6a9f 100644 --- a/src/Umbraco.Core/Routing/ContentFinderByRedirectUrl.cs +++ b/src/Umbraco.Core/Routing/ContentFinderByRedirectUrl.cs @@ -41,7 +41,7 @@ namespace Umbraco.Web.Routing if (redirectUrl == null) { - _logger.Debug("No match for route: {Route}", route); + _logger.LogDebug("No match for route: {Route}", route); return false; } @@ -49,14 +49,14 @@ namespace Umbraco.Web.Routing var url = content == null ? "#" : content.Url(_publishedUrlProvider, redirectUrl.Culture); if (url.StartsWith("#")) { - _logger.Debug("Route {Route} matches content {ContentId} which has no url.", route, redirectUrl.ContentId); + _logger.LogDebug("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.LogDebug("Route {Route} matches content {ContentId} with url '{Url}', redirecting.", route, content.Id, url); frequest.SetRedirectPermanent(url); diff --git a/src/Umbraco.Core/Routing/ContentFinderByUrl.cs b/src/Umbraco.Core/Routing/ContentFinderByUrl.cs index 3fcffff842..e14a663684 100644 --- a/src/Umbraco.Core/Routing/ContentFinderByUrl.cs +++ b/src/Umbraco.Core/Routing/ContentFinderByUrl.cs @@ -46,17 +46,17 @@ namespace Umbraco.Web.Routing { if (docreq == null) throw new System.ArgumentNullException(nameof(docreq)); - Logger.Debug("Test route {Route}", route); + Logger.LogDebug("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.LogDebug("Got content, id={NodeId}", node.Id); } else { - Logger.Debug("No match."); + Logger.LogDebug("No match."); } return node; diff --git a/src/Umbraco.Core/Routing/ContentFinderByUrlAlias.cs b/src/Umbraco.Core/Routing/ContentFinderByUrlAlias.cs index 6bc1b329ed..d5010fc14d 100644 --- a/src/Umbraco.Core/Routing/ContentFinderByUrlAlias.cs +++ b/src/Umbraco.Core/Routing/ContentFinderByUrlAlias.cs @@ -48,7 +48,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.LogDebug("Path '{UriAbsolutePath}' is an alias for id={PublishedContentId}", frequest.Uri.AbsolutePath, frequest.PublishedContent.Id); } } diff --git a/src/Umbraco.Core/Routing/ContentFinderByUrlAndTemplate.cs b/src/Umbraco.Core/Routing/ContentFinderByUrlAndTemplate.cs index e908556d78..ccc6bd98f2 100644 --- a/src/Umbraco.Core/Routing/ContentFinderByUrlAndTemplate.cs +++ b/src/Umbraco.Core/Routing/ContentFinderByUrlAndTemplate.cs @@ -46,7 +46,7 @@ namespace Umbraco.Web.Routing // no template if "/" if (path == "/") { - Logger.Debug("No template in path '/'"); + Logger.LogDebug("No template in path '/'"); return false; } @@ -59,11 +59,11 @@ namespace Umbraco.Web.Routing if (template == null) { - Logger.Debug("Not a valid template: '{TemplateAlias}'", templateAlias); + Logger.LogDebug("Not a valid template: '{TemplateAlias}'", templateAlias); return false; } - Logger.Debug("Valid template: '{TemplateAlias}'", templateAlias); + Logger.LogDebug("Valid template: '{TemplateAlias}'", templateAlias); // look for node corresponding to the rest of the route var route = frequest.HasDomain ? (frequest.Domain.ContentId + path) : path; @@ -71,7 +71,7 @@ namespace Umbraco.Web.Routing if (node == null) { - Logger.Debug("Not a valid route to node: '{Route}'", route); + Logger.LogDebug("Not a valid route to node: '{Route}'", route); return false; } diff --git a/src/Umbraco.Core/Routing/DefaultUrlProvider.cs b/src/Umbraco.Core/Routing/DefaultUrlProvider.cs index f56d96b6b3..b0f7e309b8 100644 --- a/src/Umbraco.Core/Routing/DefaultUrlProvider.cs +++ b/src/Umbraco.Core/Routing/DefaultUrlProvider.cs @@ -47,7 +47,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.LogDebug("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.Core/Runtime/MainDom.cs b/src/Umbraco.Core/Runtime/MainDom.cs index 04f97d1a15..cf369ef720 100644 --- a/src/Umbraco.Core/Runtime/MainDom.cs +++ b/src/Umbraco.Core/Runtime/MainDom.cs @@ -105,7 +105,7 @@ namespace Umbraco.Core.Runtime lock (_locko) { - _logger.Debug("Signaled ({Signaled}) ({SignalSource})", _signaled ? "again" : "first", source); + _logger.LogDebug("Signaled ({Signaled}) ({SignalSource})", _signaled ? "again" : "first", source); if (_signaled) return; if (_isMainDom == false) return; // probably not needed _signaled = true; @@ -126,7 +126,7 @@ namespace Umbraco.Core.Runtime } } - _logger.Debug("Stopped ({SignalSource})", source); + _logger.LogDebug("Stopped ({SignalSource})", source); } finally { diff --git a/src/Umbraco.Infrastructure/Persistence/UmbracoDatabase.cs b/src/Umbraco.Infrastructure/Persistence/UmbracoDatabase.cs index 68f85df25a..41348507d3 100644 --- a/src/Umbraco.Infrastructure/Persistence/UmbracoDatabase.cs +++ b/src/Umbraco.Infrastructure/Persistence/UmbracoDatabase.cs @@ -227,9 +227,9 @@ namespace Umbraco.Core.Persistence protected override void OnException(Exception ex) { _logger.LogError(ex, "Exception ({InstanceId}).", InstanceId); - _logger.Debug("At:\r\n{StackTrace}", Environment.StackTrace); + _logger.LogDebug("At:\r\n{StackTrace}", Environment.StackTrace); if (EnableSqlTrace == false) - _logger.Debug("Sql:\r\n{Sql}", CommandToString(LastSQL, LastArgs)); + _logger.LogDebug("Sql:\r\n{Sql}", CommandToString(LastSQL, LastArgs)); base.OnException(ex); } @@ -242,13 +242,13 @@ 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.LogDebug("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...) DatabaseDebugHelper.SetCommand(cmd, InstanceId + " [T" + System.Threading.Thread.CurrentThread.ManagedThreadId + "]"); var refsobj = DatabaseDebugHelper.GetReferencedObjects(cmd.Connection); - if (refsobj != null) _logger.Debug("Oops!" + Environment.NewLine + refsobj); + if (refsobj != null) _logger.LogDebug("Oops!" + Environment.NewLine + refsobj); #endif _cmd = cmd; diff --git a/src/Umbraco.Infrastructure/Persistence/UmbracoDatabaseFactory.cs b/src/Umbraco.Infrastructure/Persistence/UmbracoDatabaseFactory.cs index e243ea45ef..b1e7e0e8e8 100644 --- a/src/Umbraco.Infrastructure/Persistence/UmbracoDatabaseFactory.cs +++ b/src/Umbraco.Infrastructure/Persistence/UmbracoDatabaseFactory.cs @@ -94,7 +94,7 @@ namespace Umbraco.Core.Persistence if (settings == null) { - logger.Debug("Missing connection string, defer configuration."); + logger.LogDebug("Missing connection string, defer configuration."); return; // not configured } @@ -104,7 +104,7 @@ namespace Umbraco.Core.Persistence var providerName = settings.ProviderName; if (string.IsNullOrWhiteSpace(connectionString) || string.IsNullOrWhiteSpace(providerName)) { - logger.Debug("Empty connection string or provider name, defer configuration."); + logger.LogDebug("Empty connection string or provider name, defer configuration."); return; // not configured } @@ -123,7 +123,7 @@ namespace Umbraco.Core.Persistence if (string.IsNullOrWhiteSpace(connectionString) || string.IsNullOrWhiteSpace(providerName)) { - logger.Debug("Missing connection string or provider name, defer configuration."); + logger.LogDebug("Missing connection string or provider name, defer configuration."); return; // not configured } @@ -188,7 +188,7 @@ namespace Umbraco.Core.Persistence // else leave unchanged } - _logger.Debug("SqlServer {SqlServerVersion}, DatabaseType is {DatabaseType} ({Source}).", + _logger.LogDebug("SqlServer {SqlServerVersion}, DatabaseType is {DatabaseType} ({Source}).", versionName, _databaseType, fromSettings ? "settings" : "detected"); } @@ -245,7 +245,7 @@ namespace Umbraco.Core.Persistence private SqlContext Initialize() { - _logger.Debug("Initializing."); + _logger.LogDebug("Initializing."); if (ConnectionString.IsNullOrWhiteSpace()) throw new InvalidOperationException("The factory has not been configured with a proper connection string."); if (_providerName.IsNullOrWhiteSpace()) throw new InvalidOperationException("The factory has not been configured with a proper provider name."); @@ -290,7 +290,7 @@ namespace Umbraco.Core.Persistence if (_npocoDatabaseFactory == null) throw new NullReferenceException("The call to UmbracoDatabaseFactory.Config yielded a null UmbracoDatabaseFactory instance."); - _logger.Debug("Initialized."); + _logger.LogDebug("Initialized."); return new SqlContext(_sqlSyntax, _databaseType, _pocoDataFactory, _mappers); } diff --git a/src/Umbraco.Infrastructure/Routing/ContentFinderByConfigured404.cs b/src/Umbraco.Infrastructure/Routing/ContentFinderByConfigured404.cs index ac8d0980c4..e1209bafdd 100644 --- a/src/Umbraco.Infrastructure/Routing/ContentFinderByConfigured404.cs +++ b/src/Umbraco.Infrastructure/Routing/ContentFinderByConfigured404.cs @@ -34,7 +34,7 @@ namespace Umbraco.Web.Routing /// A value indicating whether an Umbraco document was found and assigned. public bool TryFindContent(IPublishedRequest frequest) { - _logger.Debug("Looking for a page to handle 404."); + _logger.LogDebug("Looking for a page to handle 404."); // try to find a culture as best as we can var errorCulture = CultureInfo.CurrentUICulture; @@ -72,17 +72,17 @@ namespace Umbraco.Web.Routing if (error404.HasValue) { - _logger.Debug("Got id={ErrorNodeId}.", error404.Value); + _logger.LogDebug("Got id={ErrorNodeId}.", error404.Value); content = frequest.UmbracoContext.Content.GetById(error404.Value); - _logger.Debug(content == null + _logger.LogDebug(content == null ? "Could not find content with that id." : "Found corresponding content."); } else { - _logger.Debug("Got nothing."); + _logger.LogDebug("Got nothing."); } frequest.PublishedContent = content; diff --git a/src/Umbraco.Infrastructure/Runtime/CoreRuntime.cs b/src/Umbraco.Infrastructure/Runtime/CoreRuntime.cs index 3fb07b6841..4c0a088f3e 100644 --- a/src/Umbraco.Infrastructure/Runtime/CoreRuntime.cs +++ b/src/Umbraco.Infrastructure/Runtime/CoreRuntime.cs @@ -138,7 +138,7 @@ namespace Umbraco.Core.Runtime HostingEnvironment?.ApplicationId, HostingEnvironment?.ApplicationPhysicalPath, NetworkHelper.MachineName); - Logger.Debug("Runtime: {Runtime}", GetType().FullName); + Logger.LogDebug("Runtime: {Runtime}", GetType().FullName); AppDomain.CurrentDomain.SetData("DataDirectory", HostingEnvironment?.MapPathContentRoot(Constants.SystemDirectories.Data)); diff --git a/src/Umbraco.Infrastructure/Runtime/SqlMainDomLock.cs b/src/Umbraco.Infrastructure/Runtime/SqlMainDomLock.cs index 5141d30f9a..71633c3972 100644 --- a/src/Umbraco.Infrastructure/Runtime/SqlMainDomLock.cs +++ b/src/Umbraco.Infrastructure/Runtime/SqlMainDomLock.cs @@ -60,7 +60,7 @@ namespace Umbraco.Core.Runtime _sqlServerSyntax = sqlServerSyntaxProvider; - _logger.Debug("Acquiring lock..."); + _logger.LogDebug("Acquiring lock..."); var tempId = Guid.NewGuid().ToString(); @@ -93,7 +93,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.LogDebug("Acquired with ID {LockId}", _lockId); return true; } @@ -180,7 +180,7 @@ namespace Umbraco.Core.Runtime { // we are no longer main dom, another one has come online, exit _mainDomChanging = true; - _logger.Debug("Detected new booting application, releasing MainDom lock."); + _logger.LogDebug("Detected new booting application, releasing MainDom lock."); return; } } @@ -260,7 +260,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.LogDebug("Acquired with ID {LockId}", _lockId); return true; } else if (mainDomRows.Count == 1 && !mainDomRows[0].Value.StartsWith(tempId)) @@ -269,7 +269,7 @@ namespace Umbraco.Core.Runtime // another new AppDomain has come online and is wanting to take over. In that case, we will not // acquire. - _logger.Debug("Cannot acquire, another booting application detected."); + _logger.LogDebug("Cannot acquire, another booting application detected."); return false; } } @@ -303,7 +303,7 @@ namespace Umbraco.Core.Runtime // which isn't ideal. // So... we're going to 'just' take over, if the writelock works then we'll assume we're ok - _logger.Debug("Timeout elapsed, assuming orphan row, acquiring MainDom."); + _logger.LogDebug("Timeout elapsed, assuming orphan row, acquiring MainDom."); using var transaction = db.GetTransaction(IsolationLevel.ReadCommitted); @@ -313,7 +313,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.LogDebug("Acquired with ID {LockId}", _lockId); return true; } catch (Exception ex) @@ -398,12 +398,12 @@ namespace Umbraco.Core.Runtime // Otherwise, if we are just shutting down, we want to just delete the row. if (_mainDomChanging) { - _logger.Debug("Releasing MainDom, updating row, new application is booting."); + _logger.LogDebug("Releasing MainDom, updating row, new application is booting."); var count = db.Execute($"UPDATE umbracoKeyValue SET [value] = [value] + '{UpdatedSuffix}' WHERE [key] = @key", new { key = MainDomKey }); } else { - _logger.Debug("Releasing MainDom, deleting row, application is shutting down."); + _logger.LogDebug("Releasing MainDom, deleting row, application is shutting down."); var count = db.Execute("DELETE FROM umbracoKeyValue WHERE [key] = @key", new { key = MainDomKey }); } } diff --git a/src/Umbraco.Infrastructure/RuntimeState.cs b/src/Umbraco.Infrastructure/RuntimeState.cs index d48eb73c98..b23e5ad9f1 100644 --- a/src/Umbraco.Infrastructure/RuntimeState.cs +++ b/src/Umbraco.Infrastructure/RuntimeState.cs @@ -71,7 +71,7 @@ namespace Umbraco.Core { // local version *does* match code version, but the database is not configured // install - may happen with Deploy/Cloud/etc - _logger.Debug("Database is not configured, need to install Umbraco."); + _logger.LogDebug("Database is not configured, need to install Umbraco."); Level = RuntimeLevel.Install; Reason = RuntimeLevelReason.InstallNoDatabase; return; @@ -86,14 +86,14 @@ namespace Umbraco.Core { connect = _databaseFactory.CanConnect; if (connect || ++i == tries) break; - _logger.Debug("Could not immediately connect to database, trying again."); + _logger.LogDebug("Could not immediately connect to database, trying again."); Thread.Sleep(1000); } if (connect == false) { // cannot connect to configured database, this is bad, fail - _logger.Debug("Could not connect to database."); + _logger.LogDebug("Could not connect to database."); if (_globalSettings.InstallMissingDatabase) { @@ -154,7 +154,7 @@ namespace Umbraco.Core // although the files version matches the code version, the database version does not // which means the local files have been upgraded but not the database - need to upgrade - _logger.Debug("Has not reached the final upgrade step, need to upgrade Umbraco."); + _logger.LogDebug("Has not reached the final upgrade step, need to upgrade Umbraco."); Level = RuntimeLevel.Upgrade; Reason = RuntimeLevelReason.UpgradeMigrations; } @@ -171,7 +171,7 @@ namespace Umbraco.Core FinalMigrationState = upgrader.Plan.FinalState; } - logger.Debug("Final upgrade state is {FinalMigrationState}, database contains {DatabaseState}", FinalMigrationState, CurrentMigrationState ?? ""); + logger.LogDebug("Final upgrade state is {FinalMigrationState}, database contains {DatabaseState}", FinalMigrationState, CurrentMigrationState ?? ""); return CurrentMigrationState == FinalMigrationState; } diff --git a/src/Umbraco.Infrastructure/Scheduling/BackgroundTaskRunner.cs b/src/Umbraco.Infrastructure/Scheduling/BackgroundTaskRunner.cs index 4bcc179fc9..4298c92aa7 100644 --- a/src/Umbraco.Infrastructure/Scheduling/BackgroundTaskRunner.cs +++ b/src/Umbraco.Infrastructure/Scheduling/BackgroundTaskRunner.cs @@ -245,7 +245,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.LogDebug("{LogPrefix} Task Added {TaskType}", _logPrefix , task.GetType().FullName); _tasks.Post(task); // start @@ -265,12 +265,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.LogDebug("{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.LogDebug("{LogPrefix} Task added {TaskType}", _logPrefix, task.GetType().FullName); _tasks.Post(task); // start @@ -327,7 +327,7 @@ namespace Umbraco.Web.Scheduling _shutdownToken = _shutdownTokenSource.Token; _runningTask = Task.Run(async () => await Pump().ConfigureAwait(false), _shutdownToken); - _logger.Debug("{LogPrefix} Starting", _logPrefix); + _logger.LogDebug("{LogPrefix} Starting", _logPrefix); } /// @@ -446,7 +446,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.LogDebug("{LogPrefix} Stopping", _logPrefix); if (_options.PreserveRunningTask == false) _runningTask = null; @@ -607,7 +607,7 @@ namespace Umbraco.Web.Scheduling private void OnEvent(TypedEventHandler, TArgs> handler, string name, TArgs e) { - _logger.Debug("{LogPrefix} OnEvent {EventName}", _logPrefix, name); + _logger.LogDebug("{LogPrefix} OnEvent {EventName}", _logPrefix, name); if (handler == null) return; diff --git a/src/Umbraco.Infrastructure/Scoping/Scope.cs b/src/Umbraco.Infrastructure/Scoping/Scope.cs index 3b17ae876d..d1f60666b9 100644 --- a/src/Umbraco.Infrastructure/Scoping/Scope.cs +++ b/src/Umbraco.Infrastructure/Scoping/Scope.cs @@ -323,7 +323,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.LogDebug("Uncompleted Child Scope at\r\n {StackTrace}", Environment.StackTrace); _completed = false; } diff --git a/src/Umbraco.Infrastructure/Services/Implement/NotificationService.cs b/src/Umbraco.Infrastructure/Services/Implement/NotificationService.cs index d17569d308..5fc195e92a 100644 --- a/src/Umbraco.Infrastructure/Services/Implement/NotificationService.cs +++ b/src/Umbraco.Infrastructure/Services/Implement/NotificationService.cs @@ -510,7 +510,7 @@ namespace Umbraco.Core.Services.Implement { ThreadPool.QueueUserWorkItem(state => { - _logger.Debug("Begin processing notifications."); + _logger.LogDebug("Begin processing notifications."); while (true) { NotificationRequest request; @@ -519,7 +519,7 @@ namespace Umbraco.Core.Services.Implement try { _emailSender.SendAsync(request.Mail).GetAwaiter().GetResult(); - _logger.Debug("Notification '{Action}' sent to {Username} ({Email})", request.Action, request.UserName, request.Email); + _logger.LogDebug("Notification '{Action}' sent to {Username} ({Email})", request.Action, request.UserName, request.Email); } catch (Exception ex) { @@ -538,7 +538,7 @@ namespace Umbraco.Core.Services.Implement } } - _logger.Debug("Done processing notifications."); + _logger.LogDebug("Done processing notifications."); }); } diff --git a/src/Umbraco.Infrastructure/Sync/ServerMessengerBase.cs b/src/Umbraco.Infrastructure/Sync/ServerMessengerBase.cs index b65254b181..d51ae4a114 100644 --- a/src/Umbraco.Infrastructure/Sync/ServerMessengerBase.cs +++ b/src/Umbraco.Infrastructure/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.LogDebug("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.LogDebug("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.LogDebug("Invoking refresher {RefresherType} on local server for message type {MessageType}", refresher.GetType(), messageType); var typedRefresher = refresher as ICacheRefresher; @@ -276,7 +276,7 @@ namespace Umbraco.Core.Sync //{ // if (refresher == null) throw new ArgumentNullException("refresher"); - // Current.Logger.Debug("Invoking refresher {0} on local server for message type Notify", + // Current.Logger.LogDebug("Invoking refresher {0} on local server for message type Notify", // () => refresher.GetType()); // refresher.Notify(payload); diff --git a/src/Umbraco.ModelsBuilder.Embedded/LiveModelsProvider.cs b/src/Umbraco.ModelsBuilder.Embedded/LiveModelsProvider.cs index e0898f5965..4a514f82f5 100644 --- a/src/Umbraco.ModelsBuilder.Embedded/LiveModelsProvider.cs +++ b/src/Umbraco.ModelsBuilder.Embedded/LiveModelsProvider.cs @@ -68,7 +68,7 @@ namespace Umbraco.ModelsBuilder.Embedded private void RequestModelsGeneration(object sender, EventArgs args) { //HttpContext.Current.Items[this] = true; - _logger.Debug("Requested to generate models."); + _logger.LogDebug("Requested to generate models."); Interlocked.Exchange(ref _req, 1); } @@ -82,7 +82,7 @@ namespace Umbraco.ModelsBuilder.Embedded try { - _logger.Debug("Generate models..."); + _logger.LogDebug("Generate models..."); const int timeout = 2 * 60 * 1000; // 2 mins _mutex.WaitOne(timeout); // wait until it is safe, and acquire _logger.LogInformation("Generate models now."); diff --git a/src/Umbraco.Tests/Integration/ContentEventsTests.cs b/src/Umbraco.Tests/Integration/ContentEventsTests.cs index 575215c41f..1bedfed768 100644 --- a/src/Umbraco.Tests/Integration/ContentEventsTests.cs +++ b/src/Umbraco.Tests/Integration/ContentEventsTests.cs @@ -94,7 +94,7 @@ namespace Umbraco.Tests.Integration { _events = new List(); _msgCount = 0; - Current.Logger.Debug("RESET EVENTS"); + Current.Logger.LogDebug("RESET EVENTS"); } private IContent CreateContent(int parentId = -1) diff --git a/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlStore.cs b/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlStore.cs index 895e13fe42..8a3d307507 100644 --- a/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlStore.cs +++ b/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlStore.cs @@ -426,7 +426,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache // assumes xml lock (file is always locked) private void LoadXmlLocked(SafeXmlReaderWriter safeXml, out bool registerXmlChange) { - Current.Logger.Debug("Loading Xml..."); + Current.Logger.LogDebug("Loading Xml..."); // try to get it from the file if (XmlFileEnabled && (safeXml.Xml = LoadXmlFromFile()) != null) @@ -834,7 +834,7 @@ AND (umbracoNode.id=@id)"; _nextFileCheck = now.AddSeconds(1); // check every 1s if (XmlFileLastWriteTime <= _lastFileRead) return; - Current.Logger.Debug("Xml file change detected, reloading."); + Current.Logger.LogDebug("Xml file change detected, reloading."); // time to read @@ -1042,7 +1042,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.LogDebug("Notified {ChangeTypes} for content {ContentId}", payload.ChangeTypes, payload.Id); if (payload.ChangeTypes.HasType(TreeChangeTypes.RefreshAll)) { @@ -1075,7 +1075,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.LogDebug("Notified, content {ContentId} has no published version.", payload.Id); if (current != null) { @@ -1114,7 +1114,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.LogDebug("Notified, content {ContentId} gone fishing.", payload.Id); if (current != null) { @@ -1228,7 +1228,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.LogDebug("Notified {ChangeTypes} for content type {ContentTypeId}", payload.ChangeTypes, payload.Id); if (ids.Length > 0) // must have refreshes, not only removes RefreshContentTypes(ids); @@ -1247,7 +1247,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.LogDebug("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 14769e02cd..76d00882e9 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.LogDebug("Created, save in {WaitMilliseconds}ms.", WaitMilliseconds); _initialTouch = DateTime.Now; _timer = new Timer(_ => TimerRelease()); _timer.Change(WaitMilliseconds, 0); @@ -83,22 +83,22 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache { if (_released) // our timer has triggered OR the runner is shutting down { - _logger.Debug("Touched, was released..."); + _logger.LogDebug("Touched, was released..."); // release: has run or is running, too late, return a new task (adds itself to runner) if (_runner == null) { - _logger.Debug("Runner is down, run now."); + _logger.LogDebug("Runner is down, run now."); runNow = true; } else { - _logger.Debug("Create new..."); + _logger.LogDebug("Create new..."); ret = new XmlStoreFilePersister(_runner, _store, _logger, true); if (ret._runner == null) { // could not enlist with the runner, runner is completed, must run now - _logger.Debug("Runner is down, run now."); + _logger.LogDebug("Runner is down, run now."); runNow = true; } } @@ -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.LogDebug("Touched, was idle, start and save in {WaitMilliseconds}ms.", WaitMilliseconds); _initialTouch = DateTime.Now; _timer = new Timer(_ => TimerRelease()); _timer.Change(WaitMilliseconds, 0); @@ -119,12 +119,12 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache if (DateTime.Now - _initialTouch < TimeSpan.FromMilliseconds(MaxWaitMilliseconds)) { - _logger.Debug("Touched, was waiting, can delay, save in {WaitMilliseconds}ms.", WaitMilliseconds); + _logger.LogDebug("Touched, was waiting, can delay, save in {WaitMilliseconds}ms.", WaitMilliseconds); _timer.Change(WaitMilliseconds, 0); } else { - _logger.Debug("Touched, was waiting, cannot delay."); + _logger.LogDebug("Touched, was waiting, cannot delay."); } } } @@ -144,7 +144,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache { lock (_locko) { - _logger.Debug("Timer: release."); + _logger.LogDebug("Timer: release."); _released = true; Release(); @@ -157,7 +157,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache { lock (_locko) { - _logger.Debug("Run now (sync)."); + _logger.LogDebug("Run now (sync)."); // not really needed but safer (it's only us invoking Run, but the method is public...) _released = true; } diff --git a/src/Umbraco.Web.BackOffice/Controllers/ExamineManagementController.cs b/src/Umbraco.Web.BackOffice/Controllers/ExamineManagementController.cs index f64360efc7..9ebc3801a7 100644 --- a/src/Umbraco.Web.BackOffice/Controllers/ExamineManagementController.cs +++ b/src/Umbraco.Web.BackOffice/Controllers/ExamineManagementController.cs @@ -245,7 +245,7 @@ namespace Umbraco.Web.BackOffice.Controllers { var indexer = (IIndex)sender; - _logger.Debug("Logging operation completed for index {IndexName}", indexer.Name); + _logger.LogDebug("Logging operation completed for index {IndexName}", indexer.Name); //ensure it's not listening anymore indexer.IndexOperationComplete -= Indexer_IndexOperationComplete; diff --git a/src/Umbraco.Web.BackOffice/Controllers/RedirectUrlManagementController.cs b/src/Umbraco.Web.BackOffice/Controllers/RedirectUrlManagementController.cs index 16ab197930..65795b6a0b 100644 --- a/src/Umbraco.Web.BackOffice/Controllers/RedirectUrlManagementController.cs +++ b/src/Umbraco.Web.BackOffice/Controllers/RedirectUrlManagementController.cs @@ -113,7 +113,7 @@ namespace Umbraco.Web.BackOffice.Controllers if (userIsAdmin == false) { var errorMessage = "User is not a member of the administrators group and so is not allowed to toggle the URL tracker"; - _logger.Debug(errorMessage); + _logger.LogDebug(errorMessage); throw new SecurityException(errorMessage); } diff --git a/src/Umbraco.Web.BackOffice/Filters/FileUploadCleanupFilterAttribute.cs b/src/Umbraco.Web.BackOffice/Filters/FileUploadCleanupFilterAttribute.cs index 6ac3727114..a3c667f8d4 100644 --- a/src/Umbraco.Web.BackOffice/Filters/FileUploadCleanupFilterAttribute.cs +++ b/src/Umbraco.Web.BackOffice/Filters/FileUploadCleanupFilterAttribute.cs @@ -120,7 +120,7 @@ namespace Umbraco.Web.WebApi.Filters tempFolders.Add(dir); } - _logger.Debug( + _logger.LogDebug( "Removing temp file {FileName}", f.TempFilePath); try diff --git a/src/Umbraco.Web/CdfLogger.cs b/src/Umbraco.Web/CdfLogger.cs index 462a0bf7b8..0fe9c663bc 100644 --- a/src/Umbraco.Web/CdfLogger.cs +++ b/src/Umbraco.Web/CdfLogger.cs @@ -21,7 +21,7 @@ namespace Umbraco.Web public void Debug(string msg) { - _logger.Debug(msg); + _logger.LogDebug(msg); } public void Info(string msg) diff --git a/src/Umbraco.Web/UmbracoModule.cs b/src/Umbraco.Web/UmbracoModule.cs index db10ede0c5..3dfd648667 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.LogDebug("Response status: Redirect={Redirect}, Is404={Is404}, StatusCode={ResponseStatusCode}", pcr.IsRedirect ? (pcr.IsRedirectPermanent ? "permanent" : "redirect") : "none", pcr.Is404 ? "true" : "false", pcr.ResponseStatusCode); @@ -97,7 +97,7 @@ namespace Umbraco.Web context.ApplicationInstance.CompleteRequest(); // though some say that .CompleteRequest() does not properly shutdown the response // and the request will hang until the whole code has run... would need to test? - logger.Debug("Response status: redirecting, complete request now."); + logger.LogDebug("Response status: redirecting, complete request now."); return end; } diff --git a/src/Umbraco.Web/WebApi/Filters/FileUploadCleanupFilterAttribute.cs b/src/Umbraco.Web/WebApi/Filters/FileUploadCleanupFilterAttribute.cs index e0b5bbcc23..1f944bad99 100644 --- a/src/Umbraco.Web/WebApi/Filters/FileUploadCleanupFilterAttribute.cs +++ b/src/Umbraco.Web/WebApi/Filters/FileUploadCleanupFilterAttribute.cs @@ -111,7 +111,7 @@ namespace Umbraco.Web.WebApi.Filters tempFolders.Add(dir); } - Current.Logger.Debug("Removing temp file {FileName}", f.TempFilePath); + Current.Logger.LogDebug("Removing temp file {FileName}", f.TempFilePath); try {