From 68c02a517d3bbcf35d877b46b98f15c44d988eaf Mon Sep 17 00:00:00 2001 From: Peter Donker Date: Sat, 28 Feb 2026 20:47:06 +0100 Subject: [PATCH 01/30] Merge code from previous Serilog solution to latest DNN version --- .../DotNetNuke.Instrumentation.csproj | 13 ++ .../LoggerSourceImpl.cs | 181 ++++++++---------- .../SerilogController.cs | 37 ++++ .../StartupExtensions.cs | 27 +++ Directory.Packages.props | 14 +- 5 files changed, 170 insertions(+), 102 deletions(-) create mode 100644 DNN Platform/DotNetNuke.Instrumentation/SerilogController.cs create mode 100644 DNN Platform/DotNetNuke.Instrumentation/StartupExtensions.cs diff --git a/DNN Platform/DotNetNuke.Instrumentation/DotNetNuke.Instrumentation.csproj b/DNN Platform/DotNetNuke.Instrumentation/DotNetNuke.Instrumentation.csproj index 74ec8dbd0b8..29125234088 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/DotNetNuke.Instrumentation.csproj +++ b/DNN Platform/DotNetNuke.Instrumentation/DotNetNuke.Instrumentation.csproj @@ -15,6 +15,19 @@ false + + + + + + + + + + + + + diff --git a/DNN Platform/DotNetNuke.Instrumentation/LoggerSourceImpl.cs b/DNN Platform/DotNetNuke.Instrumentation/LoggerSourceImpl.cs index 5dedcb79425..7258291b3b7 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/LoggerSourceImpl.cs +++ b/DNN Platform/DotNetNuke.Instrumentation/LoggerSourceImpl.cs @@ -7,14 +7,8 @@ namespace DotNetNuke.Instrumentation using System; using System.Diagnostics.CodeAnalysis; using System.Globalization; - using System.IO; - using DotNetNuke.Internal.SourceGenerators; - using log4net; - using log4net.Config; - using log4net.Core; - using log4net.Repository; - using log4net.Util; + using Serilog; /// An implementation. [SuppressMessage("Microsoft.Design", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix", Justification = "Breaking change")] @@ -23,68 +17,66 @@ public class LoggerSourceImpl : ILoggerSource /// public ILog GetLogger(Type type) { - return new Logger(LogManager.GetLogger(type).Logger, type); + return new Logger(type); } /// public ILog GetLogger(string name) { - return new Logger(LogManager.GetLogger(name).Logger, null); + return new Logger(null); } - private sealed class Logger : LoggerWrapperImpl, ILog + private sealed class Logger : ILog { - private const string ConfigFile = "DotNetNuke.log4net.config"; - private static readonly object ConfigLock = new object(); - private static Level levelTrace; - private static Level levelDebug; - private static Level levelInfo; - private static Level levelWarn; - private static Level levelError; - private static Level levelFatal; - private static bool configured; - - // add custom logging levels (below trace value of 20000) - // internal static Level LevelLogInfo = new Level(10001, "LogInfo"); - // internal static Level LevelLogError = new Level(10002, "LogError"); - private readonly Type stackBoundary = typeof(Logger); - - internal Logger(ILogger logger, Type type) - : base(logger) + private readonly ILogger logger; + + internal Logger(Type type) { - this.stackBoundary = type ?? typeof(Logger); - EnsureConfig(); - ReloadLevels(logger.Repository); + if (Log.Logger == null) + { + // initialize Serilog + var hostMapPath = System.Web.Hosting.HostingEnvironment.MapPath("~"); + SerilogController.AddSerilog(hostMapPath); + } + + if (type == null) + { + this.logger = Log.Logger; + } + else + { + this.logger = Log.ForContext(type); + } } public bool IsDebugEnabled { - get { return this.Logger.IsEnabledFor(levelDebug); } + get { return this.logger.IsEnabled(Serilog.Events.LogEventLevel.Debug); } } public bool IsInfoEnabled { - get { return this.Logger.IsEnabledFor(levelInfo); } + get { return this.logger.IsEnabled(Serilog.Events.LogEventLevel.Information); } } public bool IsTraceEnabled { - get { return this.Logger.IsEnabledFor(levelTrace); } + get { return this.logger.IsEnabled(Serilog.Events.LogEventLevel.Verbose); } } public bool IsWarnEnabled { - get { return this.Logger.IsEnabledFor(levelWarn); } + get { return this.logger.IsEnabled(Serilog.Events.LogEventLevel.Warning); } } public bool IsErrorEnabled { - get { return this.Logger.IsEnabledFor(levelError); } + get { return this.logger.IsEnabled(Serilog.Events.LogEventLevel.Error); } } public bool IsFatalEnabled { - get { return this.Logger.IsEnabledFor(levelFatal); } + get { return this.logger.IsEnabled(Serilog.Events.LogEventLevel.Fatal); } } public void Debug(object message) @@ -94,7 +86,14 @@ public void Debug(object message) public void Debug(object message, Exception exception) { - this.Logger.Log(this.stackBoundary, levelDebug, message, exception); + if (message is string) + { + this.logger.Debug(exception, (string)message); + } + else + { + this.logger.Debug(exception, message.ToString()); + } } public void DebugFormat(string format, params object[] args) @@ -104,7 +103,7 @@ public void DebugFormat(string format, params object[] args) public void DebugFormat(IFormatProvider provider, string format, params object[] args) { - this.Logger.Log(this.stackBoundary, levelDebug, new SystemStringFormat(provider, format, args), null); + this.logger.Debug(string.Format(CultureInfo.InvariantCulture, format, args)); } public void Info(object message) @@ -114,7 +113,14 @@ public void Info(object message) public void Info(object message, Exception exception) { - this.Logger.Log(this.stackBoundary, levelInfo, message, exception); + if (message is string) + { + this.logger.Information(exception, (string)message); + } + else + { + this.logger.Information(exception, message.ToString()); + } } public void InfoFormat(string format, params object[] args) @@ -124,7 +130,7 @@ public void InfoFormat(string format, params object[] args) public void InfoFormat(IFormatProvider provider, string format, params object[] args) { - this.Logger.Log(this.stackBoundary, levelInfo, new SystemStringFormat(provider, format, args), null); + this.logger.Information(string.Format(CultureInfo.InvariantCulture, format, args)); } public void Trace(object message) @@ -134,7 +140,14 @@ public void Trace(object message) public void Trace(object message, Exception exception) { - this.Logger.Log(this.stackBoundary, levelTrace, message, exception); + if (message is string) + { + this.logger.Verbose(exception, (string)message); + } + else + { + this.logger.Verbose(exception, message.ToString()); + } } public void TraceFormat(string format, params object[] args) @@ -144,7 +157,7 @@ public void TraceFormat(string format, params object[] args) public void TraceFormat(IFormatProvider provider, string format, params object[] args) { - this.Logger.Log(this.stackBoundary, levelTrace, new SystemStringFormat(provider, format, args), null); + this.logger.Verbose(string.Format(CultureInfo.InvariantCulture, format, args)); } public void Warn(object message) @@ -154,7 +167,14 @@ public void Warn(object message) public void Warn(object message, Exception exception) { - this.Logger.Log(this.stackBoundary, levelWarn, message, exception); + if (message is string) + { + this.logger.Warning(exception, (string)message); + } + else + { + this.logger.Warning(exception, message.ToString()); + } } public void WarnFormat(string format, params object[] args) @@ -164,7 +184,7 @@ public void WarnFormat(string format, params object[] args) public void WarnFormat(IFormatProvider provider, string format, params object[] args) { - this.Logger.Log(this.stackBoundary, levelWarn, new SystemStringFormat(provider, format, args), null); + this.logger.Warning(string.Format(CultureInfo.InvariantCulture, format, args)); } public void Error(object message) @@ -174,7 +194,14 @@ public void Error(object message) public void Error(object message, Exception exception) { - this.Logger.Log(this.stackBoundary, levelError, message, exception); + if (message is string) + { + this.logger.Error(exception, (string)message); + } + else + { + this.logger.Error(exception, message.ToString()); + } } public void ErrorFormat(string format, params object[] args) @@ -184,7 +211,7 @@ public void ErrorFormat(string format, params object[] args) public void ErrorFormat(IFormatProvider provider, string format, params object[] args) { - this.Logger.Log(this.stackBoundary, levelError, new SystemStringFormat(provider, format, args), null); + this.logger.Error(string.Format(CultureInfo.InvariantCulture, format, args)); } public void Fatal(object message) @@ -194,7 +221,14 @@ public void Fatal(object message) public void Fatal(object message, Exception exception) { - this.Logger.Log(this.stackBoundary, levelFatal, message, exception); + if (message is string) + { + this.logger.Fatal(exception, (string)message); + } + else + { + this.logger.Fatal(exception, message.ToString()); + } } public void FatalFormat(string format, params object[] args) @@ -204,58 +238,7 @@ public void FatalFormat(string format, params object[] args) public void FatalFormat(IFormatProvider provider, string format, params object[] args) { - this.Logger.Log(this.stackBoundary, levelFatal, new SystemStringFormat(provider, format, args), null); - } - - private static void EnsureConfig() - { - if (!configured) - { - lock (ConfigLock) - { - if (!configured) - { - var configPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ConfigFile); - var originalPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config\\" + ConfigFile); - if (!File.Exists(configPath) && File.Exists(originalPath)) - { - File.Copy(originalPath, configPath); - } - - if (File.Exists(configPath)) - { - AddGlobalContext(); - XmlConfigurator.ConfigureAndWatch(new FileInfo(configPath)); - } - - configured = true; - } - } - } - } - - private static void ReloadLevels(ILoggerRepository repository) - { - LevelMap levelMap = repository.LevelMap; - - levelTrace = levelMap.LookupWithDefault(Level.Trace); - levelDebug = levelMap.LookupWithDefault(Level.Debug); - levelInfo = levelMap.LookupWithDefault(Level.Info); - levelWarn = levelMap.LookupWithDefault(Level.Warn); - levelError = levelMap.LookupWithDefault(Level.Error); - levelFatal = levelMap.LookupWithDefault(Level.Fatal); - } - - private static void AddGlobalContext() - { - try - { - GlobalContext.Properties["appdomain"] = AppDomain.CurrentDomain.Id.ToString("D", CultureInfo.InvariantCulture); - } - catch - { - // do nothing but just make sure no exception here. - } + this.logger.Fatal(string.Format(CultureInfo.InvariantCulture, format, args)); } } } diff --git a/DNN Platform/DotNetNuke.Instrumentation/SerilogController.cs b/DNN Platform/DotNetNuke.Instrumentation/SerilogController.cs new file mode 100644 index 00000000000..2542058f239 --- /dev/null +++ b/DNN Platform/DotNetNuke.Instrumentation/SerilogController.cs @@ -0,0 +1,37 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information +namespace DotNetNuke.Instrumentation; + +using System.Globalization; +using System.IO; + +using Microsoft.Extensions.Configuration; +using Serilog; + +/// +/// Controller for Serilog functions. +/// +internal sealed class SerilogController +{ + /// + /// Sets up Serilog using the config file ~/Config/Serilog.config. + /// + /// Path to the root of the DNN installation. + internal static void AddSerilog(string hostMapPath) + { + var configFile = hostMapPath + "\\Config\\Serilog.config"; + var config = new LoggerConfiguration() + .WriteTo.File(hostMapPath + "\\Portals\\_default\\Logs\\log.txt", rollingInterval: RollingInterval.Day, formatProvider: CultureInfo.InvariantCulture) + .MinimumLevel.Debug(); + if (File.Exists(configFile)) + { + config = new LoggerConfiguration() + .ReadFrom.Configuration(new ConfigurationBuilder() + .AddJsonFile(configFile, optional: false, reloadOnChange: true) + .Build()); + } + + Log.Logger = config.CreateLogger(); + } +} diff --git a/DNN Platform/DotNetNuke.Instrumentation/StartupExtensions.cs b/DNN Platform/DotNetNuke.Instrumentation/StartupExtensions.cs new file mode 100644 index 00000000000..8cb7ed577b9 --- /dev/null +++ b/DNN Platform/DotNetNuke.Instrumentation/StartupExtensions.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information +namespace DotNetNuke.Instrumentation; + +using System; + +using Microsoft.Extensions.DependencyInjection; +using Serilog; + +/// +/// The startup extensions to add Serilog to the project. +/// +public static class StartupExtensions +{ + /// + /// Add Serilog to the project. + /// + /// The IServiceCollection. + /// The path to the root of the DotNetNuke website. This is needed to find the correct directory to write the log files to. + public static void AddSerilog(this IServiceCollection services, string hostMapPath) + { + Environment.SetEnvironmentVariable("BASEDIR", hostMapPath); + SerilogController.AddSerilog(hostMapPath); + services.AddLogging(loggingBuilder => loggingBuilder.AddSerilog(null, true)); + } +} diff --git a/Directory.Packages.props b/Directory.Packages.props index bf5dde29cce..66c78672a50 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -31,13 +31,17 @@ - + + - + + + + @@ -55,6 +59,10 @@ + + + + @@ -67,4 +75,4 @@ - + \ No newline at end of file From fcf8e22c92213af46777c5ba8f4c51b328a38b3a Mon Sep 17 00:00:00 2001 From: Peter Donker Date: Sat, 28 Feb 2026 22:16:57 +0100 Subject: [PATCH 02/30] Add obsolete annotations --- DNN Platform/DotNetNuke.Instrumentation/ILog.cs | 5 ++++- .../DotNetNuke.Instrumentation/ILoggerSource.cs | 5 ++++- .../DotNetNuke.Instrumentation/LoggerSource.cs | 5 ++++- .../DotNetNuke.Instrumentation/LoggerSourceImpl.cs | 12 +++++++++++- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/DNN Platform/DotNetNuke.Instrumentation/ILog.cs b/DNN Platform/DotNetNuke.Instrumentation/ILog.cs index f7fc6363f8b..e076c1849f8 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/ILog.cs +++ b/DNN Platform/DotNetNuke.Instrumentation/ILog.cs @@ -6,8 +6,11 @@ namespace DotNetNuke.Instrumentation using System; using System.Diagnostics.CodeAnalysis; + using DotNetNuke.Internal.SourceGenerators; + /// A contract specifying the ability to log information. - public interface ILog + [DnnDeprecated(10, 3, 0, "Use Microsoft's ILogger instead", RemovalVersion = 12)] + public partial interface ILog { /// Gets a value indicating whether the Debug log level is enabled. bool IsDebugEnabled { get; } diff --git a/DNN Platform/DotNetNuke.Instrumentation/ILoggerSource.cs b/DNN Platform/DotNetNuke.Instrumentation/ILoggerSource.cs index e4118b5afe6..95e616904d3 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/ILoggerSource.cs +++ b/DNN Platform/DotNetNuke.Instrumentation/ILoggerSource.cs @@ -5,8 +5,11 @@ namespace DotNetNuke.Instrumentation { using System; + using DotNetNuke.Internal.SourceGenerators; + /// A contract specifying the ability to provide instances. - public interface ILoggerSource + [DnnDeprecated(10, 3, 0, "Use Microsoft's ILogger instead", RemovalVersion = 12)] + public partial interface ILoggerSource { /// Gets the logger for the given . /// The type providing the name for the logger instance. diff --git a/DNN Platform/DotNetNuke.Instrumentation/LoggerSource.cs b/DNN Platform/DotNetNuke.Instrumentation/LoggerSource.cs index f5081075acd..f954784b2f5 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/LoggerSource.cs +++ b/DNN Platform/DotNetNuke.Instrumentation/LoggerSource.cs @@ -4,8 +4,11 @@ namespace DotNetNuke.Instrumentation { + using DotNetNuke.Internal.SourceGenerators; + /// Provides access to an instance. - public static class LoggerSource + [DnnDeprecated(10, 3, 0, "Use Microsoft's ILogger instead", RemovalVersion = 12)] + public static partial class LoggerSource { /// Gets the instance. public static ILoggerSource Instance { get; private set; } = new LoggerSourceImpl(); diff --git a/DNN Platform/DotNetNuke.Instrumentation/LoggerSourceImpl.cs b/DNN Platform/DotNetNuke.Instrumentation/LoggerSourceImpl.cs index 7258291b3b7..70805b7e981 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/LoggerSourceImpl.cs +++ b/DNN Platform/DotNetNuke.Instrumentation/LoggerSourceImpl.cs @@ -8,25 +8,35 @@ namespace DotNetNuke.Instrumentation using System.Diagnostics.CodeAnalysis; using System.Globalization; + using DotNetNuke.Internal.SourceGenerators; using Serilog; /// An implementation. [SuppressMessage("Microsoft.Design", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix", Justification = "Breaking change")] - public class LoggerSourceImpl : ILoggerSource + [DnnDeprecated(10, 3, 0, "Use Microsoft's ILogger instead", RemovalVersion = 12)] +#pragma warning disable CS0618 // Type or member is obsolete + public partial class LoggerSourceImpl : ILoggerSource +#pragma warning restore CS0618 // Type or member is obsolete { /// +#pragma warning disable CS0618 // Type or member is obsolete public ILog GetLogger(Type type) +#pragma warning restore CS0618 // Type or member is obsolete { return new Logger(type); } /// +#pragma warning disable CS0618 // Type or member is obsolete public ILog GetLogger(string name) +#pragma warning restore CS0618 // Type or member is obsolete { return new Logger(null); } +#pragma warning disable CS0618 // Type or member is obsolete private sealed class Logger : ILog +#pragma warning restore CS0618 // Type or member is obsolete { private readonly ILogger logger; From 4096f3326e152f2b6c91abaa8cf31b9458f2b0be Mon Sep 17 00:00:00 2001 From: Peter Donker Date: Sat, 28 Feb 2026 22:17:41 +0100 Subject: [PATCH 03/30] Correct path for config file and add to DNN startup --- .../DotNetNuke.Instrumentation/SerilogController.cs | 6 +++--- DNN Platform/Library/Startup.cs | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/DNN Platform/DotNetNuke.Instrumentation/SerilogController.cs b/DNN Platform/DotNetNuke.Instrumentation/SerilogController.cs index 2542058f239..4fd2f255062 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/SerilogController.cs +++ b/DNN Platform/DotNetNuke.Instrumentation/SerilogController.cs @@ -15,14 +15,14 @@ namespace DotNetNuke.Instrumentation; internal sealed class SerilogController { /// - /// Sets up Serilog using the config file ~/Config/Serilog.config. + /// Sets up Serilog using the config file ~/Serilog.config. /// /// Path to the root of the DNN installation. internal static void AddSerilog(string hostMapPath) { - var configFile = hostMapPath + "\\Config\\Serilog.config"; + var configFile = Path.Combine(hostMapPath, "Serilog.config"); var config = new LoggerConfiguration() - .WriteTo.File(hostMapPath + "\\Portals\\_default\\Logs\\log.txt", rollingInterval: RollingInterval.Day, formatProvider: CultureInfo.InvariantCulture) + .WriteTo.File(Path.Combine(hostMapPath, "Portals\\_default\\Logs\\log.txt"), rollingInterval: RollingInterval.Day, formatProvider: CultureInfo.InvariantCulture) .MinimumLevel.Debug(); if (File.Exists(configFile)) { diff --git a/DNN Platform/Library/Startup.cs b/DNN Platform/Library/Startup.cs index e70f58ec0cc..b0a35ea7a8c 100644 --- a/DNN Platform/Library/Startup.cs +++ b/DNN Platform/Library/Startup.cs @@ -75,6 +75,9 @@ public void ConfigureServices(IServiceCollection services) { services.AddTransient(typeof(Lazy<>), typeof(LazyWrapper<>)); + var hostMapPath = System.Web.Hosting.HostingEnvironment.MapPath("~"); + services.AddSerilog(hostMapPath); + services.TryAddEnumerable(ServiceDescriptor.Singleton()); services.TryAddEnumerable(ServiceDescriptor.Singleton()); services.TryAddEnumerable(ServiceDescriptor.Singleton()); From f93728990f1dcdb91893d5be754eba783b2e296d Mon Sep 17 00:00:00 2001 From: Peter Donker Date: Sat, 28 Feb 2026 22:18:11 +0100 Subject: [PATCH 04/30] Add helper class to aid transition --- .../DnnLoggingController.cs | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 DNN Platform/DotNetNuke.Instrumentation/DnnLoggingController.cs diff --git a/DNN Platform/DotNetNuke.Instrumentation/DnnLoggingController.cs b/DNN Platform/DotNetNuke.Instrumentation/DnnLoggingController.cs new file mode 100644 index 00000000000..a067919f486 --- /dev/null +++ b/DNN Platform/DotNetNuke.Instrumentation/DnnLoggingController.cs @@ -0,0 +1,37 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace DotNetNuke.Instrumentation +{ + using Microsoft.Extensions.Logging; + using Serilog; + using Serilog.Extensions.Logging; + + /// + /// Provides centralized logging functionality for DNN Platform using Serilog. + /// + public class DnnLoggingController + { + /// + /// Gets a strongly-typed logger instance for the specified type. + /// + /// The type for which to create the logger. + /// An instance configured with Serilog. + /// + /// If Serilog has not been initialized, this method will automatically initialize it + /// using the application's host path before creating the logger. + /// + public static ILogger GetLogger() + { + if (Log.Logger == null) + { + // initialize Serilog + var hostMapPath = System.Web.Hosting.HostingEnvironment.MapPath("~"); + SerilogController.AddSerilog(hostMapPath); + } + + return new SerilogLoggerFactory(Log.Logger).CreateLogger(); + } + } +} From c4b173d7fb6ead01239917cac0246fc047ec7b05 Mon Sep 17 00:00:00 2001 From: Peter Donker Date: Sat, 28 Feb 2026 22:18:33 +0100 Subject: [PATCH 05/30] Implement new logic for JwtAuth project --- .../Auth/JwtAuthMessageHandler.cs | 11 +- .../Common/Controllers/JwtController.cs | 148 +++++------------- .../Schedule/PurgeExpiredTokensTask.cs | 10 +- 3 files changed, 53 insertions(+), 116 deletions(-) diff --git a/DNN Platform/Dnn.AuthServices.Jwt/Auth/JwtAuthMessageHandler.cs b/DNN Platform/Dnn.AuthServices.Jwt/Auth/JwtAuthMessageHandler.cs index 0c1fe57e098..6c24e69e88b 100644 --- a/DNN Platform/Dnn.AuthServices.Jwt/Auth/JwtAuthMessageHandler.cs +++ b/DNN Platform/Dnn.AuthServices.Jwt/Auth/JwtAuthMessageHandler.cs @@ -12,6 +12,7 @@ namespace Dnn.AuthServices.Jwt.Auth using Dnn.AuthServices.Jwt.Components.Common.Controllers; using DotNetNuke.Instrumentation; using DotNetNuke.Web.Api.Auth; + using Microsoft.Extensions.Logging; /// /// This class implements Json Web Token (JWT) authentication scheme. @@ -21,7 +22,7 @@ namespace Dnn.AuthServices.Jwt.Auth /// public class JwtAuthMessageHandler : AuthMessageHandlerBase { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(JwtAuthMessageHandler)); + private readonly ILogger logger; private readonly IJwtController jwtController = JwtController.Instance; @@ -35,6 +36,7 @@ public JwtAuthMessageHandler(bool includeByDefault, bool forceSsl) // ServicesRoutingManager.RegisterAuthenticationHandlers() // this scheme gets marked as enabled. IsEnabled = true; + this.logger = DnnLoggingController.GetLogger(); } /// @@ -64,17 +66,14 @@ private void TryToAuthenticate(HttpRequestMessage request) var username = this.jwtController.ValidateToken(request); if (!string.IsNullOrEmpty(username)) { - if (Logger.IsTraceEnabled) - { - Logger.Trace($"Authenticated user '{username}'"); - } + this.logger.LogTrace("Authenticated user '{userName}'", username); SetCurrentPrincipal(new GenericPrincipal(new GenericIdentity(username, this.AuthScheme), null), request); } } catch (Exception ex) { - Logger.Error("Unexpected error in authenticating the user. " + ex); + this.logger.LogError(ex, "Unexpected error in authenticating the user."); } } } diff --git a/DNN Platform/Dnn.AuthServices.Jwt/Components/Common/Controllers/JwtController.cs b/DNN Platform/Dnn.AuthServices.Jwt/Components/Common/Controllers/JwtController.cs index ce6072606ec..c71280ec0ac 100644 --- a/DNN Platform/Dnn.AuthServices.Jwt/Components/Common/Controllers/JwtController.cs +++ b/DNN Platform/Dnn.AuthServices.Jwt/Components/Common/Controllers/JwtController.cs @@ -9,6 +9,7 @@ namespace Dnn.AuthServices.Jwt.Components.Common.Controllers using System.Linq; using System.Net.Http; using System.Net.Http.Headers; + using System.Runtime.CompilerServices; using System.Security.Claims; using System.Security.Cryptography; using System.Text; @@ -23,7 +24,7 @@ namespace Dnn.AuthServices.Jwt.Components.Common.Controllers using DotNetNuke.Instrumentation; using DotNetNuke.Security.Membership; using DotNetNuke.Web.Api; - + using Microsoft.Extensions.Logging; using Microsoft.IdentityModel.JsonWebTokens; using Microsoft.IdentityModel.Tokens; @@ -38,7 +39,7 @@ internal class JwtController : ServiceLocator, IJ private const int DefaultRenewalTokenTtlMinutes = 20160; // in minutes = 14 days private const string SessionClaimType = "sid"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(JwtController)); + private static readonly ILogger Logger; private static readonly HashAlgorithm Hasher = SHA384.Create(); private static readonly Encoding TextEncoder = Encoding.UTF8; private static object hasherLock = new object(); @@ -47,6 +48,7 @@ internal class JwtController : ServiceLocator, IJ static JwtController() { ValidateConfiguration(); + Logger = DnnLoggingController.GetLogger(); } /// @@ -94,7 +96,7 @@ public string ValidateToken(HttpRequestMessage request) { if (!JwtAuthMessageHandler.IsEnabled) { - Logger.Trace(this.SchemeType + " is not registered/enabled in web.config file"); + Logger.LogTrace(this.SchemeType + " is not registered/enabled in web.config file"); return null; } @@ -107,7 +109,7 @@ public bool LogoutUser(HttpRequestMessage request) { if (!JwtAuthMessageHandler.IsEnabled) { - Logger.Trace(this.SchemeType + " is not registered/enabled in web.config file"); + Logger.LogTrace(this.SchemeType + " is not registered/enabled in web.config file"); return false; } @@ -121,10 +123,7 @@ public bool LogoutUser(HttpRequestMessage request) var sessionId = GetJwtSessionValue(jwt); if (string.IsNullOrEmpty(sessionId)) { - if (Logger.IsTraceEnabled) - { - Logger.Trace("Session ID not found in the claim"); - } + Logger.LogTrace("Session ID not found in the claim"); return false; } @@ -138,7 +137,7 @@ public LoginResultData LoginUser(HttpRequestMessage request, LoginData loginData { if (!JwtAuthMessageHandler.IsEnabled) { - Logger.Trace(this.SchemeType + " is not registered/enabled in web.config file"); + Logger.LogTrace(this.SchemeType + " is not registered/enabled in web.config file"); return EmptyWithError("disabled"); } @@ -146,7 +145,7 @@ public LoginResultData LoginUser(HttpRequestMessage request, LoginData loginData IPortalSettings portalSettings = obsoletePortalSettings; if (portalSettings == null) { - Logger.Trace("portalSettings = null"); + Logger.LogTrace("portalSettings = null"); return EmptyWithError("no-portal"); } @@ -165,7 +164,7 @@ public LoginResultData LoginUser(HttpRequestMessage request, LoginData loginData if (userInfo == null) { - Logger.Trace("user = null"); + Logger.LogTrace("user = null"); return EmptyWithError("bad-credentials"); } @@ -179,7 +178,7 @@ public LoginResultData LoginUser(HttpRequestMessage request, LoginData loginData if (!valid) { - Logger.Trace("login status = " + status); + Logger.LogTrace("login status {status}", status); return EmptyWithError("bad-credentials"); } @@ -225,7 +224,7 @@ public LoginResultData RenewToken(HttpRequestMessage request, string renewalToke { if (!JwtAuthMessageHandler.IsEnabled) { - Logger.Trace(this.SchemeType + " is not registered/enabled in web.config file"); + Logger.LogTrace(this.SchemeType + " is not registered/enabled in web.config file"); return EmptyWithError("disabled"); } @@ -244,10 +243,7 @@ public LoginResultData RenewToken(HttpRequestMessage request, string renewalToke var sessionId = GetJwtSessionValue(jwt); if (string.IsNullOrEmpty(sessionId)) { - if (Logger.IsTraceEnabled) - { - Logger.Trace("Session ID not found in the claim"); - } + Logger.LogTrace("Session ID {sessionId} not found in the claim", sessionId); return EmptyWithError("bad-claims"); } @@ -255,40 +251,28 @@ public LoginResultData RenewToken(HttpRequestMessage request, string renewalToke var persistedToken = this.DataProvider.GetTokenById(sessionId); if (persistedToken == null) { - if (Logger.IsTraceEnabled) - { - Logger.Trace("Token not found in DB"); - } + Logger.LogTrace("Token not found in DB"); return EmptyWithError("not-found"); } if (persistedToken.RenewalExpiry <= DateTime.UtcNow) { - if (Logger.IsTraceEnabled) - { - Logger.Trace("Token can't bwe renewed anymore"); - } + Logger.LogTrace("Token can't be renewed anymore"); return EmptyWithError("not-more-renewal"); } if (persistedToken.RenewalHash != GetHashedStr(renewalToken)) { - if (Logger.IsTraceEnabled) - { - Logger.Trace("Invalid renewal token"); - } + Logger.LogTrace("Invalid renewal token"); return EmptyWithError("bad-token"); } if (persistedToken.TokenHash != GetHashedStr(rawToken)) { - if (Logger.IsTraceEnabled) - { - Logger.Trace("Invalid access token"); - } + Logger.LogTrace("Invalid access token"); return EmptyWithError("bad-token"); } @@ -296,20 +280,14 @@ public LoginResultData RenewToken(HttpRequestMessage request, string renewalToke var userInfo = this.TryGetUser(jwt, false); if (userInfo == null) { - if (Logger.IsTraceEnabled) - { - Logger.Trace("User not found in DB"); - } + Logger.LogTrace("User not found in DB"); return EmptyWithError("not-found"); } if (persistedToken.UserId != userInfo.UserID) { - if (Logger.IsTraceEnabled) - { - Logger.Trace("Mismatch token and user"); - } + Logger.LogTrace("Mismatch token and user"); return EmptyWithError("bad-token"); } @@ -374,7 +352,7 @@ private static JsonWebToken GetAndValidateJwt(string rawToken, bool checkExpiry) } catch (Exception ex) { - Logger.Error("Unable to construct JWT object from authorization value. " + ex.Message); + Logger.LogError(ex, "Unable to construct JWT object from authorization value."); return null; } @@ -383,10 +361,7 @@ private static JsonWebToken GetAndValidateJwt(string rawToken, bool checkExpiry) var now = DateTime.UtcNow; if (now < jwt.ValidFrom || now > jwt.ValidTo) { - if (Logger.IsTraceEnabled) - { - Logger.Trace("Token is expired"); - } + Logger.LogTrace("Token is expired"); return null; } @@ -395,10 +370,7 @@ private static JsonWebToken GetAndValidateJwt(string rawToken, bool checkExpiry) var sessionId = GetJwtSessionValue(jwt); if (string.IsNullOrEmpty(sessionId)) { - if (Logger.IsTraceEnabled) - { - Logger.Trace("Invalid session ID claim"); - } + Logger.LogTrace("Invalid session ID {sessionId} claim", sessionId); return null; } @@ -456,7 +428,7 @@ private static void ValidateConfiguration() // Check if session token TTL exceeds renewal token TTL if (sessionTtl > renewalTtl) { - Logger.Warn( + Logger.LogWarning( $"JWT Configuration Warning: SessionTokenTtlMinutes ({sessionTtl} minutes) exceeds RenewalTokenTtlMinutes ({renewalTtl} minutes). " + $"Session tokens will be capped at the renewal period. This configuration may cause unexpected behavior. " + $"Please ensure SessionTokenTtlMinutes <= RenewalTokenTtlMinutes in web.config."); @@ -465,7 +437,7 @@ private static void ValidateConfiguration() // Warn about very short session tokens (less than 5 minutes) if (sessionTtl < 5) { - Logger.Warn( + Logger.LogWarning( $"JWT Configuration Warning: SessionTokenTtlMinutes is set to {sessionTtl} minutes, which is very short. " + $"This may cause frequent re-authentication requests. Recommended minimum: 15 minutes."); } @@ -473,7 +445,7 @@ private static void ValidateConfiguration() // Warn about very long session tokens (more than 24 hours) if (sessionTtl > 1440) { - Logger.Warn( + Logger.LogWarning( $"JWT Configuration Warning: SessionTokenTtlMinutes is set to {sessionTtl} minutes ({sessionTtl / 60} hours), which is very long. " + $"This may pose a security risk. Recommended maximum: 1440 minutes (24 hours)."); } @@ -481,7 +453,7 @@ private static void ValidateConfiguration() // Warn about very short renewal tokens (less than 1 hour) if (renewalTtl < 60) { - Logger.Warn( + Logger.LogWarning( $"JWT Configuration Warning: RenewalTokenTtlMinutes is set to {renewalTtl} minutes, which is very short. " + $"Users will need to re-login frequently. Recommended minimum: 1440 minutes (1 day)."); } @@ -489,13 +461,13 @@ private static void ValidateConfiguration() // Warn about very long renewal tokens (more than 90 days) if (renewalTtl > 129600) { - Logger.Warn( + Logger.LogWarning( $"JWT Configuration Warning: RenewalTokenTtlMinutes is set to {renewalTtl} minutes ({renewalTtl / 1440} days), which is very long. " + $"This may pose a security risk. Recommended maximum: 43200 minutes (30 days)."); } // Log the current configuration at info level - Logger.Info( + Logger.LogInformation( $"JWT Token Configuration: SessionTokenTtlMinutes={sessionTtl} ({sessionTtl / 60.0:F1} hours), " + $"RenewalTokenTtlMinutes={renewalTtl} ({renewalTtl / 1440.0:F1} days)"); } @@ -537,16 +509,13 @@ private string ValidateAuthHeader(AuthenticationHeaderValue authHdr) { if (authHdr == null) { - ////if (Logger.IsTraceEnabled) Logger.Trace("Authorization header not present in the request"); // too verbose; shows in all web requests + ////if (Logger.IsTraceEnabled) Logger.LogTrace("Authorization header not present in the request"); // too verbose; shows in all web requests return null; } if (!string.Equals(authHdr.Scheme, AuthScheme, StringComparison.CurrentCultureIgnoreCase)) { - if (Logger.IsTraceEnabled) - { - Logger.Trace("Authorization header scheme in the request is not equal to " + this.SchemeType); - } + Logger.LogTrace("Authorization header scheme in the request is not equal to " + this.SchemeType); return null; } @@ -554,10 +523,7 @@ private string ValidateAuthHeader(AuthenticationHeaderValue authHdr) var authorization = authHdr.Parameter; if (string.IsNullOrEmpty(authorization)) { - if (Logger.IsTraceEnabled) - { - Logger.Trace("Missing authorization header value in the request"); - } + Logger.LogTrace("Missing authorization header value in the request"); return null; } @@ -570,10 +536,7 @@ private string ValidateAuthorizationValue(string authorization) var parts = authorization.Split('.'); if (parts.Length < 3) { - if (Logger.IsTraceEnabled) - { - Logger.Trace("Token must have [header:claims:signature] parts at least"); - } + Logger.LogTrace("Token must have [header:claims:signature] parts at least"); return null; } @@ -581,10 +544,7 @@ private string ValidateAuthorizationValue(string authorization) var decoded = DecodeBase64(parts[0]); if (decoded.IndexOf("\"" + this.SchemeType + "\"", StringComparison.InvariantCultureIgnoreCase) < 0) { - if (Logger.IsTraceEnabled) - { - Logger.Trace($"This is not a {this.SchemeType} authentication scheme."); - } + Logger.LogTrace($"This is not a {this.SchemeType} authentication scheme."); return null; } @@ -608,10 +568,7 @@ private bool IsValidSchemeType(JsonWebToken token) { if (!this.SchemeType.Equals(token.Typ, StringComparison.OrdinalIgnoreCase)) { - if (Logger.IsTraceEnabled) - { - Logger.Trace("Unsupported authentication scheme type " + token.Typ); - } + Logger.LogTrace("Unsupported authentication scheme type " + token.Typ); return false; } @@ -626,10 +583,7 @@ private UserInfo TryGetUser(JsonWebToken jwt, bool checkExpiry) var persistedToken = this.DataProvider.GetTokenById(sessionId); if (persistedToken == null) { - if (Logger.IsTraceEnabled) - { - Logger.Trace("Token not found in DB"); - } + Logger.LogTrace("Token not found in DB"); return null; } @@ -639,10 +593,7 @@ private UserInfo TryGetUser(JsonWebToken jwt, bool checkExpiry) var now = DateTime.UtcNow; if (now > persistedToken.TokenExpiry || now > persistedToken.RenewalExpiry) { - if (Logger.IsTraceEnabled) - { - Logger.Trace("DB Token is expired"); - } + Logger.LogTrace("DB Token is expired"); return null; } @@ -650,10 +601,7 @@ private UserInfo TryGetUser(JsonWebToken jwt, bool checkExpiry) if (persistedToken.TokenHash != GetHashedStr(jwt.EncodedToken)) { - if (Logger.IsTraceEnabled) - { - Logger.Trace("Mismatch data in received token"); - } + Logger.LogTrace("Mismatch data in received token"); return null; } @@ -661,17 +609,14 @@ private UserInfo TryGetUser(JsonWebToken jwt, bool checkExpiry) var portalSettings = PortalController.Instance.GetCurrentSettings(); if (portalSettings == null) { - Logger.Trace("Unable to retrieve portal settings"); + Logger.LogTrace("Unable to retrieve portal settings"); return null; } var userInfo = UserController.GetUserById(portalSettings.PortalId, persistedToken.UserId); if (userInfo == null) { - if (Logger.IsTraceEnabled) - { - Logger.Trace("Invalid user"); - } + Logger.LogTrace("Invalid user {userId} for portal {portalId}", persistedToken.UserId, portalSettings.PortalId); return null; } @@ -684,30 +629,21 @@ private UserInfo TryGetUser(JsonWebToken jwt, bool checkExpiry) if (!valid) { - if (Logger.IsTraceEnabled) - { - Logger.Trace("Inactive user status: " + status); - } + Logger.LogTrace("Inactive user status {status}", status); return null; } if (!userInfo.Membership.Approved) { - if (Logger.IsTraceEnabled) - { - Logger.Trace("Non Approved user id: " + userInfo.UserID + " UserName: " + userInfo.Username); - } + Logger.LogTrace("Non Approved user id {userId} name {userName}", userInfo.UserID, userInfo.Username); return null; } if (userInfo.IsDeleted) { - if (Logger.IsTraceEnabled) - { - Logger.Trace("Deleted user id: " + userInfo.UserID + " UserName: " + userInfo.Username); - } + Logger.LogTrace("Deleted user id {userId} name {userName}", userInfo.UserID, userInfo.Username); return null; } diff --git a/DNN Platform/Dnn.AuthServices.Jwt/Components/Schedule/PurgeExpiredTokensTask.cs b/DNN Platform/Dnn.AuthServices.Jwt/Components/Schedule/PurgeExpiredTokensTask.cs index 5d2dfae6667..40575131081 100644 --- a/DNN Platform/Dnn.AuthServices.Jwt/Components/Schedule/PurgeExpiredTokensTask.cs +++ b/DNN Platform/Dnn.AuthServices.Jwt/Components/Schedule/PurgeExpiredTokensTask.cs @@ -10,17 +10,19 @@ namespace Dnn.AuthServices.Jwt.Components.Schedule using DotNetNuke.Instrumentation; using DotNetNuke.Services.Exceptions; using DotNetNuke.Services.Scheduling; + using Microsoft.Extensions.Logging; /// Scheduled task to delete tokens that linger in the database after having expired. public class PurgeExpiredTokensTask : SchedulerClient { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(PurgeExpiredTokensTask)); + private readonly ILogger logger; /// Initializes a new instance of the class. /// The object used to record the results from this task. public PurgeExpiredTokensTask(ScheduleHistoryItem objScheduleHistoryItem) { this.ScheduleHistoryItem = objScheduleHistoryItem; + this.logger = DnnLoggingController.GetLogger(); } /// Runs when the task is triggered by DNN. @@ -28,9 +30,9 @@ public override void DoWork() { try { - Logger.Info("Starting PurgeExpiredTokensTask"); + this.logger.LogInformation("Starting PurgeExpiredTokensTask"); DataService.Instance.DeleteExpiredTokens(); - Logger.Info("Finished PurgeExpiredTokensTask"); + this.logger.LogInformation("Finished PurgeExpiredTokensTask"); this.ScheduleHistoryItem.Succeeded = true; } catch (Exception exc) @@ -38,7 +40,7 @@ public override void DoWork() this.ScheduleHistoryItem.Succeeded = false; this.ScheduleHistoryItem.AddLogNote(string.Format("Purging expired tokens task failed: {0}.", exc.ToString())); this.Errored(ref exc); - Logger.ErrorFormat("Error in PurgeExpiredTokensTask: {0}. {1}", exc.Message, exc.StackTrace); + this.logger.LogError(exc, "Error in PurgeExpiredTokensTask"); Exceptions.LogException(exc); } } From 678e228a4d1a9ee50f02afc000b186aa78f629b2 Mon Sep 17 00:00:00 2001 From: Peter Donker Date: Sun, 1 Mar 2026 12:09:22 +0100 Subject: [PATCH 06/30] Update DNN Platform/Dnn.AuthServices.Jwt/Components/Common/Controllers/JwtController.cs Co-authored-by: Mitchel Sellers --- .../Components/Common/Controllers/JwtController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DNN Platform/Dnn.AuthServices.Jwt/Components/Common/Controllers/JwtController.cs b/DNN Platform/Dnn.AuthServices.Jwt/Components/Common/Controllers/JwtController.cs index c71280ec0ac..cec4ffb2d6f 100644 --- a/DNN Platform/Dnn.AuthServices.Jwt/Components/Common/Controllers/JwtController.cs +++ b/DNN Platform/Dnn.AuthServices.Jwt/Components/Common/Controllers/JwtController.cs @@ -96,7 +96,7 @@ public string ValidateToken(HttpRequestMessage request) { if (!JwtAuthMessageHandler.IsEnabled) { - Logger.LogTrace(this.SchemeType + " is not registered/enabled in web.config file"); + Logger.LogTrace("{SchemeType} is not registered/enabled in web.config file", this.SchemeType); return null; } From 51a0998eb4c2be9387cacb0dc8fd5e3524621922 Mon Sep 17 00:00:00 2001 From: Peter Donker Date: Sun, 1 Mar 2026 22:35:52 +0100 Subject: [PATCH 07/30] Fix position of adding logger in jwt controller --- .../Components/Common/Controllers/JwtController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DNN Platform/Dnn.AuthServices.Jwt/Components/Common/Controllers/JwtController.cs b/DNN Platform/Dnn.AuthServices.Jwt/Components/Common/Controllers/JwtController.cs index c71280ec0ac..85bd39a5e85 100644 --- a/DNN Platform/Dnn.AuthServices.Jwt/Components/Common/Controllers/JwtController.cs +++ b/DNN Platform/Dnn.AuthServices.Jwt/Components/Common/Controllers/JwtController.cs @@ -47,8 +47,8 @@ internal class JwtController : ServiceLocator, IJ /// Initializes static members of the class. static JwtController() { - ValidateConfiguration(); Logger = DnnLoggingController.GetLogger(); + ValidateConfiguration(); } /// From 0b2abbef3b2e918a54647f84ab3fa3e8621c2875 Mon Sep 17 00:00:00 2001 From: Peter Donker Date: Sun, 1 Mar 2026 22:36:30 +0100 Subject: [PATCH 08/30] Add default config --- .../SerilogController.cs | 18 +++++++++++++-- .../Website/Config/Serilog.default.config | 22 +++++++++++++++++++ .../Website/DotNetNuke.Website.csproj | 1 + 3 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 DNN Platform/Website/Config/Serilog.default.config diff --git a/DNN Platform/DotNetNuke.Instrumentation/SerilogController.cs b/DNN Platform/DotNetNuke.Instrumentation/SerilogController.cs index 4fd2f255062..56715941925 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/SerilogController.cs +++ b/DNN Platform/DotNetNuke.Instrumentation/SerilogController.cs @@ -22,8 +22,22 @@ internal static void AddSerilog(string hostMapPath) { var configFile = Path.Combine(hostMapPath, "Serilog.config"); var config = new LoggerConfiguration() - .WriteTo.File(Path.Combine(hostMapPath, "Portals\\_default\\Logs\\log.txt"), rollingInterval: RollingInterval.Day, formatProvider: CultureInfo.InvariantCulture) - .MinimumLevel.Debug(); + .WriteTo.File( + Path.Combine(hostMapPath, "Portals\\_default\\Logs\\log.txt"), + outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] [{SourceContext}] {Message:lj}{NewLine}{Exception}", + rollingInterval: RollingInterval.Day, + formatProvider: CultureInfo.InvariantCulture) + .MinimumLevel.Error(); + + if (!File.Exists(configFile)) + { + var defaultConfigFile = Path.Combine(hostMapPath, "Config", "Serilog.default.config"); + if (File.Exists(defaultConfigFile)) + { + File.Copy(defaultConfigFile, configFile); + } + } + if (File.Exists(configFile)) { config = new LoggerConfiguration() diff --git a/DNN Platform/Website/Config/Serilog.default.config b/DNN Platform/Website/Config/Serilog.default.config new file mode 100644 index 00000000000..14d6e26b95c --- /dev/null +++ b/DNN Platform/Website/Config/Serilog.default.config @@ -0,0 +1,22 @@ +{ + "Serilog": { + "Using": [ + "Serilog.Sinks.File" + ], + "MinimumLevel": { + "Default": "Error" + }, + "WriteTo": [ + { + "Name": "File", + "Args": { + "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] [{SourceContext}] {Message:lj}{NewLine}{Exception}", + "path": "%BASEDIR%/Portals/_default/Logs/log.txt", + "rollingInterval": "Day", + "flushToDiskInterval": "00:00:01", + "shared": true + } + } + ] + } +} diff --git a/DNN Platform/Website/DotNetNuke.Website.csproj b/DNN Platform/Website/DotNetNuke.Website.csproj index 10b705d515f..ab827feadef 100644 --- a/DNN Platform/Website/DotNetNuke.Website.csproj +++ b/DNN Platform/Website/DotNetNuke.Website.csproj @@ -1214,6 +1214,7 @@ + web.config From b285fdcb56b290b4dcca7e7070f599e505643637 Mon Sep 17 00:00:00 2001 From: Peter Donker Date: Sun, 1 Mar 2026 22:37:18 +0100 Subject: [PATCH 09/30] Add copying over .net dlls for Serilog --- .../DotNetNuke.Instrumentation.csproj | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/DNN Platform/DotNetNuke.Instrumentation/DotNetNuke.Instrumentation.csproj b/DNN Platform/DotNetNuke.Instrumentation/DotNetNuke.Instrumentation.csproj index 29125234088..64692ce2f02 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/DotNetNuke.Instrumentation.csproj +++ b/DNN Platform/DotNetNuke.Instrumentation/DotNetNuke.Instrumentation.csproj @@ -50,5 +50,25 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 4b351eb57713e8b1393a958219baf2ff1d60c60f Mon Sep 17 00:00:00 2001 From: Peter Donker Date: Sun, 1 Mar 2026 22:41:14 +0100 Subject: [PATCH 10/30] Roll back deprecation of LoggerSource for now --- DNN Platform/DotNetNuke.Instrumentation/ILog.cs | 5 +---- .../DotNetNuke.Instrumentation/ILoggerSource.cs | 5 +---- .../DotNetNuke.Instrumentation/LoggerSource.cs | 5 +---- .../DotNetNuke.Instrumentation/LoggerSourceImpl.cs | 10 ---------- 4 files changed, 3 insertions(+), 22 deletions(-) diff --git a/DNN Platform/DotNetNuke.Instrumentation/ILog.cs b/DNN Platform/DotNetNuke.Instrumentation/ILog.cs index e076c1849f8..f7fc6363f8b 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/ILog.cs +++ b/DNN Platform/DotNetNuke.Instrumentation/ILog.cs @@ -6,11 +6,8 @@ namespace DotNetNuke.Instrumentation using System; using System.Diagnostics.CodeAnalysis; - using DotNetNuke.Internal.SourceGenerators; - /// A contract specifying the ability to log information. - [DnnDeprecated(10, 3, 0, "Use Microsoft's ILogger instead", RemovalVersion = 12)] - public partial interface ILog + public interface ILog { /// Gets a value indicating whether the Debug log level is enabled. bool IsDebugEnabled { get; } diff --git a/DNN Platform/DotNetNuke.Instrumentation/ILoggerSource.cs b/DNN Platform/DotNetNuke.Instrumentation/ILoggerSource.cs index 95e616904d3..e4118b5afe6 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/ILoggerSource.cs +++ b/DNN Platform/DotNetNuke.Instrumentation/ILoggerSource.cs @@ -5,11 +5,8 @@ namespace DotNetNuke.Instrumentation { using System; - using DotNetNuke.Internal.SourceGenerators; - /// A contract specifying the ability to provide instances. - [DnnDeprecated(10, 3, 0, "Use Microsoft's ILogger instead", RemovalVersion = 12)] - public partial interface ILoggerSource + public interface ILoggerSource { /// Gets the logger for the given . /// The type providing the name for the logger instance. diff --git a/DNN Platform/DotNetNuke.Instrumentation/LoggerSource.cs b/DNN Platform/DotNetNuke.Instrumentation/LoggerSource.cs index f954784b2f5..f5081075acd 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/LoggerSource.cs +++ b/DNN Platform/DotNetNuke.Instrumentation/LoggerSource.cs @@ -4,11 +4,8 @@ namespace DotNetNuke.Instrumentation { - using DotNetNuke.Internal.SourceGenerators; - /// Provides access to an instance. - [DnnDeprecated(10, 3, 0, "Use Microsoft's ILogger instead", RemovalVersion = 12)] - public static partial class LoggerSource + public static class LoggerSource { /// Gets the instance. public static ILoggerSource Instance { get; private set; } = new LoggerSourceImpl(); diff --git a/DNN Platform/DotNetNuke.Instrumentation/LoggerSourceImpl.cs b/DNN Platform/DotNetNuke.Instrumentation/LoggerSourceImpl.cs index 70805b7e981..77e8118c2da 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/LoggerSourceImpl.cs +++ b/DNN Platform/DotNetNuke.Instrumentation/LoggerSourceImpl.cs @@ -8,35 +8,25 @@ namespace DotNetNuke.Instrumentation using System.Diagnostics.CodeAnalysis; using System.Globalization; - using DotNetNuke.Internal.SourceGenerators; using Serilog; /// An implementation. [SuppressMessage("Microsoft.Design", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix", Justification = "Breaking change")] - [DnnDeprecated(10, 3, 0, "Use Microsoft's ILogger instead", RemovalVersion = 12)] -#pragma warning disable CS0618 // Type or member is obsolete public partial class LoggerSourceImpl : ILoggerSource -#pragma warning restore CS0618 // Type or member is obsolete { /// -#pragma warning disable CS0618 // Type or member is obsolete public ILog GetLogger(Type type) -#pragma warning restore CS0618 // Type or member is obsolete { return new Logger(type); } /// -#pragma warning disable CS0618 // Type or member is obsolete public ILog GetLogger(string name) -#pragma warning restore CS0618 // Type or member is obsolete { return new Logger(null); } -#pragma warning disable CS0618 // Type or member is obsolete private sealed class Logger : ILog -#pragma warning restore CS0618 // Type or member is obsolete { private readonly ILogger logger; From f4d80f50ada71fc56f742928864446f563440f0c Mon Sep 17 00:00:00 2001 From: Peter Donker Date: Sun, 1 Mar 2026 22:44:07 +0100 Subject: [PATCH 11/30] Improve logging in JwtController --- .../Components/Common/Controllers/JwtController.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/DNN Platform/Dnn.AuthServices.Jwt/Components/Common/Controllers/JwtController.cs b/DNN Platform/Dnn.AuthServices.Jwt/Components/Common/Controllers/JwtController.cs index 02e2b3c58d7..3633e823d07 100644 --- a/DNN Platform/Dnn.AuthServices.Jwt/Components/Common/Controllers/JwtController.cs +++ b/DNN Platform/Dnn.AuthServices.Jwt/Components/Common/Controllers/JwtController.cs @@ -9,7 +9,6 @@ namespace Dnn.AuthServices.Jwt.Components.Common.Controllers using System.Linq; using System.Net.Http; using System.Net.Http.Headers; - using System.Runtime.CompilerServices; using System.Security.Claims; using System.Security.Cryptography; using System.Text; @@ -109,7 +108,7 @@ public bool LogoutUser(HttpRequestMessage request) { if (!JwtAuthMessageHandler.IsEnabled) { - Logger.LogTrace(this.SchemeType + " is not registered/enabled in web.config file"); + Logger.LogTrace("{SchemeType} is not registered/enabled in web.config file", this.SchemeType); return false; } @@ -137,7 +136,7 @@ public LoginResultData LoginUser(HttpRequestMessage request, LoginData loginData { if (!JwtAuthMessageHandler.IsEnabled) { - Logger.LogTrace(this.SchemeType + " is not registered/enabled in web.config file"); + Logger.LogTrace("{SchemeType} is not registered/enabled in web.config file", this.SchemeType); return EmptyWithError("disabled"); } @@ -224,7 +223,7 @@ public LoginResultData RenewToken(HttpRequestMessage request, string renewalToke { if (!JwtAuthMessageHandler.IsEnabled) { - Logger.LogTrace(this.SchemeType + " is not registered/enabled in web.config file"); + Logger.LogTrace("{SchemeType} is not registered/enabled in web.config file", this.SchemeType); return EmptyWithError("disabled"); } @@ -515,7 +514,7 @@ private string ValidateAuthHeader(AuthenticationHeaderValue authHdr) if (!string.Equals(authHdr.Scheme, AuthScheme, StringComparison.CurrentCultureIgnoreCase)) { - Logger.LogTrace("Authorization header scheme in the request is not equal to " + this.SchemeType); + Logger.LogTrace("Authorization header scheme in the request is not equal to {SchemeType}", this.SchemeType); return null; } @@ -544,7 +543,7 @@ private string ValidateAuthorizationValue(string authorization) var decoded = DecodeBase64(parts[0]); if (decoded.IndexOf("\"" + this.SchemeType + "\"", StringComparison.InvariantCultureIgnoreCase) < 0) { - Logger.LogTrace($"This is not a {this.SchemeType} authentication scheme."); + Logger.LogTrace("This is not a {SchemeType} authentication scheme.", this.SchemeType); return null; } @@ -568,7 +567,7 @@ private bool IsValidSchemeType(JsonWebToken token) { if (!this.SchemeType.Equals(token.Typ, StringComparison.OrdinalIgnoreCase)) { - Logger.LogTrace("Unsupported authentication scheme type " + token.Typ); + Logger.LogTrace("Unsupported authentication scheme type {Type}", token.Typ); return false; } From eb423547e67955adc65e81f59b71d741cbd0940e Mon Sep 17 00:00:00 2001 From: Peter Donker Date: Mon, 2 Mar 2026 14:57:06 +0100 Subject: [PATCH 12/30] Digging out of dll hell --- .../DotNetNuke.Instrumentation.csproj | 4 +- DNN Platform/Website/web.config | 72 +++++++++++++++++++ 2 files changed, 73 insertions(+), 3 deletions(-) diff --git a/DNN Platform/DotNetNuke.Instrumentation/DotNetNuke.Instrumentation.csproj b/DNN Platform/DotNetNuke.Instrumentation/DotNetNuke.Instrumentation.csproj index 64692ce2f02..38101d15884 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/DotNetNuke.Instrumentation.csproj +++ b/DNN Platform/DotNetNuke.Instrumentation/DotNetNuke.Instrumentation.csproj @@ -53,12 +53,11 @@ - + - @@ -67,7 +66,6 @@ - diff --git a/DNN Platform/Website/web.config b/DNN Platform/Website/web.config index 41704cdbf4e..abed03c15da 100644 --- a/DNN Platform/Website/web.config +++ b/DNN Platform/Website/web.config @@ -87,6 +87,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 5551266720a06e849b5806dbdeb113621d184731 Mon Sep 17 00:00:00 2001 From: Peter Donker Date: Mon, 2 Mar 2026 16:38:52 +0100 Subject: [PATCH 13/30] more dll hell --- .../DotNetNuke.Instrumentation.csproj | 6 ++ DNN Platform/Website/development.config | 92 +++++++++++++++++++ DNN Platform/Website/release.config | 92 +++++++++++++++++++ DNN Platform/Website/web.config | 24 +++++ 4 files changed, 214 insertions(+) diff --git a/DNN Platform/DotNetNuke.Instrumentation/DotNetNuke.Instrumentation.csproj b/DNN Platform/DotNetNuke.Instrumentation/DotNetNuke.Instrumentation.csproj index 38101d15884..0537578a8c4 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/DotNetNuke.Instrumentation.csproj +++ b/DNN Platform/DotNetNuke.Instrumentation/DotNetNuke.Instrumentation.csproj @@ -66,7 +66,13 @@ + + + + + + \ No newline at end of file diff --git a/DNN Platform/Website/development.config b/DNN Platform/Website/development.config index fdd20d613de..ffde2a2284a 100644 --- a/DNN Platform/Website/development.config +++ b/DNN Platform/Website/development.config @@ -281,6 +281,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DNN Platform/Website/release.config b/DNN Platform/Website/release.config index 031c8293596..82fdbac700b 100644 --- a/DNN Platform/Website/release.config +++ b/DNN Platform/Website/release.config @@ -278,6 +278,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DNN Platform/Website/web.config b/DNN Platform/Website/web.config index abed03c15da..2fad301d24a 100644 --- a/DNN Platform/Website/web.config +++ b/DNN Platform/Website/web.config @@ -151,14 +151,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + From 73b79f284edb4a0e88042120fabff91691aae2e7 Mon Sep 17 00:00:00 2001 From: Peter Donker Date: Mon, 2 Mar 2026 17:27:13 +0100 Subject: [PATCH 14/30] Hope fully last correction to packaging --- Build/Tasks/packaging.json | 6 ------ .../DotNetNuke.Instrumentation.csproj | 3 --- DNN Platform/Website/development.config | 10 +++++++--- DNN Platform/Website/release.config | 10 +++++++--- DNN Platform/Website/web.config | 6 +++--- 5 files changed, 17 insertions(+), 18 deletions(-) diff --git a/Build/Tasks/packaging.json b/Build/Tasks/packaging.json index 4a4d51aa504..1bdec750b8c 100644 --- a/Build/Tasks/packaging.json +++ b/Build/Tasks/packaging.json @@ -31,7 +31,6 @@ "/bin/BouncyCastle.Crypto.dll", "/bin/MailKit.dll", "/bin/MimeKit.dll", - "/bin/System.Buffers.dll", "/bin/System.Net.Http.Formatting.dll", "/bin/System.Web.Http.dll", "/bin/System.Web.Http.WebHost.dll", @@ -52,12 +51,7 @@ "/bin/BouncyCastle.Cryptography.dll", "/bin/Microsoft.Bcl.Memory.dll", "/bin/Microsoft.Bcl.TimeProvider.dll", - "/bin/System.Text.Encodings.Web.dll", - "/bin/System.Text.Json.dll", - "/bin/System.ValueTuple.dll", - "/bin/System.Numerics.Vectors.dll", "/bin/System.Formats.Asn1.dll", - "/bin/System.Memory.dll", "/Install/Module/DNNCE_Website.Deprecated_*_Install.zip", "/Install/Module/DNNCE_TelerikRemoval_*_Install.zip" ], diff --git a/DNN Platform/DotNetNuke.Instrumentation/DotNetNuke.Instrumentation.csproj b/DNN Platform/DotNetNuke.Instrumentation/DotNetNuke.Instrumentation.csproj index 0537578a8c4..fd7399b37d3 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/DotNetNuke.Instrumentation.csproj +++ b/DNN Platform/DotNetNuke.Instrumentation/DotNetNuke.Instrumentation.csproj @@ -66,10 +66,7 @@ - - - diff --git a/DNN Platform/Website/development.config b/DNN Platform/Website/development.config index ffde2a2284a..dd5e9d06a78 100644 --- a/DNN Platform/Website/development.config +++ b/DNN Platform/Website/development.config @@ -281,6 +281,10 @@ + + + + @@ -343,7 +347,7 @@ - + @@ -351,11 +355,11 @@ - + - + diff --git a/DNN Platform/Website/release.config b/DNN Platform/Website/release.config index 82fdbac700b..bf4e7b9d387 100644 --- a/DNN Platform/Website/release.config +++ b/DNN Platform/Website/release.config @@ -278,6 +278,10 @@ + + + + @@ -340,7 +344,7 @@ - + @@ -348,11 +352,11 @@ - + - + diff --git a/DNN Platform/Website/web.config b/DNN Platform/Website/web.config index 2fad301d24a..c2015c3ba35 100644 --- a/DNN Platform/Website/web.config +++ b/DNN Platform/Website/web.config @@ -153,7 +153,7 @@ - + @@ -161,11 +161,11 @@ - + - + From 98e7b2a146f9de2efdb7f9d6c519c99cfc4883af Mon Sep 17 00:00:00 2001 From: Peter Donker Date: Tue, 3 Mar 2026 20:10:47 +0100 Subject: [PATCH 15/30] Naming conventions --- .../DotNetNuke.Instrumentation/DnnLoggingController.cs | 4 ++-- .../DotNetNuke.Instrumentation/LoggerSourceImpl.cs | 4 ++-- .../DotNetNuke.Instrumentation/StartupExtensions.cs | 8 ++++---- DNN Platform/Library/Startup.cs | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/DNN Platform/DotNetNuke.Instrumentation/DnnLoggingController.cs b/DNN Platform/DotNetNuke.Instrumentation/DnnLoggingController.cs index a067919f486..8188edce3d3 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/DnnLoggingController.cs +++ b/DNN Platform/DotNetNuke.Instrumentation/DnnLoggingController.cs @@ -27,8 +27,8 @@ public static ILogger GetLogger() if (Log.Logger == null) { // initialize Serilog - var hostMapPath = System.Web.Hosting.HostingEnvironment.MapPath("~"); - SerilogController.AddSerilog(hostMapPath); + var applicationMapPath = System.Web.Hosting.HostingEnvironment.MapPath("~"); + SerilogController.AddSerilog(applicationMapPath); } return new SerilogLoggerFactory(Log.Logger).CreateLogger(); diff --git a/DNN Platform/DotNetNuke.Instrumentation/LoggerSourceImpl.cs b/DNN Platform/DotNetNuke.Instrumentation/LoggerSourceImpl.cs index 77e8118c2da..1841853b21f 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/LoggerSourceImpl.cs +++ b/DNN Platform/DotNetNuke.Instrumentation/LoggerSourceImpl.cs @@ -35,8 +35,8 @@ internal Logger(Type type) if (Log.Logger == null) { // initialize Serilog - var hostMapPath = System.Web.Hosting.HostingEnvironment.MapPath("~"); - SerilogController.AddSerilog(hostMapPath); + var applicationMapPath = System.Web.Hosting.HostingEnvironment.MapPath("~"); + SerilogController.AddSerilog(applicationMapPath); } if (type == null) diff --git a/DNN Platform/DotNetNuke.Instrumentation/StartupExtensions.cs b/DNN Platform/DotNetNuke.Instrumentation/StartupExtensions.cs index 8cb7ed577b9..68dd01dabad 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/StartupExtensions.cs +++ b/DNN Platform/DotNetNuke.Instrumentation/StartupExtensions.cs @@ -17,11 +17,11 @@ public static class StartupExtensions /// Add Serilog to the project. /// /// The IServiceCollection. - /// The path to the root of the DotNetNuke website. This is needed to find the correct directory to write the log files to. - public static void AddSerilog(this IServiceCollection services, string hostMapPath) + /// The path to the root of the DotNetNuke website. This is needed to find the correct directory to write the log files to. + public static void AddSerilog(this IServiceCollection services, string applicationMapPath) { - Environment.SetEnvironmentVariable("BASEDIR", hostMapPath); - SerilogController.AddSerilog(hostMapPath); + Environment.SetEnvironmentVariable("BASEDIR", applicationMapPath); + SerilogController.AddSerilog(applicationMapPath); services.AddLogging(loggingBuilder => loggingBuilder.AddSerilog(null, true)); } } diff --git a/DNN Platform/Library/Startup.cs b/DNN Platform/Library/Startup.cs index b0a35ea7a8c..cbacf24cd71 100644 --- a/DNN Platform/Library/Startup.cs +++ b/DNN Platform/Library/Startup.cs @@ -75,8 +75,8 @@ public void ConfigureServices(IServiceCollection services) { services.AddTransient(typeof(Lazy<>), typeof(LazyWrapper<>)); - var hostMapPath = System.Web.Hosting.HostingEnvironment.MapPath("~"); - services.AddSerilog(hostMapPath); + var applicationMapPath = System.Web.Hosting.HostingEnvironment.MapPath("~"); + services.AddSerilog(applicationMapPath); services.TryAddEnumerable(ServiceDescriptor.Singleton()); services.TryAddEnumerable(ServiceDescriptor.Singleton()); From fbd10fe83847b0f39fb145023c0f442f0cda2b23 Mon Sep 17 00:00:00 2001 From: Peter Donker Date: Tue, 3 Mar 2026 20:11:03 +0100 Subject: [PATCH 16/30] Add null check --- DNN Platform/DotNetNuke.Instrumentation/LoggerSourceImpl.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/DNN Platform/DotNetNuke.Instrumentation/LoggerSourceImpl.cs b/DNN Platform/DotNetNuke.Instrumentation/LoggerSourceImpl.cs index 1841853b21f..71a3b36bc1e 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/LoggerSourceImpl.cs +++ b/DNN Platform/DotNetNuke.Instrumentation/LoggerSourceImpl.cs @@ -86,7 +86,11 @@ public void Debug(object message) public void Debug(object message, Exception exception) { - if (message is string) + if (message == null) + { + this.logger.Debug(exception, exception.Message); + } + else if (message is string) { this.logger.Debug(exception, (string)message); } From 174da6d7ea6995e54d3ca146dd5d41a75286884d Mon Sep 17 00:00:00 2001 From: Peter Donker Date: Tue, 3 Mar 2026 20:11:27 +0100 Subject: [PATCH 17/30] Fixes to default serilog setup --- .../SerilogController.cs | 26 +++++++++++-------- .../Website/Config/Serilog.default.config | 2 +- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/DNN Platform/DotNetNuke.Instrumentation/SerilogController.cs b/DNN Platform/DotNetNuke.Instrumentation/SerilogController.cs index 56715941925..e6f51d511f4 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/SerilogController.cs +++ b/DNN Platform/DotNetNuke.Instrumentation/SerilogController.cs @@ -17,27 +17,21 @@ internal sealed class SerilogController /// /// Sets up Serilog using the config file ~/Serilog.config. /// - /// Path to the root of the DNN installation. - internal static void AddSerilog(string hostMapPath) + /// Path to the root of the DNN installation. + internal static void AddSerilog(string applicationMapPath) { - var configFile = Path.Combine(hostMapPath, "Serilog.config"); - var config = new LoggerConfiguration() - .WriteTo.File( - Path.Combine(hostMapPath, "Portals\\_default\\Logs\\log.txt"), - outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] [{SourceContext}] {Message:lj}{NewLine}{Exception}", - rollingInterval: RollingInterval.Day, - formatProvider: CultureInfo.InvariantCulture) - .MinimumLevel.Error(); + var configFile = Path.Combine(applicationMapPath, "Serilog.config"); if (!File.Exists(configFile)) { - var defaultConfigFile = Path.Combine(hostMapPath, "Config", "Serilog.default.config"); + var defaultConfigFile = Path.Combine(applicationMapPath, "Config", "Serilog.default.config"); if (File.Exists(defaultConfigFile)) { File.Copy(defaultConfigFile, configFile); } } + LoggerConfiguration config; if (File.Exists(configFile)) { config = new LoggerConfiguration() @@ -45,6 +39,16 @@ internal static void AddSerilog(string hostMapPath) .AddJsonFile(configFile, optional: false, reloadOnChange: true) .Build()); } + else + { + config = new LoggerConfiguration() + .WriteTo.File( + Path.Combine(applicationMapPath, "Portals\\_default\\Logs\\log.log.resources"), + outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] [{SourceContext}] {Message:lj}{NewLine}{Exception}", + rollingInterval: RollingInterval.Day, + formatProvider: CultureInfo.InvariantCulture) + .MinimumLevel.Error(); + } Log.Logger = config.CreateLogger(); } diff --git a/DNN Platform/Website/Config/Serilog.default.config b/DNN Platform/Website/Config/Serilog.default.config index 14d6e26b95c..a3682cc9981 100644 --- a/DNN Platform/Website/Config/Serilog.default.config +++ b/DNN Platform/Website/Config/Serilog.default.config @@ -11,7 +11,7 @@ "Name": "File", "Args": { "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] [{SourceContext}] {Message:lj}{NewLine}{Exception}", - "path": "%BASEDIR%/Portals/_default/Logs/log.txt", + "path": "%BASEDIR%/Portals/_default/Logs/log.log.resources", "rollingInterval": "Day", "flushToDiskInterval": "00:00:01", "shared": true From fb05c8f8b8b6faa329a9a20c1b8606bdfe126ecf Mon Sep 17 00:00:00 2001 From: Peter Donker Date: Tue, 3 Mar 2026 20:37:12 +0100 Subject: [PATCH 18/30] File naming --- DNN Platform/DotNetNuke.Instrumentation/SerilogController.cs | 2 +- DNN Platform/Website/Config/Serilog.default.config | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DNN Platform/DotNetNuke.Instrumentation/SerilogController.cs b/DNN Platform/DotNetNuke.Instrumentation/SerilogController.cs index e6f51d511f4..eb6265c143d 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/SerilogController.cs +++ b/DNN Platform/DotNetNuke.Instrumentation/SerilogController.cs @@ -43,7 +43,7 @@ internal static void AddSerilog(string applicationMapPath) { config = new LoggerConfiguration() .WriteTo.File( - Path.Combine(applicationMapPath, "Portals\\_default\\Logs\\log.log.resources"), + Path.Combine(applicationMapPath, "Portals\\_default\\Logs\\log.resources"), outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] [{SourceContext}] {Message:lj}{NewLine}{Exception}", rollingInterval: RollingInterval.Day, formatProvider: CultureInfo.InvariantCulture) diff --git a/DNN Platform/Website/Config/Serilog.default.config b/DNN Platform/Website/Config/Serilog.default.config index a3682cc9981..ab8e34a849e 100644 --- a/DNN Platform/Website/Config/Serilog.default.config +++ b/DNN Platform/Website/Config/Serilog.default.config @@ -11,7 +11,7 @@ "Name": "File", "Args": { "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] [{SourceContext}] {Message:lj}{NewLine}{Exception}", - "path": "%BASEDIR%/Portals/_default/Logs/log.log.resources", + "path": "%BASEDIR%/Portals/_default/Logs/log.resources", "rollingInterval": "Day", "flushToDiskInterval": "00:00:01", "shared": true From 5175cd4824120dc5619a65e3e5c70ec7743e3861 Mon Sep 17 00:00:00 2001 From: Peter Donker Date: Sun, 8 Mar 2026 23:14:36 +0100 Subject: [PATCH 19/30] Update versions in assembly binding redirects --- DNN Platform/Website/development.config | 6 +++--- DNN Platform/Website/release.config | 6 +++--- DNN Platform/Website/web.config | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/DNN Platform/Website/development.config b/DNN Platform/Website/development.config index dd5e9d06a78..be68dbec5fe 100644 --- a/DNN Platform/Website/development.config +++ b/DNN Platform/Website/development.config @@ -347,7 +347,7 @@ - + @@ -355,11 +355,11 @@ - + - + diff --git a/DNN Platform/Website/release.config b/DNN Platform/Website/release.config index bf4e7b9d387..0478be0285a 100644 --- a/DNN Platform/Website/release.config +++ b/DNN Platform/Website/release.config @@ -344,7 +344,7 @@ - + @@ -352,11 +352,11 @@ - + - + diff --git a/DNN Platform/Website/web.config b/DNN Platform/Website/web.config index c2015c3ba35..62209222815 100644 --- a/DNN Platform/Website/web.config +++ b/DNN Platform/Website/web.config @@ -153,7 +153,7 @@ - + @@ -161,11 +161,11 @@ - + - + From 040f7e56ed5c057cf1eb0805508a29c4f9e86245 Mon Sep 17 00:00:00 2001 From: Brian Dukes Date: Tue, 24 Mar 2026 13:23:32 -0500 Subject: [PATCH 20/30] Add ILogger migration helpers --- .../DnnLoggingController.cs | 48 +++++- .../LoggingMigrationExtensions.cs | 149 ++++++++++++++++++ 2 files changed, 191 insertions(+), 6 deletions(-) create mode 100644 DNN Platform/DotNetNuke.Instrumentation/LoggingMigrationExtensions.cs diff --git a/DNN Platform/DotNetNuke.Instrumentation/DnnLoggingController.cs b/DNN Platform/DotNetNuke.Instrumentation/DnnLoggingController.cs index 8188edce3d3..8c76c940c79 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/DnnLoggingController.cs +++ b/DNN Platform/DotNetNuke.Instrumentation/DnnLoggingController.cs @@ -4,18 +4,16 @@ namespace DotNetNuke.Instrumentation { + using System; + using Microsoft.Extensions.Logging; using Serilog; using Serilog.Extensions.Logging; - /// - /// Provides centralized logging functionality for DNN Platform using Serilog. - /// + /// Provides centralized logging functionality for DNN Platform using Serilog. public class DnnLoggingController { - /// - /// Gets a strongly-typed logger instance for the specified type. - /// + /// Gets a strongly-typed logger instance for the specified type. /// The type for which to create the logger. /// An instance configured with Serilog. /// @@ -33,5 +31,43 @@ public static ILogger GetLogger() return new SerilogLoggerFactory(Log.Logger).CreateLogger(); } + + /// Gets a strongly-typed logger instance for the specified type. + /// The type for which to create the logger. + /// An instance configured with Serilog. + /// + /// If Serilog has not been initialized, this method will automatically initialize it + /// using the application's host path before creating the logger. + /// + public static Microsoft.Extensions.Logging.ILogger GetLogger(Type type) + { + if (Log.Logger == null) + { + // initialize Serilog + var applicationMapPath = System.Web.Hosting.HostingEnvironment.MapPath("~"); + SerilogController.AddSerilog(applicationMapPath); + } + + return new SerilogLoggerFactory(Log.Logger).CreateLogger(type); + } + + /// Gets a strongly-typed logger instance for the specified type. + /// The category name to associated with the logger. + /// An instance configured with Serilog. + /// + /// If Serilog has not been initialized, this method will automatically initialize it + /// using the application's host path before creating the logger. + /// + public static Microsoft.Extensions.Logging.ILogger GetLogger(string categoryName) + { + if (Log.Logger == null) + { + // initialize Serilog + var applicationMapPath = System.Web.Hosting.HostingEnvironment.MapPath("~"); + SerilogController.AddSerilog(applicationMapPath); + } + + return new SerilogLoggerFactory(Log.Logger).CreateLogger(categoryName); + } } } diff --git a/DNN Platform/DotNetNuke.Instrumentation/LoggingMigrationExtensions.cs b/DNN Platform/DotNetNuke.Instrumentation/LoggingMigrationExtensions.cs new file mode 100644 index 00000000000..49f03f65341 --- /dev/null +++ b/DNN Platform/DotNetNuke.Instrumentation/LoggingMigrationExtensions.cs @@ -0,0 +1,149 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace DotNetNuke.Instrumentation +{ + using System; + + using Microsoft.Extensions.Logging; + + /// Provides extension methods to ease transition from to . + public static class LoggingMigrationExtensions + { + extension(ILogger logger) + { +#pragma warning disable CA1848 // Use the LoggerMessage delegates +#pragma warning disable CA2254 // Template should be a static expression +#pragma warning disable SA1101 // Prefix local calls with this + /// + public bool IsDebugEnabled => logger.IsEnabled(LogLevel.Debug); + + /// + public bool IsInfoEnabled => logger.IsEnabled(LogLevel.Information); + + /// + public bool IsTraceEnabled => logger.IsEnabled(LogLevel.Trace); + + /// + public bool IsWarnEnabled => logger.IsEnabled(LogLevel.Warning); + + /// + public bool IsErrorEnabled => logger.IsEnabled(LogLevel.Error); + + /// + public bool IsFatalEnabled => logger.IsEnabled(LogLevel.Critical); + + /// + public void Debug(object message) => logger.Debug(message?.ToString()); + + /// + public void Debug(string message) => logger.LogDebug(message); + + /// + public void Debug(object message, Exception exception) => logger.Debug(message?.ToString(), exception); + + /// + public void Debug(string message, Exception exception) => logger.LogDebug(exception, message); + + /// + public void DebugFormat(string format, params object[] args) => logger.LogDebug(format, args); + + /// + public void DebugFormat(IFormatProvider provider, string format, params object[] args) => logger.Debug(string.Format(provider, format, args)); + + /// + public void Info(object message) => logger.Info(message?.ToString()); + + /// + public void Info(string message) => logger.LogInformation(message); + + /// + public void Info(object message, Exception exception) => logger.Info(message?.ToString(), exception); + + /// + public void Info(string message, Exception exception) => logger.LogInformation(exception, message); + + /// + public void InfoFormat(string format, params object[] args) => logger.LogInformation(format, args); + + /// + public void InfoFormat(IFormatProvider provider, string format, params object[] args) => logger.Info(string.Format(provider, format, args)); + + /// + public void Trace(object message) => logger.Trace(message?.ToString()); + + /// + public void Trace(string message) => logger.LogTrace(message); + + /// + public void Trace(object message, Exception exception) => logger.Trace(message?.ToString(), exception); + + /// + public void Trace(string message, Exception exception) => logger.LogTrace(exception, message); + + /// + public void TraceFormat(string format, params object[] args) => logger.LogTrace(format, args); + + /// + public void TraceFormat(IFormatProvider provider, string format, params object[] args) => logger.Trace(string.Format(provider, format, args)); + + /// + public void Warn(object message) => logger.Warn(message?.ToString()); + + /// + public void Warn(string message) => logger.LogWarning(message); + + /// + public void Warn(object message, Exception exception) => logger.Warn(message?.ToString(), exception); + + /// + public void Warn(string message, Exception exception) => logger.LogWarning(exception, message); + + /// + public void WarnFormat(string format, params object[] args) => logger.LogWarning(format, args); + + /// + public void WarnFormat(IFormatProvider provider, string format, params object[] args) => logger.Warn(string.Format(provider, format, args)); + + /// + public void Error(object message) => logger.Error(message?.ToString()); + + /// + public void Error(string message) => logger.LogError(message); + + /// + public void Error(object message, Exception exception) => logger.Error(message?.ToString(), exception); + + /// + public void Error(string message, Exception exception) => logger.LogError(exception, message); + + /// + public void ErrorFormat(string format, params object[] args) => logger.LogError(format, args); + + /// + public void ErrorFormat(IFormatProvider provider, string format, params object[] args) => logger.Error(string.Format(provider, format, args)); + + /// + public void Fatal(object message) => logger.Fatal(message?.ToString()); + + /// + public void Fatal(string message) => logger.LogCritical(message); + + /// + public void Fatal(object message, Exception exception) => logger.Fatal(message?.ToString(), exception); + + /// + public void Fatal(string message, Exception exception) => logger.LogCritical(exception, message); + + /// + public void FatalFormat(string format, params object[] args) => logger.LogCritical(format, args); + + /// + public void FatalFormat(IFormatProvider provider, string format, params object[] args) => logger.Fatal(string.Format(provider, format, args)); + } + } +#pragma warning restore SA1101 // Prefix local calls with this +#pragma warning restore CA2254 // Template should be a static expression +#pragma warning restore CA1848 // Use the LoggerMessage delegates +} From 265f576be7f3a4cb21b0d75e14b1194fc9c5abfa Mon Sep 17 00:00:00 2001 From: Brian Dukes Date: Tue, 24 Mar 2026 13:23:53 -0500 Subject: [PATCH 21/30] Use ILogger in DotNetNuke.Maintenance --- .../Telerik/Removal/Startup.cs | 1 - .../Telerik/Removal/Steps/ClearCacheStep.cs | 12 +++++----- .../Telerik/Removal/Steps/DeleteFilesStep.cs | 16 ++++++------- .../Telerik/Removal/Steps/ExecuteSqlStep.cs | 12 +++++----- .../Steps/InstallAvailablePackageStep.cs | 20 +++++++--------- .../Removal/Steps/RemoveExtensionStep.cs | 12 +++++----- .../Steps/RemoveItemFromCollectionStep.cs | 9 +++---- .../RemoveTelerikBindingRedirectsStep.cs | 9 +++---- .../Steps/RemoveTelerikRewriterRulesStep.cs | 8 ++++--- .../Steps/ReplacePortalTabModuleStep.cs | 24 +++++++------------ .../Removal/Steps/ReplaceTabModuleStep.cs | 12 +++++----- .../Telerik/Removal/Steps/StepArrayBase.cs | 9 +++---- .../Telerik/Removal/Steps/StepBase.cs | 21 +++++++--------- .../Removal/Steps/UninstallPackageStep.cs | 20 +++++++--------- .../Telerik/Removal/Steps/XmlStepBase.cs | 14 +++++------ .../Telerik/TelerikUtils.cs | 15 ++++++------ 16 files changed, 98 insertions(+), 116 deletions(-) diff --git a/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Startup.cs b/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Startup.cs index b6f339d6f6a..28c20dc1b8d 100644 --- a/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Startup.cs +++ b/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Startup.cs @@ -32,7 +32,6 @@ public void ConfigureServices(IServiceCollection services) // core services.TryAddTransient(provider => LocalizationProvider.Instance); - services.TryAddTransient(provider => LoggerSource.Instance); services.TryAddTransient(provider => ModuleController.Instance); services.TryAddTransient(provider => PackageController.Instance); services.TryAddTransient(provider => TabController.Instance); diff --git a/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/ClearCacheStep.cs b/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/ClearCacheStep.cs index 8d2efeb8907..f9a00b09b0e 100644 --- a/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/ClearCacheStep.cs +++ b/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/ClearCacheStep.cs @@ -6,24 +6,24 @@ namespace DotNetNuke.Maintenance.Telerik.Steps { using System; - using DotNetNuke.Instrumentation; using DotNetNuke.Maintenance.Shims; using DotNetNuke.Maintenance.Telerik.Removal; + using Microsoft.Extensions.Logging; + /// internal sealed class ClearCacheStep : StepBase, IClearCacheStep { private readonly IDataCache dataCache; /// Initializes a new instance of the class. - /// An instance of . + /// An instance of . /// An instance of . /// An instance of . - public ClearCacheStep(ILoggerSource loggerSource, ILocalizer localizer, IDataCache dataCache) - : base(loggerSource, localizer) + public ClearCacheStep(ILogger logger, ILocalizer localizer, IDataCache dataCache) + : base(logger, localizer) { - this.dataCache = dataCache ?? - throw new ArgumentNullException(nameof(dataCache)); + this.dataCache = dataCache ?? throw new ArgumentNullException(nameof(dataCache)); this.Quiet = true; } diff --git a/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/DeleteFilesStep.cs b/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/DeleteFilesStep.cs index fcb6bb69179..ee2401f1bb7 100644 --- a/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/DeleteFilesStep.cs +++ b/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/DeleteFilesStep.cs @@ -8,10 +8,11 @@ namespace DotNetNuke.Maintenance.Telerik.Steps using System.IO; using DotNetNuke.Abstractions.Application; - using DotNetNuke.Instrumentation; using DotNetNuke.Maintenance.Shims; using DotNetNuke.Maintenance.Telerik.Removal; + using Microsoft.Extensions.Logging; + /// Deletes files. internal sealed class DeleteFilesStep : StepBase, IDeleteFilesStep { @@ -19,22 +20,19 @@ internal sealed class DeleteFilesStep : StepBase, IDeleteFilesStep private readonly IApplicationStatusInfo applicationStatusInfo; /// Initializes a new instance of the class. - /// An instance of . + /// An instance of . /// An instance of . /// An instance of . /// An instance of . public DeleteFilesStep( - ILoggerSource loggerSource, + ILogger logger, ILocalizer localizer, IFileSystemProvider fileSystemProvider, IApplicationStatusInfo applicationStatusInfo) - : base(loggerSource, localizer) + : base(logger, localizer) { - this.fileSystemProvider = fileSystemProvider ?? - throw new ArgumentNullException(nameof(fileSystemProvider)); - - this.applicationStatusInfo = applicationStatusInfo ?? - throw new ArgumentNullException(nameof(applicationStatusInfo)); + this.fileSystemProvider = fileSystemProvider ?? throw new ArgumentNullException(nameof(fileSystemProvider)); + this.applicationStatusInfo = applicationStatusInfo ?? throw new ArgumentNullException(nameof(applicationStatusInfo)); } /// diff --git a/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/ExecuteSqlStep.cs b/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/ExecuteSqlStep.cs index 86290e8058a..382267939ab 100644 --- a/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/ExecuteSqlStep.cs +++ b/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/ExecuteSqlStep.cs @@ -7,24 +7,24 @@ namespace DotNetNuke.Maintenance.Telerik.Steps using System; using System.Data; - using DotNetNuke.Instrumentation; using DotNetNuke.Maintenance.Shims; using DotNetNuke.Maintenance.Telerik.Removal; + using Microsoft.Extensions.Logging; + /// internal sealed class ExecuteSqlStep : StepBase, IExecuteSqlStep { private readonly IDataProvider dataProvider; /// Initializes a new instance of the class. - /// An instance of . + /// An instance of . /// An instance of . /// An instance of . - public ExecuteSqlStep(ILoggerSource loggerSource, ILocalizer localizer, IDataProvider dataProvider) - : base(loggerSource, localizer) + public ExecuteSqlStep(ILogger logger, ILocalizer localizer, IDataProvider dataProvider) + : base(logger, localizer) { - this.dataProvider = dataProvider ?? - throw new ArgumentNullException(nameof(dataProvider)); + this.dataProvider = dataProvider ?? throw new ArgumentNullException(nameof(dataProvider)); } /// diff --git a/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/InstallAvailablePackageStep.cs b/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/InstallAvailablePackageStep.cs index 16fa3549ff9..e8be28d96e8 100644 --- a/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/InstallAvailablePackageStep.cs +++ b/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/InstallAvailablePackageStep.cs @@ -10,12 +10,13 @@ namespace DotNetNuke.Maintenance.Telerik.Steps using DotNetNuke.Abstractions.Application; using DotNetNuke.Common.Utilities; - using DotNetNuke.Instrumentation; using DotNetNuke.Maintenance.Shims; using DotNetNuke.Maintenance.Telerik.Removal; using DotNetNuke.Services.Installer; using DotNetNuke.Services.Installer.Packages; + using Microsoft.Extensions.Logging; + /// internal sealed class InstallAvailablePackageStep : StepBase, IInstallAvailablePackageStep { @@ -24,27 +25,22 @@ internal sealed class InstallAvailablePackageStep : StepBase, IInstallAvailableP private readonly IPackageController packageController; /// Initializes a new instance of the class. - /// An instance of . + /// An instance of . /// An instance of . /// An instance of . /// An instance of . /// An instance of . public InstallAvailablePackageStep( - ILoggerSource loggerSource, + ILogger logger, ILocalizer localizer, IApplicationStatusInfo appStatusInfo, IFileSystemProvider fsProvider, IPackageController packageController) - : base(loggerSource, localizer) + : base(logger, localizer) { - this.appStatusInfo = appStatusInfo ?? - throw new ArgumentNullException(nameof(appStatusInfo)); - - this.fsProvider = fsProvider ?? - throw new ArgumentNullException(nameof(fsProvider)); - - this.packageController = packageController ?? - throw new ArgumentNullException(nameof(packageController)); + this.appStatusInfo = appStatusInfo ?? throw new ArgumentNullException(nameof(appStatusInfo)); + this.fsProvider = fsProvider ?? throw new ArgumentNullException(nameof(fsProvider)); + this.packageController = packageController ?? throw new ArgumentNullException(nameof(packageController)); } /// diff --git a/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/RemoveExtensionStep.cs b/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/RemoveExtensionStep.cs index 6271dc4e004..ff72307f99e 100644 --- a/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/RemoveExtensionStep.cs +++ b/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/RemoveExtensionStep.cs @@ -7,23 +7,23 @@ namespace DotNetNuke.Maintenance.Telerik.Steps using System; using System.Collections.Generic; - using DotNetNuke.Instrumentation; using DotNetNuke.Maintenance.Telerik.Removal; + using Microsoft.Extensions.Logging; + /// A container for an array of steps. internal sealed class RemoveExtensionStep : StepArrayBase, IRemoveExtensionStep { private readonly IServiceProvider serviceProvider; /// Initializes a new instance of the class. - /// An instance of . + /// An instance of . /// An instance of . /// An instance of . - public RemoveExtensionStep(ILoggerSource loggerSource, ILocalizer localizer, IServiceProvider serviceProvider) - : base(loggerSource, localizer) + public RemoveExtensionStep(ILogger logger, ILocalizer localizer, IServiceProvider serviceProvider) + : base(logger, localizer) { - this.serviceProvider = serviceProvider ?? - throw new ArgumentNullException(nameof(serviceProvider)); + this.serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider)); } /// diff --git a/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/RemoveItemFromCollectionStep.cs b/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/RemoveItemFromCollectionStep.cs index 00d14941c7d..8f99421f9ac 100644 --- a/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/RemoveItemFromCollectionStep.cs +++ b/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/RemoveItemFromCollectionStep.cs @@ -9,21 +9,22 @@ namespace DotNetNuke.Maintenance.Telerik.Steps using System.Xml; using DotNetNuke.Abstractions.Application; - using DotNetNuke.Instrumentation; using DotNetNuke.Maintenance.Telerik.Removal; + using Microsoft.Extensions.Logging; + /// internal sealed class RemoveItemFromCollectionStep : XmlStepBase, IRemoveItemFromCollectionStep { /// Initializes a new instance of the class. - /// An instance of . + /// An instance of . /// An instance of . /// An instance of . public RemoveItemFromCollectionStep( - ILoggerSource loggerSource, + ILogger logger, ILocalizer localizer, IApplicationStatusInfo applicationStatusInfo) - : base(loggerSource, localizer, applicationStatusInfo) + : base(logger, localizer, applicationStatusInfo) { } diff --git a/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/RemoveTelerikBindingRedirectsStep.cs b/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/RemoveTelerikBindingRedirectsStep.cs index f4682f818af..dcde621da7a 100644 --- a/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/RemoveTelerikBindingRedirectsStep.cs +++ b/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/RemoveTelerikBindingRedirectsStep.cs @@ -9,21 +9,22 @@ namespace DotNetNuke.Maintenance.Telerik.Steps using System.Xml; using DotNetNuke.Abstractions.Application; - using DotNetNuke.Instrumentation; using DotNetNuke.Maintenance.Telerik.Removal; + using Microsoft.Extensions.Logging; + /// internal sealed class RemoveTelerikBindingRedirectsStep : XmlStepBase, IRemoveTelerikBindingRedirectsStep { /// Initializes a new instance of the class. - /// An instance of . + /// An instance of . /// An instance of . /// An instance of . public RemoveTelerikBindingRedirectsStep( - ILoggerSource loggerSource, + ILogger logger, ILocalizer localizer, IApplicationStatusInfo applicationStatusInfo) - : base(loggerSource, localizer, applicationStatusInfo) + : base(logger, localizer, applicationStatusInfo) { } diff --git a/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/RemoveTelerikRewriterRulesStep.cs b/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/RemoveTelerikRewriterRulesStep.cs index 3b0dda46ed5..663de69fb12 100644 --- a/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/RemoveTelerikRewriterRulesStep.cs +++ b/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/RemoveTelerikRewriterRulesStep.cs @@ -12,18 +12,20 @@ namespace DotNetNuke.Maintenance.Telerik.Steps using DotNetNuke.Instrumentation; using DotNetNuke.Maintenance.Telerik.Removal; + using Microsoft.Extensions.Logging; + /// internal sealed class RemoveTelerikRewriterRulesStep : XmlStepBase, IRemoveTelerikRewriterRulesStep { /// Initializes a new instance of the class. - /// An instance of . + /// An instance of . /// An instance of . /// An instance of . public RemoveTelerikRewriterRulesStep( - ILoggerSource loggerSource, + ILogger logger, ILocalizer localizer, IApplicationStatusInfo applicationStatusInfo) - : base(loggerSource, localizer, applicationStatusInfo) + : base(logger, localizer, applicationStatusInfo) { } diff --git a/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/ReplacePortalTabModuleStep.cs b/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/ReplacePortalTabModuleStep.cs index 932a6e50a14..60684c5f6af 100644 --- a/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/ReplacePortalTabModuleStep.cs +++ b/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/ReplacePortalTabModuleStep.cs @@ -11,10 +11,11 @@ namespace DotNetNuke.Maintenance.Telerik.Steps using DotNetNuke.Common.Utilities; using DotNetNuke.Entities.Modules; using DotNetNuke.Entities.Tabs; - using DotNetNuke.Instrumentation; using DotNetNuke.Maintenance.Shims; using DotNetNuke.Maintenance.Telerik.Removal; + using Microsoft.Extensions.Logging; + /// internal sealed class ReplacePortalTabModuleStep : StepBase, IReplacePortalTabModuleStep { @@ -24,32 +25,25 @@ internal sealed class ReplacePortalTabModuleStep : StepBase, IReplacePortalTabMo private readonly IModuleDefinitionController moduleDefinitionController; /// Initializes a new instance of the class. - /// An instance of . + /// An instance of . /// An instance of . /// An instance of . /// An instance of . /// An instance of . /// An instance of . public ReplacePortalTabModuleStep( - ILoggerSource loggerSource, + ILogger logger, ILocalizer localizer, IModuleController moduleController, ITabController tabController, IDesktopModuleController desktopModuleController, IModuleDefinitionController moduleDefinitionController) - : base(loggerSource, localizer) + : base(logger, localizer) { - this.moduleController = moduleController ?? - throw new ArgumentNullException(nameof(moduleController)); - - this.tabController = tabController ?? - throw new ArgumentNullException(nameof(tabController)); - - this.desktopModuleController = desktopModuleController ?? - throw new ArgumentNullException(nameof(desktopModuleController)); - - this.moduleDefinitionController = moduleDefinitionController ?? - throw new ArgumentNullException(nameof(moduleDefinitionController)); + this.moduleController = moduleController ?? throw new ArgumentNullException(nameof(moduleController)); + this.tabController = tabController ?? throw new ArgumentNullException(nameof(tabController)); + this.desktopModuleController = desktopModuleController ?? throw new ArgumentNullException(nameof(desktopModuleController)); + this.moduleDefinitionController = moduleDefinitionController ?? throw new ArgumentNullException(nameof(moduleDefinitionController)); } /// diff --git a/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/ReplaceTabModuleStep.cs b/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/ReplaceTabModuleStep.cs index 50775a6b448..e482b7c48a9 100644 --- a/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/ReplaceTabModuleStep.cs +++ b/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/ReplaceTabModuleStep.cs @@ -11,9 +11,10 @@ namespace DotNetNuke.Maintenance.Telerik.Steps using DotNetNuke.Abstractions.Portals; using DotNetNuke.Entities.Portals; - using DotNetNuke.Instrumentation; using DotNetNuke.Maintenance.Telerik.Removal; + using Microsoft.Extensions.Logging; + /// internal sealed class ReplaceTabModuleStep : StepBase, IReplaceTabModuleStep, IStepArray { @@ -21,14 +22,13 @@ internal sealed class ReplaceTabModuleStep : StepBase, IReplaceTabModuleStep, IS private readonly List steps; /// Initializes a new instance of the class. - /// An instance of . + /// An instance of . /// An instance of . /// An instance of . - public ReplaceTabModuleStep(ILoggerSource loggerSource, ILocalizer localizer, IServiceProvider serviceProvider) - : base(loggerSource, localizer) + public ReplaceTabModuleStep(ILogger logger, ILocalizer localizer, IServiceProvider serviceProvider) + : base(logger, localizer) { - this.serviceProvider = serviceProvider ?? - throw new ArgumentNullException(nameof(serviceProvider)); + this.serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider)); this.steps = []; } diff --git a/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/StepArrayBase.cs b/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/StepArrayBase.cs index 98c22e37eda..51ff223ec38 100644 --- a/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/StepArrayBase.cs +++ b/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/StepArrayBase.cs @@ -6,17 +6,18 @@ namespace DotNetNuke.Maintenance.Telerik.Steps { using System.Collections.Generic; - using DotNetNuke.Instrumentation; using DotNetNuke.Maintenance.Telerik.Removal; + using Microsoft.Extensions.Logging; + /// A base class that implements . internal abstract class StepArrayBase : StepBase, IStepArray { /// Initializes a new instance of the class. - /// An instance of . + /// An instance of . /// An instance of . - public StepArrayBase(ILoggerSource loggerSource, ILocalizer localizer) - : base(loggerSource, localizer) + public StepArrayBase(ILogger logger, ILocalizer localizer) + : base(logger, localizer) { } diff --git a/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/StepBase.cs b/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/StepBase.cs index 76df5f98a63..4a673a435ae 100644 --- a/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/StepBase.cs +++ b/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/StepBase.cs @@ -11,25 +11,20 @@ namespace DotNetNuke.Maintenance.Telerik.Steps using DotNetNuke.Instrumentation; using DotNetNuke.Maintenance.Telerik.Removal; + using Microsoft.Extensions.Logging; + /// A base class that implements . internal abstract class StepBase : IStep { private readonly ILocalizer localizer; /// Initializes a new instance of the class. - /// An instance of . + /// An instance of . /// An instance of . - public StepBase(ILoggerSource loggerSource, ILocalizer localizer) + public StepBase(ILogger logger, ILocalizer localizer) { - if (loggerSource is null) - { - throw new ArgumentNullException(nameof(loggerSource)); - } - - this.Log = loggerSource.GetLogger(this.GetType()); - - this.localizer = localizer ?? - throw new ArgumentNullException(nameof(localizer)); + this.Log = logger ?? throw new ArgumentNullException(nameof(logger)); + this.localizer = localizer ?? throw new ArgumentNullException(nameof(localizer)); } /// @@ -44,8 +39,8 @@ public StepBase(ILoggerSource loggerSource, ILocalizer localizer) /// public bool Quiet { get; protected set; } - /// Gets an instance of specific to steps. - protected ILog Log { get; private set; } + /// Gets an instance of specific to steps. + protected ILogger Log { get; private set; } /// public void Execute() diff --git a/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/UninstallPackageStep.cs b/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/UninstallPackageStep.cs index bb3b2dc7e58..9aa79b46fe5 100644 --- a/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/UninstallPackageStep.cs +++ b/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/UninstallPackageStep.cs @@ -9,11 +9,12 @@ namespace DotNetNuke.Maintenance.Telerik.Steps using DotNetNuke.Abstractions.Application; using DotNetNuke.Common.Utilities; - using DotNetNuke.Instrumentation; using DotNetNuke.Maintenance.Shims; using DotNetNuke.Maintenance.Telerik.Removal; using DotNetNuke.Services.Installer.Packages; + using Microsoft.Extensions.Logging; + /// internal sealed class UninstallPackageStep : StepBase, IUninstallPackageStep { @@ -22,27 +23,22 @@ internal sealed class UninstallPackageStep : StepBase, IUninstallPackageStep private readonly Func installerFactory; /// Initializes a new instance of the class. - /// An instance of . + /// An instance of . /// An instance of . /// An instance of . /// An instance of . /// A function that returns an instance of . public UninstallPackageStep( - ILoggerSource loggerSource, + ILogger logger, ILocalizer localizer, IPackageController packageController, IApplicationStatusInfo applicationStatusInfo, Func installerFactory) - : base(loggerSource, localizer) + : base(logger, localizer) { - this.packageController = packageController ?? - throw new ArgumentNullException(nameof(packageController)); - - this.applicationStatusInfo = applicationStatusInfo ?? - throw new ArgumentNullException(nameof(applicationStatusInfo)); - - this.installerFactory = installerFactory ?? - throw new ArgumentNullException(nameof(installerFactory)); + this.packageController = packageController ?? throw new ArgumentNullException(nameof(packageController)); + this.applicationStatusInfo = applicationStatusInfo ?? throw new ArgumentNullException(nameof(applicationStatusInfo)); + this.installerFactory = installerFactory ?? throw new ArgumentNullException(nameof(installerFactory)); } /// diff --git a/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/XmlStepBase.cs b/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/XmlStepBase.cs index 8b1ce9787ca..675ade1d1e0 100644 --- a/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/XmlStepBase.cs +++ b/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/XmlStepBase.cs @@ -9,26 +9,26 @@ namespace DotNetNuke.Maintenance.Telerik.Steps using System.Xml; using DotNetNuke.Abstractions.Application; - using DotNetNuke.Instrumentation; using DotNetNuke.Maintenance.Telerik.Removal; - /// + using Microsoft.Extensions.Logging; + + /// internal abstract class XmlStepBase : StepBase, IXmlStep { private readonly IApplicationStatusInfo applicationStatusInfo; /// Initializes a new instance of the class. - /// An instance of . + /// An instance of . /// An instance of . /// An instance of . public XmlStepBase( - ILoggerSource loggerSource, + ILogger logger, ILocalizer localizer, IApplicationStatusInfo applicationStatusInfo) - : base(loggerSource, localizer) + : base(logger, localizer) { - this.applicationStatusInfo = applicationStatusInfo ?? - throw new ArgumentNullException(nameof(applicationStatusInfo)); + this.applicationStatusInfo = applicationStatusInfo ?? throw new ArgumentNullException(nameof(applicationStatusInfo)); } /// diff --git a/DNN Platform/DotNetNuke.Maintenance/Telerik/TelerikUtils.cs b/DNN Platform/DotNetNuke.Maintenance/Telerik/TelerikUtils.cs index 99696036172..bf5c82c774b 100644 --- a/DNN Platform/DotNetNuke.Maintenance/Telerik/TelerikUtils.cs +++ b/DNN Platform/DotNetNuke.Maintenance/Telerik/TelerikUtils.cs @@ -12,6 +12,8 @@ namespace DotNetNuke.Maintenance.Telerik using DotNetNuke.Abstractions.Application; using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + /// public class TelerikUtils : ITelerikUtils { @@ -33,18 +35,15 @@ public class TelerikUtils : ITelerikUtils }; private readonly IApplicationStatusInfo applicationStatusInfo; - private readonly ILog log; + private readonly ILogger log; /// Initializes a new instance of the class. /// An instance of . - /// An instance of . - public TelerikUtils( - IApplicationStatusInfo applicationStatusInfo, - ILoggerSource loggerSource) + /// An instance of . + public TelerikUtils(IApplicationStatusInfo applicationStatusInfo, ILogger logger) { - this.applicationStatusInfo = applicationStatusInfo - ?? throw new ArgumentNullException(nameof(applicationStatusInfo)); - this.log = loggerSource.GetLogger(nameof(TelerikUtils)); + this.applicationStatusInfo = applicationStatusInfo ?? throw new ArgumentNullException(nameof(applicationStatusInfo)); + this.log = logger ?? throw new ArgumentNullException(nameof(logger)); } /// From 001ccb3c0de75bdfa9648389737d877cfe4d128d Mon Sep 17 00:00:00 2001 From: Brian Dukes Date: Tue, 24 Mar 2026 13:39:09 -0500 Subject: [PATCH 22/30] Add ILogger to Dnn.PersonaBar.Security.Components.Checks.BaseCheck --- .../Components/Security/Checks/BaseCheck.cs | 29 ++++++++++++++----- .../Security/Checks/CheckTelerikPresence.cs | 17 ++++++----- .../Security/Checks/CheckUserProfilePage.cs | 10 +++++-- .../Checks/CheckTelerikPresenceTests.cs | 11 ++++--- .../Checks/CheckUserProfilePageTests.cs | 12 ++++++++ 5 files changed, 57 insertions(+), 22 deletions(-) diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Security/Checks/BaseCheck.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Security/Checks/BaseCheck.cs index c82c23fb94c..522df53eaf8 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Security/Checks/BaseCheck.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Security/Checks/BaseCheck.cs @@ -1,7 +1,7 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information - +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + namespace Dnn.PersonaBar.Security.Components.Checks { using System; @@ -9,15 +9,27 @@ namespace Dnn.PersonaBar.Security.Components.Checks using DotNetNuke.Instrumentation; using DotNetNuke.Services.Localization; + using Microsoft.Extensions.Logging; + /// Base class for security checks. public abstract class BaseCheck : IAuditCheck { - private readonly Lazy logger; + private readonly Lazy log; + private readonly ILogger logger; /// Initializes a new instance of the class. + [Obsolete("Deprecated in DotNetNuke 10.4.0. Use overload with ILogger. Scheduled removal in v12.0.0.")] public BaseCheck() + : this(null) + { + } + + /// Initializes a new instance of the class. + /// The logger. + public BaseCheck(ILogger logger) { - this.logger = new Lazy(() => LoggerSource.Instance.GetLogger(this.GetType())); + this.log = new Lazy(() => LoggerSource.Instance.GetLogger(this.GetType())); + this.logger = logger ?? DnnLoggingController.GetLogger(this.GetType()); } /// @@ -31,7 +43,8 @@ public BaseCheck() "~/DesktopModules/admin/Dnn.PersonaBar/Modules/Dnn.Security/App_LocalResources/Security.resx"; /// Gets a typed instance of the interface. - protected virtual ILog Logger => this.logger.Value; + [Obsolete("Deprecated in DotNetNuke 10.4.0. Use Microsoft.Extensions.Logging.ILogger. Scheduled removal in v12.0.0.")] + protected virtual ILog Logger => this.log.Value; /// public virtual CheckResult Execute() @@ -42,7 +55,7 @@ public virtual CheckResult Execute() } catch (Exception ex) { - this.Logger.Error($"{this.Id} failed.", ex); + this.logger.Error($"{this.Id} failed.", ex); return this.Unverified("An internal error occurred. See logs for details."); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Security/Checks/CheckTelerikPresence.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Security/Checks/CheckTelerikPresence.cs index ced3a6e9464..843149b6b6f 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Security/Checks/CheckTelerikPresence.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Security/Checks/CheckTelerikPresence.cs @@ -12,6 +12,7 @@ namespace Dnn.PersonaBar.Security.Components.Checks using DotNetNuke.Maintenance.Telerik; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// /// Check for Telerik presence in the site. @@ -26,19 +27,19 @@ public class CheckTelerikPresence : BaseCheck /// Initializes a new instance of the class. public CheckTelerikPresence() - : this(Globals.GetCurrentServiceProvider().GetRequiredService()) + : this( + Globals.GetCurrentServiceProvider().GetRequiredService>(), + Globals.GetCurrentServiceProvider().GetRequiredService()) { } /// Initializes a new instance of the class. - /// - /// An instance of the interface. - /// - internal CheckTelerikPresence(ITelerikUtils telerikUtils) - : base() + /// An instance of the interface. + /// An instance of the interface. + internal CheckTelerikPresence(ILogger logger, ITelerikUtils telerikUtils) + : base(logger ?? throw new ArgumentNullException(nameof(logger))) { - this.telerikUtils = telerikUtils ?? - throw new ArgumentNullException(nameof(telerikUtils)); + this.telerikUtils = telerikUtils ?? throw new ArgumentNullException(nameof(telerikUtils)); } /// diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Security/Checks/CheckUserProfilePage.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Security/Checks/CheckUserProfilePage.cs index 13e7afc12c5..c268da0250b 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Security/Checks/CheckUserProfilePage.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Security/Checks/CheckUserProfilePage.cs @@ -13,6 +13,9 @@ namespace Dnn.PersonaBar.Security.Components.Checks using DotNetNuke.Common; using DotNetNuke.Entities.Portals; using DotNetNuke.Entities.Tabs; + using DotNetNuke.Instrumentation; + + using Microsoft.Extensions.Logging; /// /// A security check for permissions on the User Profile page defined in @@ -47,25 +50,28 @@ public class CheckUserProfilePage : BaseCheck /// Initializes a new instance of the class. [Obsolete("Deprecated in DotNetNuke 10.0.0. Please use overload with IPagesController. Scheduled removal in v12.0.0.")] public CheckUserProfilePage() - : this(PortalController.Instance, TabController.Instance, PagesController.Instance) + : this(PagesController.Instance) { } /// Initializes a new instance of the class. /// An instance of the interface. public CheckUserProfilePage(IPagesController pagesController) - : this(PortalController.Instance, TabController.Instance, pagesController) + : this(DnnLoggingController.GetLogger(), PortalController.Instance, TabController.Instance, pagesController) { } /// Initializes a new instance of the class. + /// An instance of the interface. /// An instance of the interface. /// An instance of the interface. /// An instance of the interface. internal CheckUserProfilePage( + ILogger logger, IPortalController portalController, ITabController tabController, IPagesController pagesController) + : base(logger ?? throw new ArgumentNullException(nameof(logger))) { this.tabController = tabController ?? throw new ArgumentNullException(nameof(tabController)); this.pagesController = pagesController ?? throw new ArgumentNullException(nameof(pagesController)); diff --git a/Dnn.AdminExperience/Tests/Dnn.PersonaBar.Security.Tests/Checks/CheckTelerikPresenceTests.cs b/Dnn.AdminExperience/Tests/Dnn.PersonaBar.Security.Tests/Checks/CheckTelerikPresenceTests.cs index b4ac5fb52ec..845049ed35b 100644 --- a/Dnn.AdminExperience/Tests/Dnn.PersonaBar.Security.Tests/Checks/CheckTelerikPresenceTests.cs +++ b/Dnn.AdminExperience/Tests/Dnn.PersonaBar.Security.Tests/Checks/CheckTelerikPresenceTests.cs @@ -11,6 +11,9 @@ namespace Dnn.PersonaBar.Security.Tests.Checks using DotNetNuke.Maintenance.Telerik; using DotNetNuke.Tests.Utilities.Fakes; + using Microsoft.Extensions.Logging; + using Microsoft.Extensions.Logging.Abstractions; + using Moq; using NUnit.Framework; @@ -41,7 +44,7 @@ public void Execute_WhenError_ReturnsUnverified() .Setup(x => x.TelerikIsInstalled()) .Throws(); - var sut = new CheckTelerikPresence(telerikUtilsMock.Object); + var sut = new CheckTelerikPresence(NullLogger.Instance, telerikUtilsMock.Object); // act var result = sut.Execute(); @@ -73,7 +76,7 @@ public void Execute_WhenInstalledAndUsed_ReturnsInstalledAndUsed() .SetupGet(x => x.BinPath) .Returns("bin"); - var sut = new CheckTelerikPresence(telerikUtilsMock.Object); + var sut = new CheckTelerikPresence(NullLogger.Instance, telerikUtilsMock.Object); // act var result = sut.Execute(); @@ -101,7 +104,7 @@ public void Execute_WhenInstalledButNotUsed_ReturnsInstalledButNotUsed() .Setup(x => x.GetAssembliesThatDependOnTelerik()) .Returns(() => []); - var sut = new CheckTelerikPresence(telerikUtilsMock.Object); + var sut = new CheckTelerikPresence(NullLogger.Instance, telerikUtilsMock.Object); // act var result = sut.Execute(); @@ -124,7 +127,7 @@ public void Execute_WhenNotInstalled_ReturnsNotInstalled() .Setup(x => x.TelerikIsInstalled()) .Returns(false); - var sut = new CheckTelerikPresence(telerikUtilsMock.Object); + var sut = new CheckTelerikPresence(NullLogger.Instance, telerikUtilsMock.Object); // act var result = sut.Execute(); diff --git a/Dnn.AdminExperience/Tests/Dnn.PersonaBar.Security.Tests/Checks/CheckUserProfilePageTests.cs b/Dnn.AdminExperience/Tests/Dnn.PersonaBar.Security.Tests/Checks/CheckUserProfilePageTests.cs index 2578f504b0c..924fe48dc26 100644 --- a/Dnn.AdminExperience/Tests/Dnn.PersonaBar.Security.Tests/Checks/CheckUserProfilePageTests.cs +++ b/Dnn.AdminExperience/Tests/Dnn.PersonaBar.Security.Tests/Checks/CheckUserProfilePageTests.cs @@ -20,6 +20,10 @@ using DotNetNuke.Entities.Tabs; using DotNetNuke.Security.Permissions; using DotNetNuke.Security.Roles; + + using Microsoft.Extensions.Logging; + using Microsoft.Extensions.Logging.Abstractions; + using Moq; using NUnit.Framework; @@ -43,6 +47,7 @@ public void Constructor_WhenArgumentIsNull_ThrowsArgumentNullException(string nu try { new CheckUserProfilePage( + NullLogger.Instance, nullParamName == "portalController" ? null : new Mock().Object, nullParamName == "tabController" ? null : new Mock().Object, nullParamName == "pagesController" ? null : new Mock().Object); @@ -74,6 +79,7 @@ public void Execute_WhenNotFound_ReturnsPass() var pagesControllerMock = new Mock(); var sut = new CheckUserProfilePage( + NullLogger.Instance, portalControllerMock.Object, tabControllerMock.Object, pagesControllerMock.Object); @@ -96,6 +102,7 @@ public void Execute_WhenDeleted_ReturnsPass() var pagesControllerMock = new Mock(); var sut = new CheckUserProfilePage( + NullLogger.Instance, portalControllerMock.Object, tabControllerMock.Object, pagesControllerMock.Object); @@ -119,6 +126,7 @@ public void Execute_WhenPublic_ReturnsWarning() var pagesControllerMock = SetupPagesControllerMock(userProfilePageIsPublic: true); var sut = new CheckUserProfilePage( + NullLogger.Instance, portalControllerMock.Object, tabControllerMock.Object, pagesControllerMock.Object); @@ -142,6 +150,7 @@ public void Execute_WhenNeitherPublicNorActivityFeed_ReturnsPass() var pagesControllerMock = SetupPagesControllerMock(userProfilePageIsPublic: false); var sut = new CheckUserProfilePage( + NullLogger.Instance, portalControllerMock.Object, tabControllerMock.Object, pagesControllerMock.Object); @@ -165,6 +174,7 @@ public void Execute_WhenNotPublicAndActivityFeedAndMyProfileNotFound_ReturnsPass var pagesControllerMock = SetupPagesControllerMock(userProfilePageIsPublic: false); var sut = new CheckUserProfilePage( + NullLogger.Instance, portalControllerMock.Object, tabControllerMock.Object, pagesControllerMock.Object); @@ -189,6 +199,7 @@ public void Execute_WhenNotPublicAndActivityFeedAndMyProfileDeleted_ReturnsPass( var pagesControllerMock = SetupPagesControllerMock(userProfilePageIsPublic: false); var sut = new CheckUserProfilePage( + NullLogger.Instance, portalControllerMock.Object, tabControllerMock.Object, pagesControllerMock.Object); @@ -216,6 +227,7 @@ public void Execute_WhenNotPublicAndActivityFeedAndMyProfileValid_ReturnsCorrect var pagesControllerMock = SetupPagesControllerMock(false, myProfilePageIsPublic); var sut = new CheckUserProfilePage( + NullLogger.Instance, portalControllerMock.Object, tabControllerMock.Object, pagesControllerMock.Object); From 74c7c6ea29c272e6bab29e946ddef8fa0c7b03a3 Mon Sep 17 00:00:00 2001 From: Brian Dukes Date: Tue, 24 Mar 2026 13:43:34 -0500 Subject: [PATCH 23/30] Remove LoggerSource usages --- .../Dnn.Modules.Console/Settings.ascx.cs | 4 +- .../Dnn.Modules.Console/ViewConsole.ascx.cs | 3 +- .../Extensions/TypeExtensions.cs | 4 +- .../DotNetNuke.Instrumentation/DnnLog.cs | 6 +- .../DotNetNuke.Instrumentation/DnnLogger.cs | 4 +- .../ModuleControlPipeline.cs | 5 +- .../ClientResourceController.cs | 4 +- .../ClientResourceManager.cs | 3 +- .../ClientResourceSettings.cs | 10 +- .../DependencyInjection.cs | 2 +- .../Extensions/StartupExtensions.cs | 3 +- .../Routing/MvcRoutingManager.cs | 4 +- .../StandardTabAndModuleInfoProvider.cs | 4 +- .../Api/Auth/ApiTokenAuthMessageHandler.cs | 4 +- .../Api/Auth/ApiTokens/ApiTokenController.cs | 3 +- .../Api/Auth/AuthMessageHandlerBase.cs | 4 +- .../Api/Extensions/StartupExtensions.cs | 3 +- .../Api/Internal/ServicesRoutingManager.cs | 3 +- .../Api/StandardTabAndModuleInfoProvider.cs | 4 +- .../DotNetNuke.Web/Api/TraceWriter.cs | 4 +- .../Common/DotNetNukeHttpApplication.cs | 4 +- .../Common/DotNetNukeSecurity.cs | 2 +- .../Common/DotNetNukeShutdownOverload.cs | 4 +- .../DependencyInjection/BuildUpExtensions.cs | 4 +- .../DependencyInjectionInitialize.cs | 3 +- .../InternalServices/ControlBarController.cs | 3 +- .../EventLogServiceController.cs | 3 +- .../InternalServices/FileUploadController.cs | 3 +- .../ItemListServiceController.cs | 3 +- .../MessagingServiceController.cs | 3 +- .../ModuleServiceController.cs | 3 +- .../NotificationsServiceController.cs | 4 +- .../RelationshipServiceController.cs | 3 +- .../InternalServices/UserFileController.cs | 4 +- .../DotNetNuke.Web/UI/RibbonBarManager.cs | 3 +- .../UI/WebControls/DnnFilePicker.cs | 3 +- .../PropertyEditorControls/DateEditControl.cs | 3 +- .../DateTimeEditControl.cs | 3 +- .../HttpModules/Analytics/AnalyticsModule.cs | 3 +- .../Config/AnalyticsEngineConfiguration.cs | 3 +- .../HttpModules/Exception/ExceptionModule.cs | 4 +- .../Membership/MembershipModule.cs | 3 +- .../UrlRewrite/BasicUrlRewriter.cs | 4 +- .../Application/ApplicationStatusInfo.cs | 4 +- .../Collections/CollectionExtensions.cs | 4 +- DNN Platform/Library/Common/Globals.cs | 3 +- DNN Platform/Library/Common/Initialize.cs | 3 +- .../Common/Internal/EventHandlersContainer.cs | 3 +- .../Common/Internal/ServicesRoutingManager.cs | 3 +- .../Common/Lists/ListInfoCollection.cs | 3 +- .../Library/Common/Utilities/Config.cs | 3 +- .../Library/Common/Utilities/DataCache.cs | 3 +- .../Utilities/FileSystemPermissionVerifier.cs | 4 +- .../Common/Utilities/FileSystemUtils.cs | 3 +- .../Common/Utilities/RetryableAction.cs | 4 +- .../Library/Common/Utilities/XmlUtils.cs | 4 +- .../ComponentModel/ComponentFactory.cs | 4 +- .../ContainerWithServiceProviderFallback.cs | 3 +- .../ComponentModel/ProviderInstaller.cs | 4 +- DNN Platform/Library/Data/DataProvider.cs | 3 +- .../Library/Data/PetaPoco/PetaPocoHelper.cs | 4 +- DNN Platform/Library/Data/SqlDataProvider.cs | 3 +- .../Entities/Content/AttachmentController.cs | 4 +- .../Entities/Controllers/HostController.cs | 3 +- .../Library/Entities/Host/ServerController.cs | 3 +- .../Library/Entities/Icons/IconController.cs | 3 +- .../Modules/DesktopModuleController.cs | 3 +- .../Entities/Modules/EventMessageProcessor.cs | 3 +- .../Entities/Modules/ModuleController.cs | 3 +- .../Library/Entities/Modules/ModuleInfo.cs | 5 +- .../Entities/Modules/PortalModuleBase.cs | 4 +- .../Entities/Modules/Prompt/AddModule.cs | 4 +- .../Entities/Portals/PortalController.cs | 5 +- .../Entities/Portals/PortalGroupController.cs | 3 +- .../Templates/PortalTemplateImporter.cs | 4 +- .../Portals/Templates/PortalTemplateInfo.cs | 4 +- .../Entities/Profile/ProfileController.cs | 3 +- .../Library/Entities/Tabs/TabController.cs | 3 +- .../Entities/Tabs/TabPublishingController.cs | 3 +- .../Tabs/TabVersions/TabVersionBuilder.cs | 3 +- .../Entities/Tabs/TabWorkflowTracker.cs | 4 +- .../Urls/Config/RewriterConfiguration.cs | 4 +- .../Library/Entities/Urls/UrlRewriterUtils.cs | 4 +- .../Entities/Users/Profile/UserProfile.cs | 2 +- .../Users Online/UserOnlineController.cs | 4 +- DNN Platform/Library/Framework/PageBase.cs | 5 +- DNN Platform/Library/Framework/Reflection.cs | 3 +- .../Membership/AspNetMembershipProvider.cs | 3 +- .../Library/Security/Roles/DNNRoleProvider.cs | 3 +- .../Library/Security/Roles/RoleController.cs | 3 +- .../Config/AnalyticsConfiguration.cs | 4 +- .../Analytics/GoogleAnalyticsController.cs | 4 +- .../Authentication/AuthenticationConfig.cs | 4 +- .../AuthenticationController.cs | 3 +- .../Authentication/OAuth/OAuthClientBase.cs | 4 +- .../Library/Services/Cache/CachingProvider.cs | 3 +- .../Services/Cache/FBCachingProvider.cs | 4 +- .../Exceptions/BasePortalException.cs | 5 +- .../Library/Services/Exceptions/Exceptions.cs | 4 +- .../Services/Exceptions/SecurityException.cs | 4 +- .../Library/Services/FileSystem/FileInfo.cs | 5 +- .../Services/FileSystem/FileManager.cs | 3 +- .../Services/FileSystem/FileServerHandler.cs | 4 +- .../Services/FileSystem/FolderManager.cs | 3 +- .../FolderMappingsConfigController.cs | 4 +- .../Internal/FileDeletionController.cs | 3 +- .../Internal/FileSecurityController.cs | 3 +- .../Providers/StandardFolderProvider.cs | 4 +- .../Library/Services/Installer/Installer.cs | 4 +- .../Installer/Installers/CleanupInstaller.cs | 3 +- .../Installers/ResourceFileInstaller.cs | 4 +- .../Library/Services/Installer/LegacyUtil.cs | 5 +- .../Library/Services/Installer/Log/Logger.cs | 4 +- .../Installer/Writers/ModulePackageWriter.cs | 4 +- .../Services/Localization/Localization.cs | 3 +- .../Localization/LocalizationProvider.cs | 3 +- .../Log/EventLog/DBLoggingProvider.cs | 3 +- .../Services/Log/EventLog/LogController.cs | 3 +- .../Services/Mail/SendTokenizedBulkEmail.cs | 4 +- .../Services/ModuleCache/PurgeModuleCache.cs | 4 +- .../Services/OutputCache/PurgeOutputCache.cs | 4 +- .../Services/Scheduling/ProcessGroup.cs | 3 +- .../Scheduling/ScheduleHistoryItem.cs | 4 +- .../Library/Services/Scheduling/Scheduler.cs | 4 +- .../Controllers/ModuleResultController.cs | 3 +- .../Internals/InternalSearchControllerImpl.cs | 3 +- .../Search/Internals/LuceneControllerImpl.cs | 4 +- .../Library/Services/Search/ModuleIndexer.cs | 3 +- .../Library/Services/Search/SearchEngine.cs | 5 +- .../Services/Search/SearchEngineScheduler.cs | 3 +- .../Library/Services/Search/TabIndexer.cs | 4 +- .../Services/Sitemap/CoreSitemapProvider.cs | 4 +- .../Services/SystemHealth/WebServerMonitor.cs | 4 +- .../Upgrade/Internals/Steps/AddFcnModeStep.cs | 4 +- .../Steps/FilePermissionCheckStep.cs | 4 +- .../Internals/Steps/InstallExtensionsStep.cs | 4 +- .../Internals/Steps/InstallVersionStep.cs | 4 +- .../Internals/Steps/UpdateLanguagePackStep.cs | 4 +- .../Library/Services/Upgrade/Upgrade.cs | 3 +- .../UserProfile/UserProfilePageHandler.cs | 4 +- DNN Platform/Library/Startup.cs | 6 +- .../Library/UI/Containers/Container.cs | 3 +- .../UI/Modules/ModuleControlFactory.cs | 4 +- DNN Platform/Library/UI/Modules/ModuleHost.cs | 3 +- .../Library/UI/Skins/SkinController.cs | 3 +- .../Library/UI/Skins/SkinFileProcessor.cs | 4 +- .../Library/UI/Skins/SkinThumbNailControl.cs | 4 +- .../Library/UI/WebControls/CaptchaControl.cs | 4 +- .../DNN Edit Controls/DNNListEditControl.cs | 3 +- .../Edit Controls/DateEditControl.cs | 4 +- .../Edit Controls/IntegerEditControl.cs | 4 +- .../Edit Controls/TrueFalseEditControl.cs | 4 +- .../WebControls/PropertyEditor/SettingInfo.cs | 4 +- .../CoreMessagingBusinessController.cs | 4 +- .../Services/FileUploadController.cs | 5 +- .../Services/MessagingServiceController.cs | 3 +- .../DnnExportImport/Components/Common/Util.cs | 3 +- .../Components/Controllers/BaseController.cs | 3 +- .../Components/Engines/ExportImportEngine.cs | 3 +- .../Scheduler/ExportImportScheduler.cs | 3 +- .../Services/PackagesExportService.cs | 3 +- .../Components/Services/PagesExportService.cs | 3 +- .../Services/ThemesExportService.cs | 3 +- .../Groups/ModerationServiceController.cs | 3 +- .../Modules/Journal/FileUploadController.cs | 5 +- .../Journal/NotificationServicesController.cs | 4 +- .../Modules/Journal/ServicesController.cs | 3 +- .../Services/MemberDirectoryController.cs | 3 +- .../Modules/RazorHost/CreateModule.ascx.cs | 3 +- .../Components/ResourceManagerController.cs | 4 +- .../TelerikRemoval/UpgradeController.cs | 4 +- .../SimpleWebFarmCachingProvider.cs | 4 +- .../AspNetClientCapability.cs | 4 +- .../AzureFolderProvider/Settings.ascx.cs | 3 +- DNN Platform/Syndication/OPML/Opml.cs | 4 +- .../Syndication/OPML/OpmlDownloadManager.cs | 4 +- .../Syndication/RSS/RssDownloadManager.cs | 4 +- .../Services/Installer/TestLogSource.cs | 22 --- .../Services/Installer/XmlMergeTests.cs | 135 +----------------- DNN Platform/Website/Default.aspx.cs | 3 +- .../Admin/Authentication/Login.ascx.cs | 3 +- .../Admin/Security/EditUser.ascx.cs | 3 +- .../Admin/Security/Password.ascx.cs | 3 +- .../Admin/Security/SecurityRoles.ascx.cs | 3 +- .../Admin/Security/User.ascx.cs | 3 +- .../AuthenticationServices/DNN/Login.ascx.cs | 3 +- DNN Platform/Website/Install/Install.aspx.cs | 3 +- .../Website/Install/InstallWizard.aspx.cs | 3 +- .../Website/Install/UpgradeWizard.aspx.cs | 4 +- .../admin/Modules/Modulesettings.ascx.cs | 3 +- .../admin/Sales/PayPalSubscription.aspx.cs | 4 +- .../admin/Security/SendPassword.ascx.cs | 3 +- .../Website/admin/Skins/Toast.ascx.cs | 3 +- .../ConfigConsole/ConfigConsoleController.cs | 3 +- .../Editors/AuthSystemPackageEditor.cs | 3 +- .../Editors/CoreLanguagePackageEditor.cs | 3 +- .../Editors/ExtensionLanguagePackageEditor.cs | 3 +- .../Editors/JsLibraryPackageEditor.cs | 4 +- .../Extensions/Editors/ModulePackageEditor.cs | 3 +- .../Editors/SkinObjectPackageEditor.cs | 4 +- .../Extensions/Editors/SkinPackageEditor.cs | 4 +- .../Extensions/InstallController.cs | 4 +- .../Application/RestartApplication.cs | 4 +- .../Prompt/Commands/Commands/ListCommands.cs | 4 +- .../Prompt/Commands/Host/ClearCache.cs | 4 +- .../Prompt/Commands/Portal/ClearLog.cs | 3 +- .../Components/Prompt/ModulesController.cs | 4 +- .../Components/Prompt/Utilities.cs | 4 +- .../Recyclebin/RecyclebinController.cs | 4 +- .../Roles/Prompt/Commands/DeleteRole.cs | 4 +- .../Roles/Prompt/Commands/ListRoles.cs | 4 +- .../Roles/Prompt/Commands/NewRole.cs | 4 +- .../Roles/Prompt/Commands/SetRole.cs | 4 +- .../SiteSettings/LanguagesControllerTasks.cs | 5 +- .../Components/Sites/SitesController.cs | 4 +- .../TaskScheduler/Prompt/Commands/GetTask.cs | 4 +- .../TaskScheduler/Prompt/Commands/SetTask.cs | 4 +- .../TaskScheduler/TaskSchedulerController.cs | 3 +- .../Components/Themes/ThemesController.cs | 4 +- .../Components/Users/UsersController.cs | 4 +- .../Services/AdminLogsController.cs | 5 +- .../Services/CommandController.cs | 3 +- .../Services/ConfigConsoleController.cs | 3 +- .../Services/ConnectorsController.cs | 4 +- .../Services/CssEditorController.cs | 4 +- .../Services/ExtensionsController.cs | 4 +- .../Services/LanguagesController.cs | 4 +- .../Services/LicensingController.cs | 4 +- .../Services/PagesController.cs | 4 +- .../Services/RolesController.cs | 4 +- .../Services/SecurityController.cs | 3 +- .../Services/SeoController.cs | 4 +- .../Services/ServerController.cs | 4 +- .../Services/ServerSettingsLogsController.cs | 4 +- .../ServerSettingsPerformanceController.cs | 3 +- .../ServerSettingsSmtpAdminController.cs | 4 +- .../ServerSettingsSmtpHostController.cs | 4 +- .../Services/SiteGroupsController.cs | 4 +- .../Services/SiteSettingsController.cs | 3 +- .../Services/SitesController.cs | 4 +- .../SystemInfoApplicationAdminController.cs | 4 +- .../SystemInfoApplicationHostController.cs | 4 +- .../Services/SystemInfoDatabaseController.cs | 4 +- .../Services/SystemInfoServersController.cs | 4 +- .../Services/SystemInfoWebController.cs | 4 +- .../Services/TaskSchedulerController.cs | 4 +- .../Services/ThemesController.cs | 3 +- .../Services/UpgradesController.cs | 4 +- .../Services/UsersController.cs | 4 +- .../Services/VocabulariesController.cs | 4 +- .../Controllers/EditBarController.cs | 3 +- .../Services/ContentEditorController.cs | 3 +- .../AppEvents/EventsController.cs | 4 +- .../Dnn.PersonaBar.Library/Common/IocUtil.cs | 4 +- .../Controllers/ModulesController.cs | 4 +- .../Controllers/PersonaBarController.cs | 4 +- .../Permissions/MenuPermissionController.cs | 3 +- .../Components/BusinessController.cs | 3 +- .../HttpModules/PersonaBarModule.cs | 4 +- .../Services/ComponentsController.cs | 3 +- .../Services/MenuExtensionsController.cs | 3 +- .../Services/PortalsController.cs | 4 +- .../Services/TabsController.cs | 4 +- 263 files changed, 677 insertions(+), 428 deletions(-) delete mode 100644 DNN Platform/Tests/DotNetNuke.Tests.Integration/Services/Installer/TestLogSource.cs diff --git a/DNN Platform/Admin Modules/Dnn.Modules.Console/Settings.ascx.cs b/DNN Platform/Admin Modules/Dnn.Modules.Console/Settings.ascx.cs index 77ea3127077..04c7dcbd1d4 100644 --- a/DNN Platform/Admin Modules/Dnn.Modules.Console/Settings.ascx.cs +++ b/DNN Platform/Admin Modules/Dnn.Modules.Console/Settings.ascx.cs @@ -20,10 +20,12 @@ namespace Dnn.Modules.Console using DotNetNuke.Web.Common; using DotNetNuke.Web.UI.WebControls.Internal; + using Microsoft.Extensions.Logging; + /// Loads and saves the module settings. public partial class Settings : ModuleSettingsBase { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(Settings)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// public override void LoadSettings() diff --git a/DNN Platform/Admin Modules/Dnn.Modules.Console/ViewConsole.ascx.cs b/DNN Platform/Admin Modules/Dnn.Modules.Console/ViewConsole.ascx.cs index c72da3ae90b..742402a8706 100644 --- a/DNN Platform/Admin Modules/Dnn.Modules.Console/ViewConsole.ascx.cs +++ b/DNN Platform/Admin Modules/Dnn.Modules.Console/ViewConsole.ascx.cs @@ -29,11 +29,12 @@ namespace Dnn.Modules.Console using DotNetNuke.Services.Localization; using DotNetNuke.Services.Personalization; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// Implements the module view logic. public partial class ViewConsole : PortalModuleBase { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ViewConsole)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly INavigationManager navigationManager; private readonly IJavaScriptLibraryHelper javaScript; private readonly IClientResourceController clientResourceController; diff --git a/DNN Platform/DotNetNuke.DependencyInjection/Extensions/TypeExtensions.cs b/DNN Platform/DotNetNuke.DependencyInjection/Extensions/TypeExtensions.cs index 0d4cf2aef31..5a5fcc8ef20 100644 --- a/DNN Platform/DotNetNuke.DependencyInjection/Extensions/TypeExtensions.cs +++ b/DNN Platform/DotNetNuke.DependencyInjection/Extensions/TypeExtensions.cs @@ -12,6 +12,8 @@ namespace DotNetNuke.DependencyInjection.Extensions using DotNetNuke.Instrumentation; using DotNetNuke.Internal.SourceGenerators; + using Microsoft.Extensions.Logging; + /// specific extensions to be used in Dependency Injection invocations. public static partial class TypeExtensions { @@ -93,7 +95,7 @@ public static TypesResult SafeGetTypes(this IEnumerable assemblies) /// Logs the exceptions in of using . /// The types result to log. /// The logger. - public static void LogOtherExceptions(this TypesResult result, ILog logger) + public static void LogOtherExceptions(this TypesResult result, ILogger logger) { if (logger is null) { diff --git a/DNN Platform/DotNetNuke.Instrumentation/DnnLog.cs b/DNN Platform/DotNetNuke.Instrumentation/DnnLog.cs index e749d3fccc4..f6d5eb7f575 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/DnnLog.cs +++ b/DNN Platform/DotNetNuke.Instrumentation/DnnLog.cs @@ -13,8 +13,10 @@ namespace DotNetNuke.Instrumentation using DotNetNuke.Internal.SourceGenerators; using log4net.Config; - /// Provides access to logging methods. Obsolete, use instead. - [DnnDeprecated(7, 0, 1, "Use LoggerSource.Instance", RemovalVersion = 11)] + using Microsoft.Extensions.Logging; + + /// Provides access to logging methods. Obsolete, use instead. + [DnnDeprecated(7, 0, 1, "Use Microsoft.Extensions.Logging.ILogger", RemovalVersion = 11)] public static partial class DnnLog { private const string ConfigFile = "DotNetNuke.log4net.config"; diff --git a/DNN Platform/DotNetNuke.Instrumentation/DnnLogger.cs b/DNN Platform/DotNetNuke.Instrumentation/DnnLogger.cs index cbea8787199..2ddb8eb3772 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/DnnLogger.cs +++ b/DNN Platform/DotNetNuke.Instrumentation/DnnLogger.cs @@ -16,8 +16,8 @@ namespace DotNetNuke.Instrumentation using log4net.Repository; using log4net.Util; - /// Obsolete, use instead. - [DnnDeprecated(9, 13, 7, "Use LoggerSource.Instance", RemovalVersion = 11)] + /// Obsolete, use instead. + [DnnDeprecated(9, 13, 7, "Use Microsoft.Extensions.Logging.ILogger", RemovalVersion = 11)] public sealed partial class DnnLogger : LoggerWrapperImpl { // add custom logging levels (below trace value of 20000) diff --git a/DNN Platform/DotNetNuke.ModulePipeline/ModuleControlPipeline.cs b/DNN Platform/DotNetNuke.ModulePipeline/ModuleControlPipeline.cs index 0b863e0da28..2a3836bb475 100644 --- a/DNN Platform/DotNetNuke.ModulePipeline/ModuleControlPipeline.cs +++ b/DNN Platform/DotNetNuke.ModulePipeline/ModuleControlPipeline.cs @@ -13,13 +13,16 @@ namespace DotNetNuke.ModulePipeline using DotNetNuke.Instrumentation; using DotNetNuke.UI.Modules; + using Microsoft.Extensions.Logging; + /// /// The Module Pipeline that determines which Module pattern /// to invoke based on the input module type. /// public class ModuleControlPipeline : IModuleControlPipeline { - private static readonly ILog TraceLogger = LoggerSource.Instance.GetLogger("DNN.Trace"); + private static readonly ILogger TraceLogger = DnnLoggingController.GetLogger("DNN.Trace"); + private readonly IModuleControlFactory[] factories; /// Initializes a new instance of the class. diff --git a/DNN Platform/DotNetNuke.Web.Client.ResourceManager/ClientResourceController.cs b/DNN Platform/DotNetNuke.Web.Client.ResourceManager/ClientResourceController.cs index 252b3246a2e..d620fd022ee 100644 --- a/DNN Platform/DotNetNuke.Web.Client.ResourceManager/ClientResourceController.cs +++ b/DNN Platform/DotNetNuke.Web.Client.ResourceManager/ClientResourceController.cs @@ -13,10 +13,12 @@ namespace DotNetNuke.Web.Client.ResourceManager using DotNetNuke.Abstractions.ClientResources; using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + /// public class ClientResourceController : IClientResourceController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ClientResourceController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IHostSettings hostSettings; private readonly IApplicationStatusInfo appStatus; private readonly IClientResourceSettings clientResourceSettings; diff --git a/DNN Platform/DotNetNuke.Web.Client/ClientResourceManager.cs b/DNN Platform/DotNetNuke.Web.Client/ClientResourceManager.cs index fe2df51466e..dade693e795 100644 --- a/DNN Platform/DotNetNuke.Web.Client/ClientResourceManager.cs +++ b/DNN Platform/DotNetNuke.Web.Client/ClientResourceManager.cs @@ -21,6 +21,7 @@ namespace DotNetNuke.Web.Client.ClientResourceManagement using DotNetNuke.Web.Client.ResourceManager; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// Provides the ability to request that client resources (JavaScript and CSS) be loaded on the client browser. [DnnDeprecated(10, 2, 0, "Please use IClientResourceController instead.")] @@ -32,7 +33,7 @@ public partial class ClientResourceManager /// The default javascript provider. internal const string DefaultJsProvider = "DnnBodyProvider"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ClientResourceManager)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly Dictionary FileExistsCache = new Dictionary(); private static readonly ReaderWriterLockSlim LockFileExistsCache = new ReaderWriterLockSlim(); diff --git a/DNN Platform/DotNetNuke.Web.Client/ClientResourceSettings.cs b/DNN Platform/DotNetNuke.Web.Client/ClientResourceSettings.cs index 807d371034d..894de8c72b9 100644 --- a/DNN Platform/DotNetNuke.Web.Client/ClientResourceSettings.cs +++ b/DNN Platform/DotNetNuke.Web.Client/ClientResourceSettings.cs @@ -61,7 +61,7 @@ static ClientResourceSettings() } catch (Exception exception) { - LoggerSource.Instance.GetLogger(typeof(ClientResourceSettings)).Warn("Failed to get get types for reflection", exception); + DnnLoggingController.GetLogger().Warn("Failed to get get types for reflection", exception); } } @@ -242,7 +242,7 @@ private static string GetPortalSettingThroughReflection(int? portalId, string se } catch (Exception exception) { - LoggerSource.Instance.GetLogger(typeof(ClientResourceSettings)).Warn("Failed to Get Portal Setting Through Reflection", exception); + DnnLoggingController.GetLogger().Warn("Failed to Get Portal Setting Through Reflection", exception); } return null; @@ -265,7 +265,7 @@ private static string GetPortalSettingThroughReflection(int? portalId, string se } catch (Exception exception) { - LoggerSource.Instance.GetLogger(typeof(ClientResourceSettings)).Warn("Failed to Get Portal ID Through Reflection", exception); + DnnLoggingController.GetLogger().Warn("Failed to Get Portal ID Through Reflection", exception); } return null; @@ -286,7 +286,7 @@ private static string GetHostSettingThroughReflection(string settingKey) } catch (Exception exception) { - LoggerSource.Instance.GetLogger(typeof(ClientResourceSettings)).Warn("Failed to Get Host Setting Through Reflection", exception); + DnnLoggingController.GetLogger().Warn("Failed to Get Host Setting Through Reflection", exception); } return null; @@ -302,7 +302,7 @@ private static UpgradeStatus GetStatusByReflection() } catch (Exception exception) { - LoggerSource.Instance.GetLogger(typeof(ClientResourceSettings)).Warn("Failed to Get Status By Reflection", exception); + DnnLoggingController.GetLogger().Warn("Failed to Get Status By Reflection", exception); return UpgradeStatus.Unknown; } } diff --git a/DNN Platform/DotNetNuke.Web.Client/DependencyInjection.cs b/DNN Platform/DotNetNuke.Web.Client/DependencyInjection.cs index fa128d7f082..e63dd7279c6 100644 --- a/DNN Platform/DotNetNuke.Web.Client/DependencyInjection.cs +++ b/DNN Platform/DotNetNuke.Web.Client/DependencyInjection.cs @@ -26,7 +26,7 @@ static DependencyInjection() } catch (Exception exception) { - LoggerSource.Instance.GetLogger(typeof(ClientResourceSettings)).Warn("Failed to get get types for reflection", exception); + DnnLoggingController.GetLogger(typeof(DependencyInjection)).Warn("Failed to get get types for reflection", exception); } } diff --git a/DNN Platform/DotNetNuke.Web.Mvc/Extensions/StartupExtensions.cs b/DNN Platform/DotNetNuke.Web.Mvc/Extensions/StartupExtensions.cs index 0d8ce4495ff..89eac1dd6e6 100644 --- a/DNN Platform/DotNetNuke.Web.Mvc/Extensions/StartupExtensions.cs +++ b/DNN Platform/DotNetNuke.Web.Mvc/Extensions/StartupExtensions.cs @@ -11,11 +11,12 @@ namespace DotNetNuke.Web.Mvc.Extensions using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; + using Microsoft.Extensions.Logging; /// Adds DNN MVC Controller Specific startup extensions to simplify the Class. public static class StartupExtensions { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(StartupExtensions)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(typeof(StartupExtensions)); /// Configures all of the 's to be used with the Service Collection for Dependency Injection. /// Service Collection used to registering services in the container. diff --git a/DNN Platform/DotNetNuke.Web.Mvc/Routing/MvcRoutingManager.cs b/DNN Platform/DotNetNuke.Web.Mvc/Routing/MvcRoutingManager.cs index 3236416fc8f..4a9d50fd542 100644 --- a/DNN Platform/DotNetNuke.Web.Mvc/Routing/MvcRoutingManager.cs +++ b/DNN Platform/DotNetNuke.Web.Mvc/Routing/MvcRoutingManager.cs @@ -18,9 +18,11 @@ namespace DotNetNuke.Web.Mvc.Routing using DotNetNuke.Services.Localization; using DotNetNuke.Web.Mvc.Common; + using Microsoft.Extensions.Logging; + public sealed class MvcRoutingManager : IMapRoute, IRoutingManager { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(MvcRoutingManager)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly RouteCollection routes; private readonly PortalAliasMvcRouteManager portalAliasMvcRouteManager; diff --git a/DNN Platform/DotNetNuke.Web.Mvc/StandardTabAndModuleInfoProvider.cs b/DNN Platform/DotNetNuke.Web.Mvc/StandardTabAndModuleInfoProvider.cs index 01adecec31d..596f1367d6d 100644 --- a/DNN Platform/DotNetNuke.Web.Mvc/StandardTabAndModuleInfoProvider.cs +++ b/DNN Platform/DotNetNuke.Web.Mvc/StandardTabAndModuleInfoProvider.cs @@ -15,6 +15,8 @@ namespace DotNetNuke.Web.Mvc using DotNetNuke.Entities.Tabs; using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + public sealed class StandardTabAndModuleInfoProvider : ITabAndModuleInfoProvider { private const string ModuleIdKey = "ModuleId"; @@ -22,7 +24,7 @@ public sealed class StandardTabAndModuleInfoProvider : ITabAndModuleInfoProvider private const string MonikerQueryKey = "Moniker"; private const string MonikerHeaderKey = "X-DNN-MONIKER"; private const string MonikerSettingsKey = "Moniker"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(StandardTabAndModuleInfoProvider)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// public bool TryFindTabId(HttpRequestBase request, out int tabId) diff --git a/DNN Platform/DotNetNuke.Web/Api/Auth/ApiTokenAuthMessageHandler.cs b/DNN Platform/DotNetNuke.Web/Api/Auth/ApiTokenAuthMessageHandler.cs index 43f784c14bd..1cea277d47e 100644 --- a/DNN Platform/DotNetNuke.Web/Api/Auth/ApiTokenAuthMessageHandler.cs +++ b/DNN Platform/DotNetNuke.Web/Api/Auth/ApiTokenAuthMessageHandler.cs @@ -12,12 +12,14 @@ namespace DotNetNuke.Web.Api.Auth using DotNetNuke.Instrumentation; using DotNetNuke.Web.Api.Auth.ApiTokens; + using Microsoft.Extensions.Logging; + /// /// Authentication message handler that authorizes an HTTP request based on a valid API token. /// public class ApiTokenAuthMessageHandler : AuthMessageHandlerBase { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ApiTokenAuthMessageHandler)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IApiTokenController apiTokenController; diff --git a/DNN Platform/DotNetNuke.Web/Api/Auth/ApiTokens/ApiTokenController.cs b/DNN Platform/DotNetNuke.Web/Api/Auth/ApiTokens/ApiTokenController.cs index ecc0752254c..15d7c693460 100644 --- a/DNN Platform/DotNetNuke.Web/Api/Auth/ApiTokens/ApiTokenController.cs +++ b/DNN Platform/DotNetNuke.Web/Api/Auth/ApiTokens/ApiTokenController.cs @@ -27,13 +27,14 @@ namespace DotNetNuke.Web.Api.Auth.ApiTokens using DotNetNuke.Web.Api.Auth.ApiTokens.Repositories; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// public class ApiTokenController : IApiTokenController { private const string AuthScheme = "Bearer"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ApiTokenController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly Encoding TextEncoder = Encoding.UTF8; private readonly IApiTokenRepository apiTokenRepository; diff --git a/DNN Platform/DotNetNuke.Web/Api/Auth/AuthMessageHandlerBase.cs b/DNN Platform/DotNetNuke.Web/Api/Auth/AuthMessageHandlerBase.cs index c2069ea3e56..669f22fdb1a 100644 --- a/DNN Platform/DotNetNuke.Web/Api/Auth/AuthMessageHandlerBase.cs +++ b/DNN Platform/DotNetNuke.Web/Api/Auth/AuthMessageHandlerBase.cs @@ -14,10 +14,12 @@ namespace DotNetNuke.Web.Api.Auth using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + /// Base class for authentication providers message handlers. public abstract class AuthMessageHandlerBase : DelegatingHandler { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(AuthMessageHandlerBase)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// Initializes a new instance of the class. /// A value indicating whether this handler should be included by default in all API endpoints. diff --git a/DNN Platform/DotNetNuke.Web/Api/Extensions/StartupExtensions.cs b/DNN Platform/DotNetNuke.Web/Api/Extensions/StartupExtensions.cs index c2202c365a9..e6524c8dd41 100644 --- a/DNN Platform/DotNetNuke.Web/Api/Extensions/StartupExtensions.cs +++ b/DNN Platform/DotNetNuke.Web/Api/Extensions/StartupExtensions.cs @@ -11,11 +11,12 @@ namespace DotNetNuke.Web.Extensions using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; + using Microsoft.Extensions.Logging; /// Adds DNN Web API Specific startup extensions to simplify the Class. internal static class StartupExtensions { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(StartupExtensions)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(typeof(StartupExtensions)); /// Configures all of the 's to be used with the Service Collection for Dependency Injection. /// Service Collection used to registering services in the container. diff --git a/DNN Platform/DotNetNuke.Web/Api/Internal/ServicesRoutingManager.cs b/DNN Platform/DotNetNuke.Web/Api/Internal/ServicesRoutingManager.cs index 13bb99c9e8d..30e2eabc6f3 100644 --- a/DNN Platform/DotNetNuke.Web/Api/Internal/ServicesRoutingManager.cs +++ b/DNN Platform/DotNetNuke.Web/Api/Internal/ServicesRoutingManager.cs @@ -26,11 +26,12 @@ namespace DotNetNuke.Web.Api.Internal using DotNetNuke.Web.ConfigSection; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// Allows registering web API routes. public sealed class ServicesRoutingManager : IMapRoute, IRoutingManager { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ServicesRoutingManager)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IServiceProvider serviceProvider; private readonly RouteCollection routes; private readonly PortalAliasRouteManager portalAliasRouteManager; diff --git a/DNN Platform/DotNetNuke.Web/Api/StandardTabAndModuleInfoProvider.cs b/DNN Platform/DotNetNuke.Web/Api/StandardTabAndModuleInfoProvider.cs index 7a0ae92fc90..8a18fe59453 100644 --- a/DNN Platform/DotNetNuke.Web/Api/StandardTabAndModuleInfoProvider.cs +++ b/DNN Platform/DotNetNuke.Web/Api/StandardTabAndModuleInfoProvider.cs @@ -14,6 +14,8 @@ namespace DotNetNuke.Web.Api using DotNetNuke.Entities.Tabs; using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + /// The standard implementation. public sealed class StandardTabAndModuleInfoProvider : ITabAndModuleInfoProvider { @@ -23,7 +25,7 @@ public sealed class StandardTabAndModuleInfoProvider : ITabAndModuleInfoProvider private const string MonikerHeaderKey = "X-DNN-MONIKER"; private const string MonikerSettingsKey = "Moniker"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(StandardTabAndModuleInfoProvider)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// public bool TryFindTabId(HttpRequestMessage request, out int tabId) diff --git a/DNN Platform/DotNetNuke.Web/Api/TraceWriter.cs b/DNN Platform/DotNetNuke.Web/Api/TraceWriter.cs index adc1112a424..018fca3d299 100644 --- a/DNN Platform/DotNetNuke.Web/Api/TraceWriter.cs +++ b/DNN Platform/DotNetNuke.Web/Api/TraceWriter.cs @@ -11,10 +11,12 @@ namespace DotNetNuke.Web.Api using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + /// A implementation. internal sealed class TraceWriter : ITraceWriter { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(TraceWriter)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly bool enabled; /// Initializes a new instance of the class. diff --git a/DNN Platform/DotNetNuke.Web/Common/DotNetNukeHttpApplication.cs b/DNN Platform/DotNetNuke.Web/Common/DotNetNukeHttpApplication.cs index 2a1cea9bbb1..576cdf38960 100644 --- a/DNN Platform/DotNetNuke.Web/Common/DotNetNukeHttpApplication.cs +++ b/DNN Platform/DotNetNuke.Web/Common/DotNetNukeHttpApplication.cs @@ -41,10 +41,12 @@ namespace DotNetNuke.Web.Common.Internal using DotNetNuke.Services.Tokens; using DotNetNuke.Services.Url.FriendlyUrl; + using Microsoft.Extensions.Logging; + /// DotNetNuke Http Application. It will handle Start, End, BeginRequest, Error event for whole application. public class DotNetNukeHttpApplication : HttpApplication { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(DotNetNukeHttpApplication)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly string[] Endings = [".css", ".gif", ".jpeg", ".jpg", ".js", ".png", "scriptresource.axd", "webresource.axd",]; diff --git a/DNN Platform/DotNetNuke.Web/Common/DotNetNukeSecurity.cs b/DNN Platform/DotNetNuke.Web/Common/DotNetNukeSecurity.cs index 05d7b500cf1..0e371080f34 100644 --- a/DNN Platform/DotNetNuke.Web/Common/DotNetNukeSecurity.cs +++ b/DNN Platform/DotNetNuke.Web/Common/DotNetNukeSecurity.cs @@ -22,7 +22,7 @@ namespace DotNetNuke.Web.Common.Internal { internal static class DotNetNukeSecurity { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(DotNetNukeSecurity)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static FileSystemWatcher _fileWatcher; private static DateTime _lastRead; private static Globals.UpgradeStatus _appStatus = Globals.UpgradeStatus.None; diff --git a/DNN Platform/DotNetNuke.Web/Common/DotNetNukeShutdownOverload.cs b/DNN Platform/DotNetNuke.Web/Common/DotNetNukeShutdownOverload.cs index a8db8131179..d3a91966e3d 100644 --- a/DNN Platform/DotNetNuke.Web/Common/DotNetNukeShutdownOverload.cs +++ b/DNN Platform/DotNetNuke.Web/Common/DotNetNukeShutdownOverload.cs @@ -15,10 +15,12 @@ namespace DotNetNuke.Web.Common.Internal using DotNetNuke.Common; using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + /// Watches bin folder and root files and unloads the app domain proactively when they change. internal static class DotNetNukeShutdownOverload { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(DotNetNukeShutdownOverload)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(typeof(DotNetNukeShutdownOverload)); private static Timer shutDownDelayTimer; private static bool handleShutdowns; diff --git a/DNN Platform/DotNetNuke.Web/DependencyInjection/BuildUpExtensions.cs b/DNN Platform/DotNetNuke.Web/DependencyInjection/BuildUpExtensions.cs index 4833477b468..07a0e63025d 100644 --- a/DNN Platform/DotNetNuke.Web/DependencyInjection/BuildUpExtensions.cs +++ b/DNN Platform/DotNetNuke.Web/DependencyInjection/BuildUpExtensions.cs @@ -12,10 +12,12 @@ namespace DotNetNuke.DependencyInjection.Extensions using DotNetNuke.Common.Utilities; using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + /// Adds property injection extension methods. internal static class BuildUpExtensions { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(BuildUpExtensions)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(typeof(BuildUpExtensions)); /// Injects property dependency for properties that are decorated with . /// The service provider. diff --git a/DNN Platform/DotNetNuke.Web/DependencyInjectionInitialize.cs b/DNN Platform/DotNetNuke.Web/DependencyInjectionInitialize.cs index f94919dd0ca..71b4602d2e9 100644 --- a/DNN Platform/DotNetNuke.Web/DependencyInjectionInitialize.cs +++ b/DNN Platform/DotNetNuke.Web/DependencyInjectionInitialize.cs @@ -12,11 +12,12 @@ namespace DotNetNuke.Web using DotNetNuke.Services.DependencyInjection; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// Initializes the Dependency Injection container. public static class DependencyInjectionInitialize { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(DependencyInjectionInitialize)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(typeof(DependencyInjectionInitialize)); /// Gets the service collection (for logging/diagnostics). internal static IServiceCollection ServiceCollection { get; private set; } diff --git a/DNN Platform/DotNetNuke.Web/InternalServices/ControlBarController.cs b/DNN Platform/DotNetNuke.Web/InternalServices/ControlBarController.cs index 55215cdce5f..6fb9b8b9db8 100644 --- a/DNN Platform/DotNetNuke.Web/InternalServices/ControlBarController.cs +++ b/DNN Platform/DotNetNuke.Web/InternalServices/ControlBarController.cs @@ -38,6 +38,7 @@ namespace DotNetNuke.Web.InternalServices using DotNetNuke.Web.Api.Internal; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// A web API for the control bar. /// The business controller provider. @@ -54,7 +55,7 @@ public class ControlBarController(IBusinessControllerProvider businessController : DnnApiController { private const string DefaultExtensionImage = "icon_extensions_32px.png"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ControlBarController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IBusinessControllerProvider businessControllerProvider = businessControllerProvider ?? Globals.GetCurrentServiceProvider().GetRequiredService(); private readonly PersonalizationController personalizationController = personalizationController ?? Globals.GetCurrentServiceProvider().GetRequiredService(); private readonly IApplicationStatusInfo appStatus = appStatus ?? Globals.GetCurrentServiceProvider().GetRequiredService(); diff --git a/DNN Platform/DotNetNuke.Web/InternalServices/EventLogServiceController.cs b/DNN Platform/DotNetNuke.Web/InternalServices/EventLogServiceController.cs index c220b21bb5d..107991a255c 100644 --- a/DNN Platform/DotNetNuke.Web/InternalServices/EventLogServiceController.cs +++ b/DNN Platform/DotNetNuke.Web/InternalServices/EventLogServiceController.cs @@ -19,12 +19,13 @@ namespace DotNetNuke.Web.InternalServices using DotNetNuke.Web.Api; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// A web API which gets event log details. [DnnAuthorize] public class EventLogServiceController : DnnApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(EventLogServiceController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IEventLogService eventLogService; /// Initializes a new instance of the class. diff --git a/DNN Platform/DotNetNuke.Web/InternalServices/FileUploadController.cs b/DNN Platform/DotNetNuke.Web/InternalServices/FileUploadController.cs index 06cece5d667..73ee60d1bca 100644 --- a/DNN Platform/DotNetNuke.Web/InternalServices/FileUploadController.cs +++ b/DNN Platform/DotNetNuke.Web/InternalServices/FileUploadController.cs @@ -39,6 +39,7 @@ namespace DotNetNuke.Web.InternalServices using DotNetNuke.Web.Api.Internal; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; using FileInfo = DotNetNuke.Services.FileSystem.FileInfo; @@ -46,7 +47,7 @@ namespace DotNetNuke.Web.InternalServices [DnnAuthorize] public class FileUploadController : DnnApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(FileUploadController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly Regex UserFolderEx = new Regex(@"users/\d+/\d+/(\d+)/", RegexOptions.Compiled | RegexOptions.IgnoreCase); private static readonly List ImageExtensions = Globals.ImageFileTypes.Split(',').ToList(); diff --git a/DNN Platform/DotNetNuke.Web/InternalServices/ItemListServiceController.cs b/DNN Platform/DotNetNuke.Web/InternalServices/ItemListServiceController.cs index 398d6fb78b1..2d8bfadfc19 100644 --- a/DNN Platform/DotNetNuke.Web/InternalServices/ItemListServiceController.cs +++ b/DNN Platform/DotNetNuke.Web/InternalServices/ItemListServiceController.cs @@ -32,6 +32,7 @@ namespace DotNetNuke.Web.InternalServices using DotNetNuke.Web.Common; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; using Globals = DotNetNuke.Common.Globals; @@ -49,7 +50,7 @@ public class ItemListServiceController(IHostSettings hostSettings, DataProvider { private const string PortalPrefix = "P-"; private const string RootKey = "Root"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ItemListServiceController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IHostSettings hostSettings = hostSettings ?? Globals.GetCurrentServiceProvider().GetRequiredService(); private readonly DataProvider dataProvider = dataProvider ?? Globals.GetCurrentServiceProvider().GetRequiredService(); private readonly IPortalController portalController = portalController ?? Globals.GetCurrentServiceProvider().GetRequiredService(); diff --git a/DNN Platform/DotNetNuke.Web/InternalServices/MessagingServiceController.cs b/DNN Platform/DotNetNuke.Web/InternalServices/MessagingServiceController.cs index d33ac14b8f8..14003ca8383 100644 --- a/DNN Platform/DotNetNuke.Web/InternalServices/MessagingServiceController.cs +++ b/DNN Platform/DotNetNuke.Web/InternalServices/MessagingServiceController.cs @@ -27,12 +27,13 @@ namespace DotNetNuke.Web.InternalServices using DotNetNuke.Web.Api; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// A web API for messaging. [DnnAuthorize] public class MessagingServiceController : DnnApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(MessagingServiceController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IPortalController portalController; private readonly IApplicationStatusInfo appStatus; private readonly IPortalGroupController portalGroupController; diff --git a/DNN Platform/DotNetNuke.Web/InternalServices/ModuleServiceController.cs b/DNN Platform/DotNetNuke.Web/InternalServices/ModuleServiceController.cs index 07c3bacd439..c64701bc78d 100644 --- a/DNN Platform/DotNetNuke.Web/InternalServices/ModuleServiceController.cs +++ b/DNN Platform/DotNetNuke.Web/InternalServices/ModuleServiceController.cs @@ -21,12 +21,13 @@ namespace DotNetNuke.Web.InternalServices using DotNetNuke.Web.Api.Internal; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// A web API controller for module information. [DnnAuthorize] public class ModuleServiceController : DnnApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ModuleServiceController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IHostSettings hostSettings; private readonly DataProvider dataProvider; diff --git a/DNN Platform/DotNetNuke.Web/InternalServices/NotificationsServiceController.cs b/DNN Platform/DotNetNuke.Web/InternalServices/NotificationsServiceController.cs index cbc4e4e9b4e..82ab0479dd0 100644 --- a/DNN Platform/DotNetNuke.Web/InternalServices/NotificationsServiceController.cs +++ b/DNN Platform/DotNetNuke.Web/InternalServices/NotificationsServiceController.cs @@ -16,11 +16,13 @@ namespace DotNetNuke.Web.InternalServices using DotNetNuke.Services.Social.Notifications; using DotNetNuke.Web.Api; + using Microsoft.Extensions.Logging; + /// A web API controller for notifications. [DnnAuthorize] public class NotificationsServiceController : DnnApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(NotificationsServiceController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// Dismisses a notification. /// Information about the notification. diff --git a/DNN Platform/DotNetNuke.Web/InternalServices/RelationshipServiceController.cs b/DNN Platform/DotNetNuke.Web/InternalServices/RelationshipServiceController.cs index c5c29a870b6..b96a8a7beb1 100644 --- a/DNN Platform/DotNetNuke.Web/InternalServices/RelationshipServiceController.cs +++ b/DNN Platform/DotNetNuke.Web/InternalServices/RelationshipServiceController.cs @@ -20,6 +20,7 @@ namespace DotNetNuke.Web.InternalServices using DotNetNuke.Web.Api; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// A web API controller for relationships. /// The host settings. @@ -27,7 +28,7 @@ namespace DotNetNuke.Web.InternalServices public class RelationshipServiceController(IHostSettings hostSettings) : DnnApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(RelationshipServiceController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IHostSettings hostSettings = hostSettings ?? Globals.GetCurrentServiceProvider().GetRequiredService(); /// Initializes a new instance of the class. diff --git a/DNN Platform/DotNetNuke.Web/InternalServices/UserFileController.cs b/DNN Platform/DotNetNuke.Web/InternalServices/UserFileController.cs index 86a56d97ecc..db4cce0adf2 100644 --- a/DNN Platform/DotNetNuke.Web/InternalServices/UserFileController.cs +++ b/DNN Platform/DotNetNuke.Web/InternalServices/UserFileController.cs @@ -17,10 +17,12 @@ namespace DotNetNuke.Web.InternalServices using DotNetNuke.Services.Localization; using DotNetNuke.Web.Api; + using Microsoft.Extensions.Logging; + /// A web API controller for user files. public class UserFileController : DnnApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(UserFileController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly char[] FileExtensionSeparator = [',',]; private static readonly HashSet ImageExtensions = new HashSet(StringComparer.OrdinalIgnoreCase) { "jpg", "png", "gif", "jpe", "jpeg", "tiff", }; private readonly IFolderManager folderManager = FolderManager.Instance; diff --git a/DNN Platform/DotNetNuke.Web/UI/RibbonBarManager.cs b/DNN Platform/DotNetNuke.Web/UI/RibbonBarManager.cs index 51c19a0ff5b..fffdb2505bd 100644 --- a/DNN Platform/DotNetNuke.Web/UI/RibbonBarManager.cs +++ b/DNN Platform/DotNetNuke.Web/UI/RibbonBarManager.cs @@ -29,6 +29,7 @@ namespace DotNetNuke.Web.UI using DotNetNuke.Services.FileSystem; using DotNetNuke.Services.Localization; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// An error code for a . public enum DotNetNukeErrorCode @@ -83,7 +84,7 @@ public enum TabRelativeLocation /// Manages the old ribbon bar. public partial class RibbonBarManager { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(RibbonBarManager)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// Initializes tab info user to add a new tab/page. /// The new instance. diff --git a/DNN Platform/DotNetNuke.Web/UI/WebControls/DnnFilePicker.cs b/DNN Platform/DotNetNuke.Web/UI/WebControls/DnnFilePicker.cs index 63ad93bac4c..23113a9934e 100644 --- a/DNN Platform/DotNetNuke.Web/UI/WebControls/DnnFilePicker.cs +++ b/DNN Platform/DotNetNuke.Web/UI/WebControls/DnnFilePicker.cs @@ -23,13 +23,14 @@ namespace DotNetNuke.Web.UI.WebControls using DotNetNuke.Services.Localization; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; using FileInfo = DotNetNuke.Services.FileSystem.FileInfo; /// The FilePicker Class provides a File Picker Control for DotNetNuke. public class DnnFilePicker : CompositeControl, ILocalizable { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(DnnFilePicker)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IHostSettings hostSettings; private readonly IPortalController portalController; private readonly IApplicationStatusInfo appStatus; diff --git a/DNN Platform/DotNetNuke.Web/UI/WebControls/Internal/PropertyEditorControls/DateEditControl.cs b/DNN Platform/DotNetNuke.Web/UI/WebControls/Internal/PropertyEditorControls/DateEditControl.cs index 153adaef984..718b5e5e16a 100644 --- a/DNN Platform/DotNetNuke.Web/UI/WebControls/Internal/PropertyEditorControls/DateEditControl.cs +++ b/DNN Platform/DotNetNuke.Web/UI/WebControls/Internal/PropertyEditorControls/DateEditControl.cs @@ -15,6 +15,7 @@ namespace DotNetNuke.Web.UI.WebControls.Internal.PropertyEditorControls using DotNetNuke.UI.WebControls; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// /// The DateEditControl control provides a standard UI component for editing @@ -26,7 +27,7 @@ namespace DotNetNuke.Web.UI.WebControls.Internal.PropertyEditorControls [ToolboxData("<{0}:DateEditControl runat=server>")] public class DateEditControl : EditControl { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(DateEditControl)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private DnnDatePicker dateControl; /// diff --git a/DNN Platform/DotNetNuke.Web/UI/WebControls/Internal/PropertyEditorControls/DateTimeEditControl.cs b/DNN Platform/DotNetNuke.Web/UI/WebControls/Internal/PropertyEditorControls/DateTimeEditControl.cs index 8659a2eb12e..cc3561975d2 100644 --- a/DNN Platform/DotNetNuke.Web/UI/WebControls/Internal/PropertyEditorControls/DateTimeEditControl.cs +++ b/DNN Platform/DotNetNuke.Web/UI/WebControls/Internal/PropertyEditorControls/DateTimeEditControl.cs @@ -15,6 +15,7 @@ namespace DotNetNuke.Web.UI.WebControls.Internal.PropertyEditorControls using DotNetNuke.UI.WebControls; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// /// The DateEditControl control provides a standard UI component for editing @@ -26,7 +27,7 @@ namespace DotNetNuke.Web.UI.WebControls.Internal.PropertyEditorControls [ToolboxData("<{0}:DateTimeEditControl runat=server>")] public class DateTimeEditControl : EditControl { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(DateTimeEditControl)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private DnnDateTimePicker dateControl; /// diff --git a/DNN Platform/HttpModules/Analytics/AnalyticsModule.cs b/DNN Platform/HttpModules/Analytics/AnalyticsModule.cs index 2d31b0dcce8..fb3ad4aafc3 100644 --- a/DNN Platform/HttpModules/Analytics/AnalyticsModule.cs +++ b/DNN Platform/HttpModules/Analytics/AnalyticsModule.cs @@ -19,11 +19,12 @@ namespace DotNetNuke.HttpModules.Analytics using DotNetNuke.Services.Log.EventLog; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// This module contains functionality for injecting web analytics scripts into the page. public class AnalyticsModule : IHttpModule { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(AnalyticsModule)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IEventLogger eventLogger; private readonly IApplicationStatusInfo appStatus; diff --git a/DNN Platform/HttpModules/Analytics/Config/AnalyticsEngineConfiguration.cs b/DNN Platform/HttpModules/Analytics/Config/AnalyticsEngineConfiguration.cs index dbc7fdbfd87..1ca576a5afa 100644 --- a/DNN Platform/HttpModules/Analytics/Config/AnalyticsEngineConfiguration.cs +++ b/DNN Platform/HttpModules/Analytics/Config/AnalyticsEngineConfiguration.cs @@ -18,6 +18,7 @@ namespace DotNetNuke.HttpModules.Config using DotNetNuke.Services.Log.EventLog; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// /// Class definition for AnalyticsEngineConfiguration which is used to create @@ -27,7 +28,7 @@ namespace DotNetNuke.HttpModules.Config [XmlRoot("AnalyticsEngineConfig")] public class AnalyticsEngineConfiguration { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(AnalyticsEngineConfiguration)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// Gets or sets the collection of analytics engines. public AnalyticsEngineCollection AnalyticsEngines { get; set; } diff --git a/DNN Platform/HttpModules/Exception/ExceptionModule.cs b/DNN Platform/HttpModules/Exception/ExceptionModule.cs index 2fe1475baec..1762958298a 100644 --- a/DNN Platform/HttpModules/Exception/ExceptionModule.cs +++ b/DNN Platform/HttpModules/Exception/ExceptionModule.cs @@ -11,10 +11,12 @@ namespace DotNetNuke.HttpModules.Exceptions using DotNetNuke.Instrumentation; using DotNetNuke.Services.Log.EventLog; + using Microsoft.Extensions.Logging; + /// Handles the exception that occur with http modules. public class ExceptionModule : IHttpModule { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ExceptionModule)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// Gets the name of the module. [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = "Breaking change")] diff --git a/DNN Platform/HttpModules/Membership/MembershipModule.cs b/DNN Platform/HttpModules/Membership/MembershipModule.cs index ae6fa8caf69..e20ccd63f2a 100644 --- a/DNN Platform/HttpModules/Membership/MembershipModule.cs +++ b/DNN Platform/HttpModules/Membership/MembershipModule.cs @@ -35,11 +35,12 @@ namespace DotNetNuke.HttpModules.Membership using DotNetNuke.UI.Skins.EventListeners; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// Information about membership. public partial class MembershipModule : IHttpModule { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(MembershipModule)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// Initializes a new instance of the class. public MembershipModule() diff --git a/DNN Platform/HttpModules/UrlRewrite/BasicUrlRewriter.cs b/DNN Platform/HttpModules/UrlRewrite/BasicUrlRewriter.cs index 3766aed795a..f18c264f2d6 100644 --- a/DNN Platform/HttpModules/UrlRewrite/BasicUrlRewriter.cs +++ b/DNN Platform/HttpModules/UrlRewrite/BasicUrlRewriter.cs @@ -22,6 +22,8 @@ namespace DotNetNuke.HttpModules.UrlRewrite using DotNetNuke.Services.EventQueue; using DotNetNuke.Services.Localization; + using Microsoft.Extensions.Logging; + /// The basic URL rewriter. internal class BasicUrlRewriter : UrlRewriterBase { @@ -31,7 +33,7 @@ internal class BasicUrlRewriter : UrlRewriterBase /// A regular expression matching a portal ID query string parameter. public static readonly Regex PortalIdRegex = new Regex("&?portalid=\\d+", RegexOptions.IgnoreCase | RegexOptions.Compiled); - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(BasicUrlRewriter)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IServiceProvider serviceProvider; diff --git a/DNN Platform/Library/Application/ApplicationStatusInfo.cs b/DNN Platform/Library/Application/ApplicationStatusInfo.cs index f3781c7f58c..ca70e220991 100644 --- a/DNN Platform/Library/Application/ApplicationStatusInfo.cs +++ b/DNN Platform/Library/Application/ApplicationStatusInfo.cs @@ -14,10 +14,12 @@ namespace DotNetNuke.Application using DotNetNuke.Instrumentation; using DotNetNuke.Services.Upgrade; + using Microsoft.Extensions.Logging; + /// public class ApplicationStatusInfo : IApplicationStatusInfo { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ApplicationStatusInfo)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IApplicationInfo applicationInfo; diff --git a/DNN Platform/Library/Collections/CollectionExtensions.cs b/DNN Platform/Library/Collections/CollectionExtensions.cs index b6d0fe1c00a..2fda5baae44 100644 --- a/DNN Platform/Library/Collections/CollectionExtensions.cs +++ b/DNN Platform/Library/Collections/CollectionExtensions.cs @@ -16,10 +16,12 @@ namespace DotNetNuke.Collections using DotNetNuke.Common; using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + /// Provides a collection of useful extensions to collections. public static class CollectionExtensions { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(CollectionExtensions)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(typeof(CollectionExtensions)); /// /// Converts a string with multiple key-value pairs into a Dictionary, if there are duplicated keys in your string diff --git a/DNN Platform/Library/Common/Globals.cs b/DNN Platform/Library/Common/Globals.cs index a58dc8af5f7..83fbab1f8e6 100644 --- a/DNN Platform/Library/Common/Globals.cs +++ b/DNN Platform/Library/Common/Globals.cs @@ -55,6 +55,7 @@ namespace DotNetNuke.Common using DotNetNuke.Services.Url.FriendlyUrl; using DotNetNuke.UI.Utilities; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; using Microsoft.VisualBasic.CompilerServices; using DataCache = DotNetNuke.UI.Utilities.DataCache; @@ -208,7 +209,7 @@ public sealed partial class Globals private static readonly Stopwatch AppStopwatch = Stopwatch.StartNew(); - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(Globals)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly HashSet AdminControlKeys = new HashSet(StringComparer.OrdinalIgnoreCase) { "tab", "module", "importmodule", "exportmodule", "help", }; private static string applicationPath; private static string desktopModulePath; diff --git a/DNN Platform/Library/Common/Initialize.cs b/DNN Platform/Library/Common/Initialize.cs index 961353b1c76..0d981db530a 100644 --- a/DNN Platform/Library/Common/Initialize.cs +++ b/DNN Platform/Library/Common/Initialize.cs @@ -26,6 +26,7 @@ namespace DotNetNuke.Common using DotNetNuke.Services.Scheduling; using DotNetNuke.Services.Upgrade; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; using Microsoft.Win32; using SchedulerMode = DotNetNuke.Abstractions.Application.SchedulerMode; @@ -33,7 +34,7 @@ namespace DotNetNuke.Common /// The Object to initialize application. public class Initialize { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(Initialize)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly object InitializeLock = new object(); private static bool alreadyInitialized; diff --git a/DNN Platform/Library/Common/Internal/EventHandlersContainer.cs b/DNN Platform/Library/Common/Internal/EventHandlersContainer.cs index dd5f8da1c2d..a1deac919e9 100644 --- a/DNN Platform/Library/Common/Internal/EventHandlersContainer.cs +++ b/DNN Platform/Library/Common/Internal/EventHandlersContainer.cs @@ -14,12 +14,13 @@ namespace DotNetNuke.Common.Internal using DotNetNuke.ExtensionPoints; using DotNetNuke.Instrumentation; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// A container to hold event handlers. /// The type of event handlers. internal class EventHandlersContainer : ComponentBase, EventHandlersContainer>, IEventHandlersContainer { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(EventHandlersContainer)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger>(); [ImportMany] private IEnumerable> eventHandlers = new List>(); diff --git a/DNN Platform/Library/Common/Internal/ServicesRoutingManager.cs b/DNN Platform/Library/Common/Internal/ServicesRoutingManager.cs index d96be788991..51c41f60f23 100644 --- a/DNN Platform/Library/Common/Internal/ServicesRoutingManager.cs +++ b/DNN Platform/Library/Common/Internal/ServicesRoutingManager.cs @@ -9,11 +9,12 @@ namespace DotNetNuke.Common.Internal using DotNetNuke.Instrumentation; using DotNetNuke.Services.Cache; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// Manages http routes for services (WebAPI, MVC, etc.). public static class ServicesRoutingManager { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ServicesRoutingManager)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(typeof(ServicesRoutingManager)); /// Registers all the service routes. public static void RegisterServiceRoutes() diff --git a/DNN Platform/Library/Common/Lists/ListInfoCollection.cs b/DNN Platform/Library/Common/Lists/ListInfoCollection.cs index 8ddbaa89d82..363ff7122aa 100644 --- a/DNN Platform/Library/Common/Lists/ListInfoCollection.cs +++ b/DNN Platform/Library/Common/Lists/ListInfoCollection.cs @@ -12,12 +12,13 @@ namespace DotNetNuke.Common.Lists using DotNetNuke.Instrumentation; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// Represents a collection of . [Serializable] public class ListInfoCollection(ListController listController) : GenericCollectionBase { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ListInfoCollection)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly ListController listController = listController ?? Globals.GetCurrentServiceProvider().GetRequiredService(); private readonly Dictionary mKeyIndexLookup = new Dictionary(StringComparer.OrdinalIgnoreCase); diff --git a/DNN Platform/Library/Common/Utilities/Config.cs b/DNN Platform/Library/Common/Utilities/Config.cs index 76dc9869fd2..e19d55f2f7e 100644 --- a/DNN Platform/Library/Common/Utilities/Config.cs +++ b/DNN Platform/Library/Common/Utilities/Config.cs @@ -22,11 +22,12 @@ namespace DotNetNuke.Common.Utilities using DotNetNuke.Services.Exceptions; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// The Config class provides access to the web.config file. public partial class Config { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(Config)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// Represents each configuration file. public enum ConfigFileType diff --git a/DNN Platform/Library/Common/Utilities/DataCache.cs b/DNN Platform/Library/Common/Utilities/DataCache.cs index 7b4a6f30baf..ab3a495e3f2 100644 --- a/DNN Platform/Library/Common/Utilities/DataCache.cs +++ b/DNN Platform/Library/Common/Utilities/DataCache.cs @@ -26,6 +26,7 @@ namespace DotNetNuke.Common.Utilities using DotNetNuke.Services.OutputCache; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; [Obsolete("Deprecated in DotNetNuke 9.13.8. This type has no known use. Scheduled for removal in v11.0.0.")] public enum CoreCacheType @@ -317,7 +318,7 @@ public partial class DataCache internal const string UserIdListToClearDiskImageCacheKey = "UserIdListToClearDiskImage_{0}"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(DataCache)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly ReaderWriterLockSlim DictionaryLock = new ReaderWriterLockSlim(); private static readonly Dictionary LockDictionary = new Dictionary(); diff --git a/DNN Platform/Library/Common/Utilities/FileSystemPermissionVerifier.cs b/DNN Platform/Library/Common/Utilities/FileSystemPermissionVerifier.cs index df56d6c0bce..d8c64df531f 100644 --- a/DNN Platform/Library/Common/Utilities/FileSystemPermissionVerifier.cs +++ b/DNN Platform/Library/Common/Utilities/FileSystemPermissionVerifier.cs @@ -9,11 +9,13 @@ namespace DotNetNuke.Common.Utilities using DotNetNuke.Common.Utilities.Internal; using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + /// Verifies the ability to create and delete files and folders. /// This class is not meant for use in modules, or in any other manner outside the DotNetNuke core. public class FileSystemPermissionVerifier { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(FileSystemPermissionVerifier)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly string basePath; private int retryTimes = 30; diff --git a/DNN Platform/Library/Common/Utilities/FileSystemUtils.cs b/DNN Platform/Library/Common/Utilities/FileSystemUtils.cs index 96d1bcef056..895bf66c02a 100644 --- a/DNN Platform/Library/Common/Utilities/FileSystemUtils.cs +++ b/DNN Platform/Library/Common/Utilities/FileSystemUtils.cs @@ -17,6 +17,7 @@ namespace DotNetNuke.Common.Utilities using DotNetNuke.Internal.SourceGenerators; using ICSharpCode.SharpZipLib.Zip; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; using Directory = SchwabenCode.QuickIO.QuickIODirectory; using DirectoryInfo = SchwabenCode.QuickIO.QuickIODirectoryInfo; @@ -25,7 +26,7 @@ namespace DotNetNuke.Common.Utilities /// File System utilities. public partial class FileSystemUtils { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(FileSystemUtils)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// Adds a File to a Zip File. /// The Zip File to add to. diff --git a/DNN Platform/Library/Common/Utilities/RetryableAction.cs b/DNN Platform/Library/Common/Utilities/RetryableAction.cs index 3428446976b..f43809659d9 100644 --- a/DNN Platform/Library/Common/Utilities/RetryableAction.cs +++ b/DNN Platform/Library/Common/Utilities/RetryableAction.cs @@ -10,13 +10,15 @@ namespace DotNetNuke.Common.Utilities.Internal using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + /// /// Allows an action to be run and retried after a delay when an exception is thrown. /// If the action never succeeds the final exception will be re-thrown for the caller to catch. /// public class RetryableAction { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(RetryableAction)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); static RetryableAction() { diff --git a/DNN Platform/Library/Common/Utilities/XmlUtils.cs b/DNN Platform/Library/Common/Utilities/XmlUtils.cs index 0a036abeab3..78efff904d8 100644 --- a/DNN Platform/Library/Common/Utilities/XmlUtils.cs +++ b/DNN Platform/Library/Common/Utilities/XmlUtils.cs @@ -21,10 +21,12 @@ namespace DotNetNuke.Common.Utilities using DotNetNuke.Internal.SourceGenerators; using DotNetNuke.Security.Permissions; + using Microsoft.Extensions.Logging; + /// The XmlUtils class provides Shared/Static methods for manipulating xml files. public partial class XmlUtils { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(XmlUtils)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); public static void AppendElement(ref XmlDocument objDoc, XmlNode objNode, string attName, string attValue, bool includeIfEmpty) { diff --git a/DNN Platform/Library/ComponentModel/ComponentFactory.cs b/DNN Platform/Library/ComponentModel/ComponentFactory.cs index 5fc32eed38f..1c6764115a3 100644 --- a/DNN Platform/Library/ComponentModel/ComponentFactory.cs +++ b/DNN Platform/Library/ComponentModel/ComponentFactory.cs @@ -9,9 +9,11 @@ namespace DotNetNuke.ComponentModel using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + public static class ComponentFactory { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ComponentFactory)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(typeof(ComponentFactory)); public static IContainer Container { get; set; } diff --git a/DNN Platform/Library/ComponentModel/ContainerWithServiceProviderFallback.cs b/DNN Platform/Library/ComponentModel/ContainerWithServiceProviderFallback.cs index 28b6bb2abf6..0d376dd419e 100644 --- a/DNN Platform/Library/ComponentModel/ContainerWithServiceProviderFallback.cs +++ b/DNN Platform/Library/ComponentModel/ContainerWithServiceProviderFallback.cs @@ -9,11 +9,12 @@ namespace DotNetNuke.ComponentModel; using DotNetNuke.Instrumentation; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; /// A container which gets components from an for components not registered. public class ContainerWithServiceProviderFallback : IContainer { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ContainerWithServiceProviderFallback)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IContainer container; private readonly IServiceProvider serviceProvider; diff --git a/DNN Platform/Library/ComponentModel/ProviderInstaller.cs b/DNN Platform/Library/ComponentModel/ProviderInstaller.cs index 39f6e18b108..eccb3fbddd8 100644 --- a/DNN Platform/Library/ComponentModel/ProviderInstaller.cs +++ b/DNN Platform/Library/ComponentModel/ProviderInstaller.cs @@ -11,9 +11,11 @@ namespace DotNetNuke.ComponentModel using DotNetNuke.Framework.Providers; using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + public class ProviderInstaller : IComponentInstaller { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ProviderInstaller)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly ComponentLifeStyleType componentLifeStyle; private readonly Type providerInterface; private readonly string providerType; diff --git a/DNN Platform/Library/Data/DataProvider.cs b/DNN Platform/Library/Data/DataProvider.cs index dea87b3dad4..1a66bc47a88 100644 --- a/DNN Platform/Library/Data/DataProvider.cs +++ b/DNN Platform/Library/Data/DataProvider.cs @@ -32,12 +32,13 @@ namespace DotNetNuke.Data using DotNetNuke.Services.Search.Entities; using Microsoft.ApplicationBlocks.Data; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// Base implementation of a provider of core database activities. public abstract partial class DataProvider { private const int DuplicateKey = 2601; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(DataProvider)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IApplicationStatusInfo appStatus; /// Initializes a new instance of the class. diff --git a/DNN Platform/Library/Data/PetaPoco/PetaPocoHelper.cs b/DNN Platform/Library/Data/PetaPoco/PetaPocoHelper.cs index 82df05371b7..2c7ad961532 100644 --- a/DNN Platform/Library/Data/PetaPoco/PetaPocoHelper.cs +++ b/DNN Platform/Library/Data/PetaPoco/PetaPocoHelper.cs @@ -13,11 +13,13 @@ namespace DotNetNuke.Data.PetaPoco using DotNetNuke.Instrumentation; using global::PetaPoco; + using Microsoft.Extensions.Logging; + public static class PetaPocoHelper { private const string SqlProviderName = "System.Data.SqlClient"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(PetaPocoHelper)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(typeof(PetaPocoHelper)); public static void ExecuteNonQuery(string connectionString, CommandType type, string sql, params object[] args) { diff --git a/DNN Platform/Library/Data/SqlDataProvider.cs b/DNN Platform/Library/Data/SqlDataProvider.cs index cc20726208c..1c6d0114c86 100644 --- a/DNN Platform/Library/Data/SqlDataProvider.cs +++ b/DNN Platform/Library/Data/SqlDataProvider.cs @@ -18,11 +18,12 @@ namespace DotNetNuke.Data using DotNetNuke.Instrumentation; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; public sealed class SqlDataProvider : DataProvider { private const string ScriptDelimiter = @"(?<=(?:[^\w]+|^))GO(?=(?: |\t)*?(?:\r?\n|$))"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(SqlDataProvider)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static DatabaseConnectionProvider dbConnectionProvider = DatabaseConnectionProvider.Instance() ?? new SqlDatabaseConnectionProvider(); /// Initializes a new instance of the class. diff --git a/DNN Platform/Library/Entities/Content/AttachmentController.cs b/DNN Platform/Library/Entities/Content/AttachmentController.cs index 00c8a8a00b1..ff6c9d614d1 100644 --- a/DNN Platform/Library/Entities/Content/AttachmentController.cs +++ b/DNN Platform/Library/Entities/Content/AttachmentController.cs @@ -15,6 +15,8 @@ namespace DotNetNuke.Entities.Content using DotNetNuke.Instrumentation; using DotNetNuke.Services.FileSystem; + using Microsoft.Extensions.Logging; + /// Implementation of . public class AttachmentController : IAttachmentController { @@ -23,7 +25,7 @@ public class AttachmentController : IAttachmentController internal const string VideoKey = "Videos"; internal const string TitleKey = "Title"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(AttachmentController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IContentController contentController; diff --git a/DNN Platform/Library/Entities/Controllers/HostController.cs b/DNN Platform/Library/Entities/Controllers/HostController.cs index 639cd4cbb61..5efaaff1bbb 100644 --- a/DNN Platform/Library/Entities/Controllers/HostController.cs +++ b/DNN Platform/Library/Entities/Controllers/HostController.cs @@ -25,11 +25,12 @@ namespace DotNetNuke.Entities.Controllers using DotNetNuke.Web.Client; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// public partial class HostController : IHostSettingsService { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(HostController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static PerformanceSettings performanceSettings = PerformanceSettings.ModerateCaching; private readonly IEventLogger eventLogger; private readonly Lazy portalController; diff --git a/DNN Platform/Library/Entities/Host/ServerController.cs b/DNN Platform/Library/Entities/Host/ServerController.cs index 65f12bd7cac..6a783dcd380 100644 --- a/DNN Platform/Library/Entities/Host/ServerController.cs +++ b/DNN Platform/Library/Entities/Host/ServerController.cs @@ -21,6 +21,7 @@ namespace DotNetNuke.Entities.Host using DotNetNuke.Services.Log.EventLog; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// Controller for web servers. public partial class ServerController @@ -31,7 +32,7 @@ public partial class ServerController private const int CacheTimeout = 20; private const CacheItemPriority CachePriority = CacheItemPriority.High; private static readonly DataProvider DataProvider = DataProvider.Instance(); - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ServerController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); public static bool UseAppName { diff --git a/DNN Platform/Library/Entities/Icons/IconController.cs b/DNN Platform/Library/Entities/Icons/IconController.cs index 405dafac199..783f1b7fb2b 100644 --- a/DNN Platform/Library/Entities/Icons/IconController.cs +++ b/DNN Platform/Library/Entities/Icons/IconController.cs @@ -15,6 +15,7 @@ namespace DotNetNuke.Entities.Icons using DotNetNuke.Instrumentation; using DotNetNuke.Internal.SourceGenerators; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// IconController provides all operation to icons. /// @@ -30,7 +31,7 @@ public partial class IconController public const string IconKeyName = "IconKey"; public const string IconSizeName = "IconSize"; public const string IconStyleName = "IconStyle"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(IconController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly SharedDictionary IconsStatusOnDisk = new SharedDictionary(); private static readonly char[] Comma = [',',]; diff --git a/DNN Platform/Library/Entities/Modules/DesktopModuleController.cs b/DNN Platform/Library/Entities/Modules/DesktopModuleController.cs index ba20b9d169b..89b4fa3caa8 100644 --- a/DNN Platform/Library/Entities/Modules/DesktopModuleController.cs +++ b/DNN Platform/Library/Entities/Modules/DesktopModuleController.cs @@ -33,12 +33,13 @@ namespace DotNetNuke.Entities.Modules using DotNetNuke.Services.Upgrade; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// DesktopModuleController provides the Business Layer for Desktop Modules. /// The event logger. public partial class DesktopModuleController(IEventLogger eventLogger) { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(DesktopModuleController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly DataProvider DataProvider = DataProvider.Instance(); private readonly IEventLogger eventLogger = eventLogger ?? Globals.GetCurrentServiceProvider().GetRequiredService(); diff --git a/DNN Platform/Library/Entities/Modules/EventMessageProcessor.cs b/DNN Platform/Library/Entities/Modules/EventMessageProcessor.cs index 8d2ba53f80d..c01ba23f452 100644 --- a/DNN Platform/Library/Entities/Modules/EventMessageProcessor.cs +++ b/DNN Platform/Library/Entities/Modules/EventMessageProcessor.cs @@ -20,11 +20,12 @@ namespace DotNetNuke.Entities.Modules using DotNetNuke.Services.Log.EventLog; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// The primary event message processor. public class EventMessageProcessor : EventMessageProcessorBase { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(EventMessageProcessor)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IBusinessControllerProvider businessControllerProvider; private readonly IEventLogger eventLogger; diff --git a/DNN Platform/Library/Entities/Modules/ModuleController.cs b/DNN Platform/Library/Entities/Modules/ModuleController.cs index 52e9e4c6983..9a558d9ea4a 100644 --- a/DNN Platform/Library/Entities/Modules/ModuleController.cs +++ b/DNN Platform/Library/Entities/Modules/ModuleController.cs @@ -46,6 +46,7 @@ namespace DotNetNuke.Entities.Modules using DotNetNuke.Services.Search.Entities; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// ModuleController provides the Business Layer for Modules. /// The event logger. @@ -54,7 +55,7 @@ namespace DotNetNuke.Entities.Modules public partial class ModuleController(IEventLogger eventLogger, IPermissionDefinitionService permissionDefinitionService, IHostSettings hostSettings) : ServiceLocator, IModuleController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ModuleController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly DataProvider DataProvider = DataProvider.Instance(); private readonly IEventLogger eventLogger = eventLogger ?? Globals.GetCurrentServiceProvider().GetRequiredService(); private readonly IPermissionDefinitionService permissionDefinitionService = permissionDefinitionService ?? Globals.GetCurrentServiceProvider().GetRequiredService(); diff --git a/DNN Platform/Library/Entities/Modules/ModuleInfo.cs b/DNN Platform/Library/Entities/Modules/ModuleInfo.cs index 271995d0c2e..7a24166e67b 100644 --- a/DNN Platform/Library/Entities/Modules/ModuleInfo.cs +++ b/DNN Platform/Library/Entities/Modules/ModuleInfo.cs @@ -24,6 +24,9 @@ namespace DotNetNuke.Entities.Modules using DotNetNuke.Services.Localization; using DotNetNuke.Services.ModuleCache; using DotNetNuke.Services.Tokens; + + using Microsoft.Extensions.Logging; + using Newtonsoft.Json; /// ModuleInfo provides the Entity Layer for Modules. @@ -31,7 +34,7 @@ namespace DotNetNuke.Entities.Modules [Serializable] public class ModuleInfo : ContentItem, IPropertyAccess { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ModuleInfo)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private string authorizedEditRoles; private string authorizedViewRoles; private string cultureCode; diff --git a/DNN Platform/Library/Entities/Modules/PortalModuleBase.cs b/DNN Platform/Library/Entities/Modules/PortalModuleBase.cs index d577791d816..e023738f507 100644 --- a/DNN Platform/Library/Entities/Modules/PortalModuleBase.cs +++ b/DNN Platform/Library/Entities/Modules/PortalModuleBase.cs @@ -24,6 +24,8 @@ namespace DotNetNuke.Entities.Modules using DotNetNuke.Services.Localization; using DotNetNuke.UI.Modules; + using Microsoft.Extensions.Logging; + /// /// The PortalModuleBase class defines a custom base class inherited by all /// desktop portal modules within the Portal. @@ -38,7 +40,7 @@ public partial class PortalModuleBase : UserControlBase, IModuleControl RegexOptions.IgnoreCase | RegexOptions.Compiled, TimeSpan.FromSeconds(1)); - private readonly ILog tracelLogger = LoggerSource.Instance.GetLogger("DNN.Trace"); + private readonly ILogger tracelLogger = DnnLoggingController.GetLogger("DNN.Trace"); private readonly Lazy serviceScopeContainer = new Lazy(ServiceScopeContainer.GetRequestOrCreateScope); private string localResourceFile; private ModuleInstanceContext moduleContext; diff --git a/DNN Platform/Library/Entities/Modules/Prompt/AddModule.cs b/DNN Platform/Library/Entities/Modules/Prompt/AddModule.cs index 847f921a954..c0d0271beee 100644 --- a/DNN Platform/Library/Entities/Modules/Prompt/AddModule.cs +++ b/DNN Platform/Library/Entities/Modules/Prompt/AddModule.cs @@ -20,11 +20,13 @@ namespace DotNetNuke.Entities.Modules.Prompt using DotNetNuke.Security.Permissions; using DotNetNuke.Services.Localization; + using Microsoft.Extensions.Logging; + /// This is a (Prompt) Console Command. You should not reference this class directly. It is to be used solely through Prompt. [ConsoleCommand("add-module", Constants.CommandCategoryKeys.Modules, "Prompt_AddModule_Description")] public class AddModule : ConsoleCommand { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(AddModule)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// public override string LocalResourceFile => Constants.DefaultPromptResourceFile; diff --git a/DNN Platform/Library/Entities/Portals/PortalController.cs b/DNN Platform/Library/Entities/Portals/PortalController.cs index bbab9980100..f5a7a5ae8c7 100644 --- a/DNN Platform/Library/Entities/Portals/PortalController.cs +++ b/DNN Platform/Library/Entities/Portals/PortalController.cs @@ -52,6 +52,7 @@ namespace DotNetNuke.Entities.Portals using DotNetNuke.Web.Client; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; using IAbPortalSettings = DotNetNuke.Abstractions.Portals.IPortalSettings; using ICryptographyProvider = DotNetNuke.Abstractions.Security.ICryptographyProvider; @@ -65,7 +66,7 @@ public partial class PortalController : ServiceLocator(); private readonly IBusinessControllerProvider businessControllerProvider; private readonly IHostSettings hostSettings; private readonly IApplicationStatusInfo appStatus; @@ -2881,7 +2882,7 @@ private void UpdatePortalInternal(PortalInfo portal, bool clearCache) [DnnDeprecated(9, 11, 1, "Use DotNetNuke.Entities.Portals.Templates.PortalTemplateInfo instead")] public partial class PortalTemplateInfo { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(PortalController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IHostSettings hostSettings; private readonly string originalCultureCode; private string resourceFilePath; diff --git a/DNN Platform/Library/Entities/Portals/PortalGroupController.cs b/DNN Platform/Library/Entities/Portals/PortalGroupController.cs index 11739298907..94f1bab1577 100644 --- a/DNN Platform/Library/Entities/Portals/PortalGroupController.cs +++ b/DNN Platform/Library/Entities/Portals/PortalGroupController.cs @@ -23,11 +23,12 @@ namespace DotNetNuke.Entities.Portals using DotNetNuke.Services.Log.EventLog; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// The default implementation. public class PortalGroupController : ComponentBase, IPortalGroupController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(PortalGroupController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IDataService dataService; private readonly IPortalController portalController; private readonly IHostSettings hostSettings; diff --git a/DNN Platform/Library/Entities/Portals/Templates/PortalTemplateImporter.cs b/DNN Platform/Library/Entities/Portals/Templates/PortalTemplateImporter.cs index 0bb83b45fe3..99f4ccebb9e 100644 --- a/DNN Platform/Library/Entities/Portals/Templates/PortalTemplateImporter.cs +++ b/DNN Platform/Library/Entities/Portals/Templates/PortalTemplateImporter.cs @@ -38,11 +38,13 @@ namespace DotNetNuke.Entities.Portals.Templates using DotNetNuke.Services.FileSystem; using DotNetNuke.Services.Localization; + using Microsoft.Extensions.Logging; + internal class PortalTemplateImporter { public const string HtmlTextTimeToAutoSave = "HtmlText_TimeToAutoSave"; public const string HtmlTextAutoSaveEnabled = "HtmlText_AutoSaveEnabled"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(PortalTemplateImporter)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IPermissionDefinitionService permissionDefinitionService; private readonly IBusinessControllerProvider businessControllerProvider; private readonly ListController listController; diff --git a/DNN Platform/Library/Entities/Portals/Templates/PortalTemplateInfo.cs b/DNN Platform/Library/Entities/Portals/Templates/PortalTemplateInfo.cs index d8e700de38d..8d118bff790 100644 --- a/DNN Platform/Library/Entities/Portals/Templates/PortalTemplateInfo.cs +++ b/DNN Platform/Library/Entities/Portals/Templates/PortalTemplateInfo.cs @@ -15,9 +15,11 @@ namespace DotNetNuke.Entities.Portals.Templates using DotNetNuke.Instrumentation; using DotNetNuke.Services.Localization; + using Microsoft.Extensions.Logging; + public class PortalTemplateInfo : IPortalTemplateInfo { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(PortalController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private string resourceFilePath; /// Initializes a new instance of the class. diff --git a/DNN Platform/Library/Entities/Profile/ProfileController.cs b/DNN Platform/Library/Entities/Profile/ProfileController.cs index 4fab0b6892f..f0a844aeae2 100644 --- a/DNN Platform/Library/Entities/Profile/ProfileController.cs +++ b/DNN Platform/Library/Entities/Profile/ProfileController.cs @@ -24,6 +24,7 @@ namespace DotNetNuke.Entities.Profile using DotNetNuke.Services.FileSystem; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// /// The ProfileController class provides Business Layer methods for profiles and @@ -31,7 +32,7 @@ namespace DotNetNuke.Entities.Profile /// public partial class ProfileController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ProfileController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly DataProvider DataProvider = DataProvider.Instance(); private static readonly ProfileProvider ProfileProvider = ProfileProvider.Instance(); private static int orderCounter; diff --git a/DNN Platform/Library/Entities/Tabs/TabController.cs b/DNN Platform/Library/Entities/Tabs/TabController.cs index 583db6d6d48..0c78c553eb5 100644 --- a/DNN Platform/Library/Entities/Tabs/TabController.cs +++ b/DNN Platform/Library/Entities/Tabs/TabController.cs @@ -44,6 +44,7 @@ namespace DotNetNuke.Entities.Tabs using DotNetNuke.Services.Search.Entities; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// TabController provides all operation to . /// @@ -54,7 +55,7 @@ namespace DotNetNuke.Entities.Tabs public partial class TabController(IEventLogger eventLogger, DataProvider dataProvider, IPermissionDefinitionService permissionDefinitionService, IHostSettings hostSettings, IApplicationStatusInfo appStatus) : ServiceLocator, ITabController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(TabController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly Regex TabNameCheck1 = new Regex("^LPT[1-9]$|^COM[1-9]$", RegexOptions.IgnoreCase); private static readonly Regex TabNameCheck2 = new Regex("^AUX$|^CON$|^NUL$|^SITEMAP$|^LINKCLICK$|^KEEPALIVE$|^DEFAULT$|^ERRORPAGE$|^LOGIN$|^REGISTER$", RegexOptions.IgnoreCase); diff --git a/DNN Platform/Library/Entities/Tabs/TabPublishingController.cs b/DNN Platform/Library/Entities/Tabs/TabPublishingController.cs index 91cb796ad5e..d584885603f 100644 --- a/DNN Platform/Library/Entities/Tabs/TabPublishingController.cs +++ b/DNN Platform/Library/Entities/Tabs/TabPublishingController.cs @@ -20,10 +20,11 @@ namespace DotNetNuke.Entities.Tabs using DotNetNuke.Services.Localization; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; public class TabPublishingController : ServiceLocator, ITabPublishingController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(TabPublishingController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IPermissionDefinitionService permissionDefinitionService; /// Initializes a new instance of the class. diff --git a/DNN Platform/Library/Entities/Tabs/TabVersions/TabVersionBuilder.cs b/DNN Platform/Library/Entities/Tabs/TabVersions/TabVersionBuilder.cs index ceeb68a038a..b3248d87263 100644 --- a/DNN Platform/Library/Entities/Tabs/TabVersions/TabVersionBuilder.cs +++ b/DNN Platform/Library/Entities/Tabs/TabVersions/TabVersionBuilder.cs @@ -23,6 +23,7 @@ namespace DotNetNuke.Entities.Tabs.TabVersions using DotNetNuke.Services.Localization; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// An implementation. /// The business controller provider. @@ -31,7 +32,7 @@ public class TabVersionBuilder(IBusinessControllerProvider businessControllerPro : ServiceLocator, ITabVersionBuilder { private const int DefaultVersionNumber = 1; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(TabVersionBuilder)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IBusinessControllerProvider businessControllerProvider = businessControllerProvider ?? Globals.GetCurrentServiceProvider().GetRequiredService(); private readonly IHostSettings hostSettings = hostSettings ?? Globals.GetCurrentServiceProvider().GetRequiredService(); private readonly ITabController tabController = TabController.Instance; diff --git a/DNN Platform/Library/Entities/Tabs/TabWorkflowTracker.cs b/DNN Platform/Library/Entities/Tabs/TabWorkflowTracker.cs index 72ee144b6ca..2818bf53367 100644 --- a/DNN Platform/Library/Entities/Tabs/TabWorkflowTracker.cs +++ b/DNN Platform/Library/Entities/Tabs/TabWorkflowTracker.cs @@ -15,9 +15,11 @@ namespace DotNetNuke.Entities.Tabs using DotNetNuke.Instrumentation; using DotNetNuke.Services.Exceptions; + using Microsoft.Extensions.Logging; + internal class TabWorkflowTracker : ServiceLocator, ITabChangeTracker { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(TabWorkflowTracker)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly ITabController tabController; private readonly IWorkflowEngine workflowEngine; private readonly IWorkflowManager workflowManager; diff --git a/DNN Platform/Library/Entities/Urls/Config/RewriterConfiguration.cs b/DNN Platform/Library/Entities/Urls/Config/RewriterConfiguration.cs index 7a88fffee69..515dc14a15b 100644 --- a/DNN Platform/Library/Entities/Urls/Config/RewriterConfiguration.cs +++ b/DNN Platform/Library/Entities/Urls/Config/RewriterConfiguration.cs @@ -15,11 +15,13 @@ namespace DotNetNuke.Entities.Urls.Config using DotNetNuke.Services.Cache; using DotNetNuke.Services.Log.EventLog; + using Microsoft.Extensions.Logging; + [Serializable] [XmlRoot("RewriterConfig")] public class RewriterConfiguration { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(RewriterConfiguration)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly object ThreadLocker = new object(); private RewriterRuleCollection rules; diff --git a/DNN Platform/Library/Entities/Urls/UrlRewriterUtils.cs b/DNN Platform/Library/Entities/Urls/UrlRewriterUtils.cs index ea8ccd8b49e..58b5bbbaed8 100644 --- a/DNN Platform/Library/Entities/Urls/UrlRewriterUtils.cs +++ b/DNN Platform/Library/Entities/Urls/UrlRewriterUtils.cs @@ -13,9 +13,11 @@ namespace DotNetNuke.Entities.Urls using DotNetNuke.Services.Log.EventLog; using DotNetNuke.Services.UserRequest; + using Microsoft.Extensions.Logging; + public static class UrlRewriterUtils { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(UrlRewriterUtils)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(typeof(UrlRewriterUtils)); /// Return a FriendlyUrlOptions object from the provider settings. /// The settings. diff --git a/DNN Platform/Library/Entities/Users/Profile/UserProfile.cs b/DNN Platform/Library/Entities/Users/Profile/UserProfile.cs index fcda056b929..290a28bfcf3 100644 --- a/DNN Platform/Library/Entities/Users/Profile/UserProfile.cs +++ b/DNN Platform/Library/Entities/Users/Profile/UserProfile.cs @@ -387,7 +387,7 @@ public string GetPropertyValue(string propName) var dataType = listController.GetListEntryInfo("DataType", profileProp.DataType); if (dataType == null) { - LoggerSource.Instance.GetLogger(typeof(UserProfile)).ErrorFormat(CultureInfo.InvariantCulture, "Invalid data type {0} for profile property {1}", profileProp.DataType, profileProp.PropertyName); + DnnLoggingController.GetLogger().ErrorFormat(CultureInfo.InvariantCulture, "Invalid data type {0} for profile property {1}", profileProp.DataType, profileProp.PropertyName); return propValue; } diff --git a/DNN Platform/Library/Entities/Users/Users Online/UserOnlineController.cs b/DNN Platform/Library/Entities/Users/Users Online/UserOnlineController.cs index ff3debc8cf0..0eb4e6848be 100644 --- a/DNN Platform/Library/Entities/Users/Users Online/UserOnlineController.cs +++ b/DNN Platform/Library/Entities/Users/Users Online/UserOnlineController.cs @@ -14,13 +14,15 @@ namespace DotNetNuke.Entities.Users using DotNetNuke.Instrumentation; using DotNetNuke.Internal.SourceGenerators; + using Microsoft.Extensions.Logging; + using MembershipProvider = DotNetNuke.Security.Membership.MembershipProvider; /// The UserOnlineController class provides Business Layer methods for Users Online. [DnnDeprecated(8, 0, 0, "Other solutions exist outside of the DNN Platform", RemovalVersion = 11)] public partial class UserOnlineController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(UserOnlineController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly MembershipProvider MemberProvider = MembershipProvider.Instance(); private static readonly object Locker = new object(); private static readonly string CacheKey = "OnlineUserList"; diff --git a/DNN Platform/Library/Framework/PageBase.cs b/DNN Platform/Library/Framework/PageBase.cs index a0361e34529..e89b9679ebb 100644 --- a/DNN Platform/Library/Framework/PageBase.cs +++ b/DNN Platform/Library/Framework/PageBase.cs @@ -27,15 +27,16 @@ namespace DotNetNuke.Framework using DotNetNuke.Web.Client.ClientResourceManagement; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// PageBase provides a custom DotNetNuke base class for pages. public abstract class PageBase : Page { private const string LinkItemPattern = "<(a|link|img|script|input|form|object).[^>]*(href|src|action)=(\\\"|'|)(.[^\\\"']*)(\\\"|'|)[^>]*>"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(PageBase)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly Regex LinkItemMatchRegex = new Regex(LinkItemPattern, RegexOptions.IgnoreCase | RegexOptions.Compiled); - private readonly ILog traceLogger = LoggerSource.Instance.GetLogger("DNN.Trace"); + private readonly ILogger traceLogger = DnnLoggingController.GetLogger("DNN.Trace"); private readonly ArrayList localizedControls = []; private PageStatePersister persister; diff --git a/DNN Platform/Library/Framework/Reflection.cs b/DNN Platform/Library/Framework/Reflection.cs index 66ea9554aec..ab03f792bd4 100644 --- a/DNN Platform/Library/Framework/Reflection.cs +++ b/DNN Platform/Library/Framework/Reflection.cs @@ -16,11 +16,12 @@ namespace DotNetNuke.Framework using DotNetNuke.Services.Exceptions; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// Library responsible for reflection. public partial class Reflection { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(Reflection)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// Creates an object. /// The type of Object to create (data/navigation). diff --git a/DNN Platform/Library/Security/Membership/AspNetMembershipProvider.cs b/DNN Platform/Library/Security/Membership/AspNetMembershipProvider.cs index 35c6fa4b4f1..87ac9830bbe 100644 --- a/DNN Platform/Library/Security/Membership/AspNetMembershipProvider.cs +++ b/DNN Platform/Library/Security/Membership/AspNetMembershipProvider.cs @@ -32,11 +32,12 @@ namespace DotNetNuke.Security.Membership using DotNetNuke.Services.Localization; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// The AspNetMembershipProvider overrides the default MembershipProvider to provide an AspNet Membership Component (MemberRole) implementation. public partial class AspNetMembershipProvider : MembershipProvider { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(AspNetMembershipProvider)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static Random random = new Random(); private readonly DataProvider dataProvider = DataProvider.Instance(); diff --git a/DNN Platform/Library/Security/Roles/DNNRoleProvider.cs b/DNN Platform/Library/Security/Roles/DNNRoleProvider.cs index ea5a0c6f6df..f28f1be85fd 100644 --- a/DNN Platform/Library/Security/Roles/DNNRoleProvider.cs +++ b/DNN Platform/Library/Security/Roles/DNNRoleProvider.cs @@ -21,6 +21,7 @@ namespace DotNetNuke.Security.Roles using DotNetNuke.Security.Membership; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// /// The DNNRoleProvider overrides the default MembershipProvider to provide @@ -28,7 +29,7 @@ namespace DotNetNuke.Security.Roles /// public class DNNRoleProvider(IHostSettings hostSettings, DataProvider dataProvider, IUserController userController) : RoleProvider { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(DNNRoleProvider)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IHostSettings hostSettings = hostSettings ?? Globals.GetCurrentServiceProvider().GetRequiredService(); private readonly DataProvider dataProvider = dataProvider ?? Globals.GetCurrentServiceProvider().GetRequiredService(); private readonly IUserController userController = userController ?? Globals.GetCurrentServiceProvider().GetRequiredService(); diff --git a/DNN Platform/Library/Security/Roles/RoleController.cs b/DNN Platform/Library/Security/Roles/RoleController.cs index 49c773d77e2..d1f6ac11f1b 100644 --- a/DNN Platform/Library/Security/Roles/RoleController.cs +++ b/DNN Platform/Library/Security/Roles/RoleController.cs @@ -29,11 +29,12 @@ namespace DotNetNuke.Security.Roles using DotNetNuke.Services.Search.Entities; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// The RoleController class provides Business Layer methods for Roles. public class RoleController : ServiceLocator, IRoleController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(RoleController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly string[] UserRoleActionsCaption = ["ASSIGNMENT", "UPDATE", "UNASSIGNMENT"]; private readonly RoleProvider roleProvider; private readonly IHostSettings hostSettings; diff --git a/DNN Platform/Library/Services/Analytics/Config/AnalyticsConfiguration.cs b/DNN Platform/Library/Services/Analytics/Config/AnalyticsConfiguration.cs index 1e80c43eaf1..5dfde3572c3 100644 --- a/DNN Platform/Library/Services/Analytics/Config/AnalyticsConfiguration.cs +++ b/DNN Platform/Library/Services/Analytics/Config/AnalyticsConfiguration.cs @@ -18,11 +18,13 @@ namespace DotNetNuke.Services.Analytics.Config using DotNetNuke.Services.Cache; using DotNetNuke.Services.Log.EventLog; + using Microsoft.Extensions.Logging; + [Serializable] [XmlRoot("AnalyticsConfig")] public class AnalyticsConfiguration { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(AnalyticsConfiguration)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private AnalyticsRuleCollection rules; private AnalyticsSettingCollection settings; diff --git a/DNN Platform/Library/Services/Analytics/GoogleAnalyticsController.cs b/DNN Platform/Library/Services/Analytics/GoogleAnalyticsController.cs index e1a09ce29a0..ec785b98e9c 100644 --- a/DNN Platform/Library/Services/Analytics/GoogleAnalyticsController.cs +++ b/DNN Platform/Library/Services/Analytics/GoogleAnalyticsController.cs @@ -16,10 +16,12 @@ namespace DotNetNuke.Services.Analytics using DotNetNuke.Instrumentation; using DotNetNuke.Services.Log.EventLog; + using Microsoft.Extensions.Logging; + /// Controller class definition for GoogleAnalytics which handles upgrades. public class GoogleAnalyticsController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(GoogleAnalyticsController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// Handles module upgrades includes a new Google Analytics Asynchronous script. /// The upgrade version. diff --git a/DNN Platform/Library/Services/Authentication/AuthenticationConfig.cs b/DNN Platform/Library/Services/Authentication/AuthenticationConfig.cs index 3d7c645c15e..eca85df8831 100644 --- a/DNN Platform/Library/Services/Authentication/AuthenticationConfig.cs +++ b/DNN Platform/Library/Services/Authentication/AuthenticationConfig.cs @@ -9,12 +9,14 @@ namespace DotNetNuke.Services.Authentication using DotNetNuke.Entities.Portals; using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + /// The AuthenticationConfig class provides a configuration class for the DNN Authentication provider. [Serializable] public class AuthenticationConfig : AuthenticationConfigBase { private const string CACHEKEY = "Authentication.DNN"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(AuthenticationConfig)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// Initializes a new instance of the class. /// The portal ID. diff --git a/DNN Platform/Library/Services/Authentication/AuthenticationController.cs b/DNN Platform/Library/Services/Authentication/AuthenticationController.cs index c8b1ad27267..4454e72c833 100644 --- a/DNN Platform/Library/Services/Authentication/AuthenticationController.cs +++ b/DNN Platform/Library/Services/Authentication/AuthenticationController.cs @@ -24,11 +24,12 @@ namespace DotNetNuke.Services.Authentication using DotNetNuke.Services.Log.EventLog; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// The AuthenticationController class provides the Business Layer for the Authentication Systems. public partial class AuthenticationController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(AuthenticationController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly DataProvider Provider = DataProvider.Instance(); /// AddAuthentication adds a new Authentication System to the Data Store. diff --git a/DNN Platform/Library/Services/Authentication/OAuth/OAuthClientBase.cs b/DNN Platform/Library/Services/Authentication/OAuth/OAuthClientBase.cs index a50313ed3fe..9d5ceb17041 100644 --- a/DNN Platform/Library/Services/Authentication/OAuth/OAuthClientBase.cs +++ b/DNN Platform/Library/Services/Authentication/OAuth/OAuthClientBase.cs @@ -23,6 +23,8 @@ namespace DotNetNuke.Services.Authentication.OAuth using DotNetNuke.Security.Membership; using DotNetNuke.Services.Localization; + using Microsoft.Extensions.Logging; + /// A base class for an OAuth client. public abstract class OAuthClientBase { @@ -54,7 +56,7 @@ public abstract class OAuthClientBase // Directory implementation of OAuth V2 private const string OAuthResourceKey = "resource"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(OAuthClientBase)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly Random random = new Random(); diff --git a/DNN Platform/Library/Services/Cache/CachingProvider.cs b/DNN Platform/Library/Services/Cache/CachingProvider.cs index 168c489f903..38b7273e7e5 100644 --- a/DNN Platform/Library/Services/Cache/CachingProvider.cs +++ b/DNN Platform/Library/Services/Cache/CachingProvider.cs @@ -26,6 +26,7 @@ namespace DotNetNuke.Services.Cache using DotNetNuke.Services.Localization; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// CachingProvider provides basic component of cache system, by default it will use HttpRuntime.Cache. /// @@ -46,7 +47,7 @@ namespace DotNetNuke.Services.Cache public abstract class CachingProvider { private const string CachePrefix = "DNN_"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(CachingProvider)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static System.Web.Caching.Cache cache; /// Initializes a new instance of the class. diff --git a/DNN Platform/Library/Services/Cache/FBCachingProvider.cs b/DNN Platform/Library/Services/Cache/FBCachingProvider.cs index 671119773b2..ec82021d640 100644 --- a/DNN Platform/Library/Services/Cache/FBCachingProvider.cs +++ b/DNN Platform/Library/Services/Cache/FBCachingProvider.cs @@ -16,13 +16,15 @@ namespace DotNetNuke.Services.Cache using DotNetNuke.Common.Utilities; using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + public class FBCachingProvider : CachingProvider { [SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMustBePrivate", Justification = "Breaking change")] internal const string CacheFileExtension = ".resources"; [SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMustBePrivate", Justification = "Breaking change")] internal static string CachingDirectory = "Cache\\"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(FBCachingProvider)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// Initializes a new instance of the class. [Obsolete("Deprecated in DotNetNuke 10.0.2. Please use overload with IHostSettings. Scheduled removal in v12.0.0.")] diff --git a/DNN Platform/Library/Services/Exceptions/BasePortalException.cs b/DNN Platform/Library/Services/Exceptions/BasePortalException.cs index dc91b50c23d..3ff3af24707 100644 --- a/DNN Platform/Library/Services/Exceptions/BasePortalException.cs +++ b/DNN Platform/Library/Services/Exceptions/BasePortalException.cs @@ -15,12 +15,15 @@ namespace DotNetNuke.Services.Exceptions using DotNetNuke.Entities.Users; using DotNetNuke.Framework.Providers; using DotNetNuke.Instrumentation; + + using Microsoft.Extensions.Logging; + using Newtonsoft.Json; /// Base Portal Exception. public class BasePortalException : Exception { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(BasePortalException)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private string innerExceptionString; private string message; private string source; diff --git a/DNN Platform/Library/Services/Exceptions/Exceptions.cs b/DNN Platform/Library/Services/Exceptions/Exceptions.cs index 93b811a83d6..861e6196428 100644 --- a/DNN Platform/Library/Services/Exceptions/Exceptions.cs +++ b/DNN Platform/Library/Services/Exceptions/Exceptions.cs @@ -23,6 +23,8 @@ namespace DotNetNuke.Services.Exceptions using DotNetNuke.Services.Localization; using DotNetNuke.Services.Log.EventLog; using DotNetNuke.UI.Modules; + + using Microsoft.Extensions.Logging; using Microsoft.VisualBasic.CompilerServices; /// Exceptions class provides operation to log most of the exceptions occurred in system. @@ -49,7 +51,7 @@ namespace DotNetNuke.Services.Exceptions [StandardModule] public sealed class Exceptions { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(Exceptions)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// Gets the exception info. /// The exception. diff --git a/DNN Platform/Library/Services/Exceptions/SecurityException.cs b/DNN Platform/Library/Services/Exceptions/SecurityException.cs index 84baaf4ffd4..586b268baeb 100644 --- a/DNN Platform/Library/Services/Exceptions/SecurityException.cs +++ b/DNN Platform/Library/Services/Exceptions/SecurityException.cs @@ -11,9 +11,11 @@ namespace DotNetNuke.Services.Exceptions using DotNetNuke.Instrumentation; using DotNetNuke.Services.UserRequest; + using Microsoft.Extensions.Logging; + public class SecurityException : BasePortalException { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(SecurityException)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private string ip; private string querystring; diff --git a/DNN Platform/Library/Services/FileSystem/FileInfo.cs b/DNN Platform/Library/Services/FileSystem/FileInfo.cs index 7011581c0ed..4942207c69d 100644 --- a/DNN Platform/Library/Services/FileSystem/FileInfo.cs +++ b/DNN Platform/Library/Services/FileSystem/FileInfo.cs @@ -18,6 +18,9 @@ namespace DotNetNuke.Services.FileSystem using DotNetNuke.Entities.Modules; using DotNetNuke.Entities.Portals; using DotNetNuke.Instrumentation; + + using Microsoft.Extensions.Logging; + using Newtonsoft.Json; /// Represents the File object and holds the Properties of that object. @@ -25,7 +28,7 @@ namespace DotNetNuke.Services.FileSystem [Serializable] public class FileInfo : BaseEntityInfo, IHydratable, IFileInfo { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(FileInfo)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private string folder; private bool? supportsFileAttributes; private DateTime? lastModificationTime; diff --git a/DNN Platform/Library/Services/FileSystem/FileManager.cs b/DNN Platform/Library/Services/FileSystem/FileManager.cs index f0754f1fac8..858daa81752 100644 --- a/DNN Platform/Library/Services/FileSystem/FileManager.cs +++ b/DNN Platform/Library/Services/FileSystem/FileManager.cs @@ -36,6 +36,7 @@ namespace DotNetNuke.Services.FileSystem using DotNetNuke.Services.Log.EventLog; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; using Localization = DotNetNuke.Services.Localization.Localization; @@ -44,7 +45,7 @@ public class FileManager(IFileSecurityController fileSecurityController, IFileLo : ComponentBase, IFileManager { private const int BufferSize = 4096; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(FileManager)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IFolderManager folderManager = FolderManager.Instance; private readonly IFileSecurityController fileSecurityController = fileSecurityController ?? Globals.GetCurrentServiceProvider().GetRequiredService(); diff --git a/DNN Platform/Library/Services/FileSystem/FileServerHandler.cs b/DNN Platform/Library/Services/FileSystem/FileServerHandler.cs index 6df720222a4..50f1a360892 100644 --- a/DNN Platform/Library/Services/FileSystem/FileServerHandler.cs +++ b/DNN Platform/Library/Services/FileSystem/FileServerHandler.cs @@ -19,9 +19,11 @@ namespace DotNetNuke.Services.FileSystem using DotNetNuke.Services.FileSystem.EventArgs; using DotNetNuke.Services.Localization; + using Microsoft.Extensions.Logging; + public class FileServerHandler : IHttpHandler { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(FileServerHandler)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// public bool IsReusable => true; diff --git a/DNN Platform/Library/Services/FileSystem/FolderManager.cs b/DNN Platform/Library/Services/FileSystem/FolderManager.cs index e4ac4f16057..c67ed1119a3 100644 --- a/DNN Platform/Library/Services/FileSystem/FolderManager.cs +++ b/DNN Platform/Library/Services/FileSystem/FolderManager.cs @@ -35,6 +35,7 @@ namespace DotNetNuke.Services.FileSystem using DotNetNuke.Services.Log.EventLog; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; using Localization = DotNetNuke.Services.Localization.Localization; @@ -43,7 +44,7 @@ public class FolderManager : ComponentBase, IFold { private const string DefaultUsersFoldersPath = "Users"; private const string DefaultMappedPathSetting = "DefaultMappedPath"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(FolderManager)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly ConcurrentDictionary SyncFoldersData = new ConcurrentDictionary(); private static readonly object ThreadLocker = new object(); private readonly IEventLogger eventLogger; diff --git a/DNN Platform/Library/Services/FileSystem/FolderMappings/FolderMappingsConfigController.cs b/DNN Platform/Library/Services/FileSystem/FolderMappings/FolderMappingsConfigController.cs index c7f1e13e733..502f1845ca1 100644 --- a/DNN Platform/Library/Services/FileSystem/FolderMappings/FolderMappingsConfigController.cs +++ b/DNN Platform/Library/Services/FileSystem/FolderMappings/FolderMappingsConfigController.cs @@ -14,11 +14,13 @@ namespace DotNetNuke.Services.FileSystem using DotNetNuke.Instrumentation; using DotNetNuke.Services.FileSystem.FolderMappings; + using Microsoft.Extensions.Logging; + public class FolderMappingsConfigController : ServiceLocator, IFolderMappingsConfigController { private const string ConfigNodeValue = "folderMappingsSettings"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(FolderMappingsConfigController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly string DefaultConfigFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DotNetNuke.folderMappings.config"); /// Initializes a new instance of the class. diff --git a/DNN Platform/Library/Services/FileSystem/Internal/FileDeletionController.cs b/DNN Platform/Library/Services/FileSystem/Internal/FileDeletionController.cs index 9e18af04f4e..ea283790e93 100644 --- a/DNN Platform/Library/Services/FileSystem/Internal/FileDeletionController.cs +++ b/DNN Platform/Library/Services/FileSystem/Internal/FileDeletionController.cs @@ -14,13 +14,14 @@ namespace DotNetNuke.Services.FileSystem.Internal using DotNetNuke.Instrumentation; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; using Localization = DotNetNuke.Services.Localization.Localization; public class FileDeletionController(IFileLockingController fileLockingController, IFileVersionController fileVersionController, IFolderMappingController folderMappingController, IContentController contentController, DataProvider dataProvider) : ServiceLocator, IFileDeletionController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(FileDeletionController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IFileLockingController fileLockingController = fileLockingController ?? Globals.GetCurrentServiceProvider().GetRequiredService(); private readonly IFileVersionController fileVersionController = fileVersionController ?? Globals.GetCurrentServiceProvider().GetRequiredService(); private readonly IFolderMappingController folderMappingController = folderMappingController ?? Globals.GetCurrentServiceProvider().GetRequiredService(); diff --git a/DNN Platform/Library/Services/FileSystem/Internal/FileSecurityController.cs b/DNN Platform/Library/Services/FileSystem/Internal/FileSecurityController.cs index 1a62ee2e074..3e2f0d9de67 100644 --- a/DNN Platform/Library/Services/FileSystem/Internal/FileSecurityController.cs +++ b/DNN Platform/Library/Services/FileSystem/Internal/FileSecurityController.cs @@ -13,12 +13,13 @@ namespace DotNetNuke.Services.FileSystem.Internal using DotNetNuke.Instrumentation; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// Internal class to check file security. public class FileSecurityController(IServiceProvider serviceProvider) : ServiceLocator, IFileSecurityController { private const int BufferSize = 4096; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(FileSecurityController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IServiceProvider serviceProvider = serviceProvider ?? Globals.GetCurrentServiceProvider(); /// Initializes a new instance of the class. diff --git a/DNN Platform/Library/Services/FileSystem/Providers/StandardFolderProvider.cs b/DNN Platform/Library/Services/FileSystem/Providers/StandardFolderProvider.cs index e50689537b1..4ad9b62d656 100644 --- a/DNN Platform/Library/Services/FileSystem/Providers/StandardFolderProvider.cs +++ b/DNN Platform/Library/Services/FileSystem/Providers/StandardFolderProvider.cs @@ -21,9 +21,11 @@ namespace DotNetNuke.Services.FileSystem using DotNetNuke.Instrumentation; using DotNetNuke.Services.FileSystem.Internal; + using Microsoft.Extensions.Logging; + public class StandardFolderProvider : FolderProvider { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(StandardFolderProvider)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly char[] InvalidFileUrlChars = new char[] { '%', ';', '?', ':', '@', '&', '=', '+', '$', ',' }; diff --git a/DNN Platform/Library/Services/Installer/Installer.cs b/DNN Platform/Library/Services/Installer/Installer.cs index a34924a7e7d..3deb08ae36a 100644 --- a/DNN Platform/Library/Services/Installer/Installer.cs +++ b/DNN Platform/Library/Services/Installer/Installer.cs @@ -24,10 +24,12 @@ namespace DotNetNuke.Services.Installer using DotNetNuke.Services.Installer.Writers; using DotNetNuke.Services.Log.EventLog; + using Microsoft.Extensions.Logging; + /// The Installer class provides a single entrypoint for Package Installation. public class Installer : IDisposable { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(Installer)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly MemoryStream inputStream; /// diff --git a/DNN Platform/Library/Services/Installer/Installers/CleanupInstaller.cs b/DNN Platform/Library/Services/Installer/Installers/CleanupInstaller.cs index 267ff0a8022..a55966d6b71 100644 --- a/DNN Platform/Library/Services/Installer/Installers/CleanupInstaller.cs +++ b/DNN Platform/Library/Services/Installer/Installers/CleanupInstaller.cs @@ -17,11 +17,12 @@ namespace DotNetNuke.Services.Installer.Installers using DotNetNuke.Instrumentation; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.FileSystemGlobbing; + using Microsoft.Extensions.Logging; /// The CleanupInstaller cleans up (removes) files from previous versions. public class CleanupInstaller : FileInstaller { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(CleanupInstaller)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IList folders = new List(); private readonly IApplicationStatusInfo applicationStatusInfo; diff --git a/DNN Platform/Library/Services/Installer/Installers/ResourceFileInstaller.cs b/DNN Platform/Library/Services/Installer/Installers/ResourceFileInstaller.cs index 3119af9dabd..4811683b2eb 100644 --- a/DNN Platform/Library/Services/Installer/Installers/ResourceFileInstaller.cs +++ b/DNN Platform/Library/Services/Installer/Installers/ResourceFileInstaller.cs @@ -14,6 +14,8 @@ namespace DotNetNuke.Services.Installer.Installers using DotNetNuke.Common.Utilities; using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + /// The ResourceFileInstaller installs Resource File Components (zips) to a DotNetNuke site. public class ResourceFileInstaller : FileInstaller { @@ -23,7 +25,7 @@ public class ResourceFileInstaller : FileInstaller // ReSharper disable once InconsistentNaming public const string DEFAULT_MANIFESTEXT = ".manifest"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ResourceFileInstaller)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private string manifest; /// diff --git a/DNN Platform/Library/Services/Installer/LegacyUtil.cs b/DNN Platform/Library/Services/Installer/LegacyUtil.cs index 7057a2701b6..8faf8598e12 100644 --- a/DNN Platform/Library/Services/Installer/LegacyUtil.cs +++ b/DNN Platform/Library/Services/Installer/LegacyUtil.cs @@ -19,6 +19,9 @@ namespace DotNetNuke.Services.Installer using DotNetNuke.Services.Installer.Writers; using DotNetNuke.Services.Localization; using DotNetNuke.UI.Skins; + + using Microsoft.Extensions.Logging; + using Newtonsoft.Json; /// @@ -27,7 +30,7 @@ namespace DotNetNuke.Services.Installer /// public class LegacyUtil { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(LegacyUtil)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static string adminModules = "Adsense, MarketShare, Authentication, Banners, FeedExplorer, FileManager, HostSettings, Lists, LogViewer, Newsletters, PortalAliases, Portals, RecycleBin, Scheduler, SearchAdmin, SearchInput, SearchResults, Security, SiteLog, SiteWizard, SQL, Tabs, Vendors,"; diff --git a/DNN Platform/Library/Services/Installer/Log/Logger.cs b/DNN Platform/Library/Services/Installer/Log/Logger.cs index 49c6b2107ad..984f2aba483 100644 --- a/DNN Platform/Library/Services/Installer/Log/Logger.cs +++ b/DNN Platform/Library/Services/Installer/Log/Logger.cs @@ -10,10 +10,12 @@ namespace DotNetNuke.Services.Installer.Log using DotNetNuke.Common.Utilities; using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + /// The Logger class provides an Installer Log. public class Logger { - private static readonly ILog DnnLogger = LoggerSource.Instance.GetLogger(typeof(Logger)); + private static readonly ILogger DnnLogger = DnnLoggingController.GetLogger(); private readonly List logs; private string errorClass; private bool hasWarnings; diff --git a/DNN Platform/Library/Services/Installer/Writers/ModulePackageWriter.cs b/DNN Platform/Library/Services/Installer/Writers/ModulePackageWriter.cs index 4cef70e114c..aeff6cab0e1 100644 --- a/DNN Platform/Library/Services/Installer/Writers/ModulePackageWriter.cs +++ b/DNN Platform/Library/Services/Installer/Writers/ModulePackageWriter.cs @@ -19,10 +19,12 @@ namespace DotNetNuke.Services.Installer.Writers using DotNetNuke.Security; using DotNetNuke.Services.Installer.Packages; + using Microsoft.Extensions.Logging; + /// The ModulePackageWriter class. public class ModulePackageWriter : PackageWriterBase { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ModulePackageWriter)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// Initializes a new instance of the class. /// The legacy manifest XPath navigator. diff --git a/DNN Platform/Library/Services/Localization/Localization.cs b/DNN Platform/Library/Services/Localization/Localization.cs index e1baad4cc33..09b359ea02f 100644 --- a/DNN Platform/Library/Services/Localization/Localization.cs +++ b/DNN Platform/Library/Services/Localization/Localization.cs @@ -33,6 +33,7 @@ namespace DotNetNuke.Services.Localization using DotNetNuke.UI.Modules; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// Localization class support localization in system. /// @@ -56,7 +57,7 @@ namespace DotNetNuke.Services.Localization /// public partial class Localization { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(Localization)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static string defaultKeyName = "resourcekey"; ////private static readonly ILocaleController LocaleController.Instance = LocaleController.Instance; diff --git a/DNN Platform/Library/Services/Localization/LocalizationProvider.cs b/DNN Platform/Library/Services/Localization/LocalizationProvider.cs index 679d04cbaa8..7752faf8ce3 100644 --- a/DNN Platform/Library/Services/Localization/LocalizationProvider.cs +++ b/DNN Platform/Library/Services/Localization/LocalizationProvider.cs @@ -26,6 +26,7 @@ namespace DotNetNuke.Services.Localization using DotNetNuke.Services.Cache; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// An implementation. /// The host settings. @@ -33,7 +34,7 @@ namespace DotNetNuke.Services.Localization public class LocalizationProvider(IHostSettings hostSettings, IApplicationStatusInfo appStatus) : ComponentBase, ILocalizationProvider { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(LocalizationProvider)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IHostSettings hostSettings = hostSettings ?? Globals.GetCurrentServiceProvider().GetRequiredService(); private readonly IApplicationStatusInfo appStatus = appStatus ?? Globals.GetCurrentServiceProvider().GetRequiredService(); diff --git a/DNN Platform/Library/Services/Log/EventLog/DBLoggingProvider.cs b/DNN Platform/Library/Services/Log/EventLog/DBLoggingProvider.cs index f5f14abdf5c..27f4c084654 100644 --- a/DNN Platform/Library/Services/Log/EventLog/DBLoggingProvider.cs +++ b/DNN Platform/Library/Services/Log/EventLog/DBLoggingProvider.cs @@ -25,6 +25,7 @@ namespace DotNetNuke.Services.Log.EventLog using DotNetNuke.Services.Scheduling; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; public class DBLoggingProvider : LoggingProvider { @@ -34,7 +35,7 @@ public class DBLoggingProvider : LoggingProvider private const int ReaderLockTimeout = 10000; private const int WriterLockTimeout = 10000; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(DBLoggingProvider)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly List LogQueue = []; private static readonly ReaderWriterLockSlim LockNotif = new ReaderWriterLockSlim(); private static readonly ReaderWriterLockSlim LockQueueLog = new ReaderWriterLockSlim(); diff --git a/DNN Platform/Library/Services/Log/EventLog/LogController.cs b/DNN Platform/Library/Services/Log/EventLog/LogController.cs index 5cc3e0a9615..5f987d3ecac 100644 --- a/DNN Platform/Library/Services/Log/EventLog/LogController.cs +++ b/DNN Platform/Library/Services/Log/EventLog/LogController.cs @@ -25,12 +25,13 @@ namespace DotNetNuke.Services.Log.EventLog using DotNetNuke.Instrumentation; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// public class LogController : ServiceLocator, ILogController { private const int WriterLockTimeout = 10000; // milliseconds - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(LogController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly ReaderWriterLockSlim LockLog = new ReaderWriterLockSlim(); private readonly IApplicationStatusInfo appStatus; diff --git a/DNN Platform/Library/Services/Mail/SendTokenizedBulkEmail.cs b/DNN Platform/Library/Services/Mail/SendTokenizedBulkEmail.cs index c251e46dfd5..2d239d8a513 100644 --- a/DNN Platform/Library/Services/Mail/SendTokenizedBulkEmail.cs +++ b/DNN Platform/Library/Services/Mail/SendTokenizedBulkEmail.cs @@ -26,6 +26,8 @@ namespace DotNetNuke.Services.Mail using DotNetNuke.Services.Messaging.Data; using DotNetNuke.Services.Tokens; + using Microsoft.Extensions.Logging; + using Localization = DotNetNuke.Services.Localization.Localization; /// @@ -34,7 +36,7 @@ namespace DotNetNuke.Services.Mail /// public class SendTokenizedBulkEmail : IDisposable { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(SendTokenizedBulkEmail)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); // ReSharper restore InconsistentNaming private readonly List addressedRoles = new List(); diff --git a/DNN Platform/Library/Services/ModuleCache/PurgeModuleCache.cs b/DNN Platform/Library/Services/ModuleCache/PurgeModuleCache.cs index 4357c2be066..dfc6d727a8d 100644 --- a/DNN Platform/Library/Services/ModuleCache/PurgeModuleCache.cs +++ b/DNN Platform/Library/Services/ModuleCache/PurgeModuleCache.cs @@ -10,9 +10,11 @@ namespace DotNetNuke.Services.ModuleCache using DotNetNuke.Instrumentation; using DotNetNuke.Services.Scheduling; + using Microsoft.Extensions.Logging; + public class PurgeModuleCache : SchedulerClient { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(PurgeModuleCache)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// Initializes a new instance of the class. /// The schedule history item. diff --git a/DNN Platform/Library/Services/OutputCache/PurgeOutputCache.cs b/DNN Platform/Library/Services/OutputCache/PurgeOutputCache.cs index 7fd76f690bc..7646b2c9c52 100644 --- a/DNN Platform/Library/Services/OutputCache/PurgeOutputCache.cs +++ b/DNN Platform/Library/Services/OutputCache/PurgeOutputCache.cs @@ -10,9 +10,11 @@ namespace DotNetNuke.Services.OutputCache using DotNetNuke.Instrumentation; using DotNetNuke.Services.Scheduling; + using Microsoft.Extensions.Logging; + public class PurgeOutputCache : SchedulerClient { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(PurgeOutputCache)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// Initializes a new instance of the class. /// The schedule history item. diff --git a/DNN Platform/Library/Services/Scheduling/ProcessGroup.cs b/DNN Platform/Library/Services/Scheduling/ProcessGroup.cs index c3df5f60015..d6fe02bd9fd 100644 --- a/DNN Platform/Library/Services/Scheduling/ProcessGroup.cs +++ b/DNN Platform/Library/Services/Scheduling/ProcessGroup.cs @@ -11,10 +11,11 @@ namespace DotNetNuke.Services.Scheduling using DotNetNuke.Common; using DotNetNuke.Instrumentation; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; public class ProcessGroup { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ProcessGroup)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static int numberOfProcesses; diff --git a/DNN Platform/Library/Services/Scheduling/ScheduleHistoryItem.cs b/DNN Platform/Library/Services/Scheduling/ScheduleHistoryItem.cs index d9f847e3192..169e739ded5 100644 --- a/DNN Platform/Library/Services/Scheduling/ScheduleHistoryItem.cs +++ b/DNN Platform/Library/Services/Scheduling/ScheduleHistoryItem.cs @@ -10,10 +10,12 @@ namespace DotNetNuke.Services.Scheduling using DotNetNuke.Common.Utilities; using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + [Serializable] public class ScheduleHistoryItem : ScheduleItem { - private static readonly ILog TracelLogger = LoggerSource.Instance.GetLogger(typeof(ScheduleHistoryItem)); + private static readonly ILogger TracelLogger = DnnLoggingController.GetLogger(); private StringBuilder logNotes; private int scheduleHistoryID; diff --git a/DNN Platform/Library/Services/Scheduling/Scheduler.cs b/DNN Platform/Library/Services/Scheduling/Scheduler.cs index 392147a4f7c..9d5affe3e48 100644 --- a/DNN Platform/Library/Services/Scheduling/Scheduler.cs +++ b/DNN Platform/Library/Services/Scheduling/Scheduler.cs @@ -17,11 +17,13 @@ namespace DotNetNuke.Services.Scheduling using DotNetNuke.Entities.Host; using DotNetNuke.Instrumentation; using DotNetNuke.Services.Log.EventLog; + + using Microsoft.Extensions.Logging; using Microsoft.VisualBasic; internal static class Scheduler { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(Scheduler)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(typeof(Scheduler)); internal static class CoreScheduler { diff --git a/DNN Platform/Library/Services/Search/Controllers/ModuleResultController.cs b/DNN Platform/Library/Services/Search/Controllers/ModuleResultController.cs index 86af2c0871c..6c494c60d66 100644 --- a/DNN Platform/Library/Services/Search/Controllers/ModuleResultController.cs +++ b/DNN Platform/Library/Services/Search/Controllers/ModuleResultController.cs @@ -27,6 +27,7 @@ namespace DotNetNuke.Services.Search.Controllers using DotNetNuke.Services.Search.Entities; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; using Localization = DotNetNuke.Services.Localization.Localization; @@ -38,7 +39,7 @@ public class ModuleResultController : BaseResultController private const CacheItemPriority ModuleByIdCachePriority = CacheItemPriority.Normal; private const int ModuleByIdCacheTimeOut = 20; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ModuleResultController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly ConcurrentDictionary moduleSearchControllers = new ConcurrentDictionary(); private readonly IBusinessControllerProvider businessControllerProvider; diff --git a/DNN Platform/Library/Services/Search/Internals/InternalSearchControllerImpl.cs b/DNN Platform/Library/Services/Search/Internals/InternalSearchControllerImpl.cs index 4ab1b06a855..4fdab5dc7b4 100644 --- a/DNN Platform/Library/Services/Search/Internals/InternalSearchControllerImpl.cs +++ b/DNN Platform/Library/Services/Search/Internals/InternalSearchControllerImpl.cs @@ -31,6 +31,7 @@ namespace DotNetNuke.Services.Search.Internals using Lucene.Net.Search; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; using Localization = DotNetNuke.Services.Localization.Localization; @@ -44,7 +45,7 @@ internal class InternalSearchControllerImpl : IInternalSearchController private const string HtmlTagsWithAttrs = "<[a-z_:][\\w:.-]*(\\s+(?\\w+\\s*?=\\s*?[\"'].*?[\"']))+\\s*/?>"; private const string AttrText = "[\"'](?.*?)[\"']"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(InternalSearchControllerImpl)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly string[] HtmlAttributesToRetain = { "alt", "title" }; private static readonly DataProvider DataProvider = DataProvider.Instance(); diff --git a/DNN Platform/Library/Services/Search/Internals/LuceneControllerImpl.cs b/DNN Platform/Library/Services/Search/Internals/LuceneControllerImpl.cs index 99b6ef503c1..9ba4951941c 100644 --- a/DNN Platform/Library/Services/Search/Internals/LuceneControllerImpl.cs +++ b/DNN Platform/Library/Services/Search/Internals/LuceneControllerImpl.cs @@ -27,6 +27,8 @@ namespace DotNetNuke.Services.Search.Internals using Lucene.Net.Search.Vectorhighlight; using Lucene.Net.Store; + using Microsoft.Extensions.Logging; + using Localization = DotNetNuke.Services.Localization.Localization; /// The Impl Controller class for Lucene. @@ -43,7 +45,7 @@ internal class LuceneControllerImpl : ILuceneController, IDisposable private const string HtmlPreTag = ""; private const string HtmlPostTag = ""; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(LuceneControllerImpl)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly TimeSpan DefaultRereadTimeSpan = TimeSpan.FromSeconds(30); private readonly object writerLock = new object(); private readonly TimeSpan readerTimeSpan; diff --git a/DNN Platform/Library/Services/Search/ModuleIndexer.cs b/DNN Platform/Library/Services/Search/ModuleIndexer.cs index af35301d66d..c6385ff412e 100644 --- a/DNN Platform/Library/Services/Search/ModuleIndexer.cs +++ b/DNN Platform/Library/Services/Search/ModuleIndexer.cs @@ -24,13 +24,14 @@ namespace DotNetNuke.Services.Search using DotNetNuke.Services.Search.Internals; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; using Localization = DotNetNuke.Services.Localization.Localization; /// The ModuleIndexer is an implementation of the abstract class. public class ModuleIndexer : IndexingProviderBase { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ModuleIndexer)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly int ModuleSearchTypeId = SearchHelper.Instance.GetSearchTypeByName("module").SearchTypeId; private readonly IBusinessControllerProvider businessControllerProvider; diff --git a/DNN Platform/Library/Services/Search/SearchEngine.cs b/DNN Platform/Library/Services/Search/SearchEngine.cs index 6a1ff3c4219..2f9db76f95a 100644 --- a/DNN Platform/Library/Services/Search/SearchEngine.cs +++ b/DNN Platform/Library/Services/Search/SearchEngine.cs @@ -20,12 +20,15 @@ namespace DotNetNuke.Services.Search using DotNetNuke.Services.Scheduling; using DotNetNuke.Services.Search.Entities; using DotNetNuke.Services.Search.Internals; + + using Microsoft.Extensions.Logging; + using Newtonsoft.Json; /// The SearchEngine manages the Indexing of the Portal content. internal partial class SearchEngine { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(SearchEngine)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IBusinessControllerProvider businessControllerProvider; /// Initializes a new instance of the class. diff --git a/DNN Platform/Library/Services/Search/SearchEngineScheduler.cs b/DNN Platform/Library/Services/Search/SearchEngineScheduler.cs index b3f81105c8f..752c21090f2 100644 --- a/DNN Platform/Library/Services/Search/SearchEngineScheduler.cs +++ b/DNN Platform/Library/Services/Search/SearchEngineScheduler.cs @@ -13,11 +13,12 @@ namespace DotNetNuke.Services.Search using DotNetNuke.Services.Search.Internals; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// The SearchEngineScheduler implements a SchedulerClient for the Indexing of portal content. public class SearchEngineScheduler : SchedulerClient { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(SearchEngineScheduler)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IBusinessControllerProvider businessControllerProvider; /// Initializes a new instance of the class. diff --git a/DNN Platform/Library/Services/Search/TabIndexer.cs b/DNN Platform/Library/Services/Search/TabIndexer.cs index da6017d25e6..71b41c23787 100644 --- a/DNN Platform/Library/Services/Search/TabIndexer.cs +++ b/DNN Platform/Library/Services/Search/TabIndexer.cs @@ -14,10 +14,12 @@ namespace DotNetNuke.Services.Search using DotNetNuke.Services.Search.Entities; using DotNetNuke.Services.Search.Internals; + using Microsoft.Extensions.Logging; + /// An implementation of for pages. public class TabIndexer : IndexingProviderBase { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(TabIndexer)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly int TabSearchTypeId = SearchHelper.Instance.GetSearchTypeByName("tab").SearchTypeId; /// Converts applicable pages into instances before passing them to the . diff --git a/DNN Platform/Library/Services/Sitemap/CoreSitemapProvider.cs b/DNN Platform/Library/Services/Sitemap/CoreSitemapProvider.cs index ac31ba03d3d..7116db036b4 100644 --- a/DNN Platform/Library/Services/Sitemap/CoreSitemapProvider.cs +++ b/DNN Platform/Library/Services/Sitemap/CoreSitemapProvider.cs @@ -20,9 +20,11 @@ namespace DotNetNuke.Services.Sitemap using DotNetNuke.Services.Exceptions; using DotNetNuke.Services.Localization; + using Microsoft.Extensions.Logging; + public class CoreSitemapProvider : SitemapProvider { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(CoreSitemapProvider)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private bool includeHiddenPages; private float minPagePriority; diff --git a/DNN Platform/Library/Services/SystemHealth/WebServerMonitor.cs b/DNN Platform/Library/Services/SystemHealth/WebServerMonitor.cs index 11a893f112c..6732ba88b1d 100644 --- a/DNN Platform/Library/Services/SystemHealth/WebServerMonitor.cs +++ b/DNN Platform/Library/Services/SystemHealth/WebServerMonitor.cs @@ -12,12 +12,14 @@ namespace DotNetNuke.Services.SystemHealth using DotNetNuke.Services.Exceptions; using DotNetNuke.Services.Scheduling; + using Microsoft.Extensions.Logging; + /// /// When run on each server it updates the last activity date for the server and removes any servers that haven't been seen in 24 hours. /// public class WebServerMonitor : SchedulerClient { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(WebServerMonitor)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// /// Initializes a new instance of the class. diff --git a/DNN Platform/Library/Services/Upgrade/Internals/Steps/AddFcnModeStep.cs b/DNN Platform/Library/Services/Upgrade/Internals/Steps/AddFcnModeStep.cs index 6f3af798e15..2355034f83a 100644 --- a/DNN Platform/Library/Services/Upgrade/Internals/Steps/AddFcnModeStep.cs +++ b/DNN Platform/Library/Services/Upgrade/Internals/Steps/AddFcnModeStep.cs @@ -9,12 +9,14 @@ namespace DotNetNuke.Services.Upgrade.Internals.Steps using DotNetNuke.Common.Utilities; using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + using Localization = DotNetNuke.Services.Localization.Localization; /// AddFcnModeVerificationStep - Step that performs FcnMode verification checks prior to installation. public class AddFcnModeStep : BaseInstallationStep { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(AddFcnModeStep)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// public override void Execute() diff --git a/DNN Platform/Library/Services/Upgrade/Internals/Steps/FilePermissionCheckStep.cs b/DNN Platform/Library/Services/Upgrade/Internals/Steps/FilePermissionCheckStep.cs index 3da110f66e1..dedeeaa616a 100644 --- a/DNN Platform/Library/Services/Upgrade/Internals/Steps/FilePermissionCheckStep.cs +++ b/DNN Platform/Library/Services/Upgrade/Internals/Steps/FilePermissionCheckStep.cs @@ -12,12 +12,14 @@ namespace DotNetNuke.Services.Upgrade.InternalController.Steps using DotNetNuke.Instrumentation; using DotNetNuke.Services.Upgrade.Internals.Steps; + using Microsoft.Extensions.Logging; + using Localization = DotNetNuke.Services.Localization.Localization; /// FilePermissionCheck - Step that performs file permission checks prior to installation. public class FilePermissionCheckStep : BaseInstallationStep { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(FilePermissionCheckStep)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// Main method to execute the step. public override void Execute() diff --git a/DNN Platform/Library/Services/Upgrade/Internals/Steps/InstallExtensionsStep.cs b/DNN Platform/Library/Services/Upgrade/Internals/Steps/InstallExtensionsStep.cs index 52647b247ec..23acbb87b69 100644 --- a/DNN Platform/Library/Services/Upgrade/Internals/Steps/InstallExtensionsStep.cs +++ b/DNN Platform/Library/Services/Upgrade/Internals/Steps/InstallExtensionsStep.cs @@ -9,12 +9,14 @@ namespace DotNetNuke.Services.Upgrade.InternalController.Steps using DotNetNuke.Instrumentation; using DotNetNuke.Services.Upgrade.Internals.Steps; + using Microsoft.Extensions.Logging; + using Localization = DotNetNuke.Services.Localization.Localization; /// InstallExtensionsStep - Step that installs all the Extensions. public class InstallExtensionsStep : BaseInstallationStep { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(InstallExtensionsStep)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// Main method to execute the step. public override void Execute() diff --git a/DNN Platform/Library/Services/Upgrade/Internals/Steps/InstallVersionStep.cs b/DNN Platform/Library/Services/Upgrade/Internals/Steps/InstallVersionStep.cs index c77921e3a10..0daab0c54a6 100644 --- a/DNN Platform/Library/Services/Upgrade/Internals/Steps/InstallVersionStep.cs +++ b/DNN Platform/Library/Services/Upgrade/Internals/Steps/InstallVersionStep.cs @@ -10,12 +10,14 @@ namespace DotNetNuke.Services.Upgrade.Internals.Steps using DotNetNuke.Data; using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + using Localization = DotNetNuke.Services.Localization.Localization; /// DatabaseVerificationStep - Step that performs database verification checks prior to installation. public class InstallVersionStep : BaseInstallationStep { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(InstallVersionStep)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// public override void Execute() diff --git a/DNN Platform/Library/Services/Upgrade/Internals/Steps/UpdateLanguagePackStep.cs b/DNN Platform/Library/Services/Upgrade/Internals/Steps/UpdateLanguagePackStep.cs index d2597669dd9..94058df043b 100644 --- a/DNN Platform/Library/Services/Upgrade/Internals/Steps/UpdateLanguagePackStep.cs +++ b/DNN Platform/Library/Services/Upgrade/Internals/Steps/UpdateLanguagePackStep.cs @@ -12,10 +12,12 @@ namespace DotNetNuke.Services.Upgrade.InternalController.Steps using DotNetNuke.Services.Upgrade.Internals; using DotNetNuke.Services.Upgrade.Internals.Steps; + using Microsoft.Extensions.Logging; + /// UpdateLanguagePackStep - Step that downloads and installs language pack. public class UpdateLanguagePackStep : BaseInstallationStep { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(UpdateLanguagePackStep)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// Main method to execute the step. public override void Execute() diff --git a/DNN Platform/Library/Services/Upgrade/Upgrade.cs b/DNN Platform/Library/Services/Upgrade/Upgrade.cs index ccabbbc129b..8626d69818a 100644 --- a/DNN Platform/Library/Services/Upgrade/Upgrade.cs +++ b/DNN Platform/Library/Services/Upgrade/Upgrade.cs @@ -48,6 +48,7 @@ namespace DotNetNuke.Services.Upgrade using DotNetNuke.Services.Upgrade.Internals; using DotNetNuke.Web.Client.ClientResourceManagement; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; using Assembly = System.Reflection.Assembly; using FileInfo = DotNetNuke.Services.FileSystem.FileInfo; @@ -59,7 +60,7 @@ public partial class Upgrade { private const string FipsCompilanceAssembliesCheckedKey = "FipsCompilanceAssembliesChecked"; private const string FipsCompilanceAssembliesFolder = "App_Data\\FipsCompilanceAssemblies"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(Upgrade)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly object ThreadLocker = new object(); private static DateTime startTime; diff --git a/DNN Platform/Library/Services/UserProfile/UserProfilePageHandler.cs b/DNN Platform/Library/Services/UserProfile/UserProfilePageHandler.cs index 7d73d052bbd..f4c7ebee3ee 100644 --- a/DNN Platform/Library/Services/UserProfile/UserProfilePageHandler.cs +++ b/DNN Platform/Library/Services/UserProfile/UserProfilePageHandler.cs @@ -13,9 +13,11 @@ namespace DotNetNuke.Services.UserProfile using DotNetNuke.Entities.Users; using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + public class UserProfilePageHandler : IHttpHandler { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(UserProfilePageHandler)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// public bool IsReusable diff --git a/DNN Platform/Library/Startup.cs b/DNN Platform/Library/Startup.cs index 2f86d958f88..b2b71b59592 100644 --- a/DNN Platform/Library/Startup.cs +++ b/DNN Platform/Library/Startup.cs @@ -94,6 +94,8 @@ public void ConfigureServices(IServiceCollection services) services.AddScoped(); services.AddScoped(); services.AddScoped(); + services.AddTransient(); + services.AddTransient(); #pragma warning restore CS0618 services.AddTransient(); @@ -127,7 +129,6 @@ public void ConfigureServices(IServiceCollection services) services.AddTransient(); services.AddTransient(_ => ComponentFactory.GetComponent()); - services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); @@ -136,9 +137,6 @@ public void ConfigureServices(IServiceCollection services) services.AddTransient(); services.AddTransient(); services.AddTransient(); -#pragma warning disable CS0618 // Type or member is obsolete - services.AddTransient(); -#pragma warning restore CS0618 // Type or member is obsolete services.AddTransient(); services.AddTransient(); services.AddTransient(); diff --git a/DNN Platform/Library/UI/Containers/Container.cs b/DNN Platform/Library/UI/Containers/Container.cs index ccaeff83a41..87646d0b55e 100644 --- a/DNN Platform/Library/UI/Containers/Container.cs +++ b/DNN Platform/Library/UI/Containers/Container.cs @@ -29,11 +29,12 @@ namespace DotNetNuke.UI.Containers using DotNetNuke.UI.Skins; using DotNetNuke.UI.WebControls; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// Container is the base for the Containers. public class Container : UserControl { - private readonly ILog tracelLogger = LoggerSource.Instance.GetLogger("DNN.Trace"); + private readonly ILogger tracelLogger = DnnLoggingController.GetLogger("DNN.Trace"); private readonly IClientResourceController clientResourceController; private HtmlContainerControl contentPane; private ModuleInfo moduleConfiguration; diff --git a/DNN Platform/Library/UI/Modules/ModuleControlFactory.cs b/DNN Platform/Library/UI/Modules/ModuleControlFactory.cs index ba854534ca0..a3be6f3b7cf 100644 --- a/DNN Platform/Library/UI/Modules/ModuleControlFactory.cs +++ b/DNN Platform/Library/UI/Modules/ModuleControlFactory.cs @@ -15,11 +15,13 @@ namespace DotNetNuke.UI.Modules using DotNetNuke.Services.Localization; using DotNetNuke.UI.Modules.Html5; + using Microsoft.Extensions.Logging; + /// [DnnDeprecated(9, 4, 0, "This implementation has moved to DotNetNuke.ModulePipeline.ModuleControlPipeline")] public partial class ModuleControlFactory { - private static readonly ILog TracelLogger = LoggerSource.Instance.GetLogger("DNN.Trace"); + private static readonly ILogger TracelLogger = DnnLoggingController.GetLogger("DNN.Trace"); /// [DnnDeprecated(9, 4, 0, "This implementation has moved to DotNetNuke.ModulePipeline.ModuleControlPipeline")] diff --git a/DNN Platform/Library/UI/Modules/ModuleHost.cs b/DNN Platform/Library/UI/Modules/ModuleHost.cs index 503f56be03c..9ddf1a16c89 100644 --- a/DNN Platform/Library/UI/Modules/ModuleHost.cs +++ b/DNN Platform/Library/UI/Modules/ModuleHost.cs @@ -34,6 +34,7 @@ namespace DotNetNuke.UI.Modules using DotNetNuke.Web.Client; using DotNetNuke.Web.Client.ClientResourceManagement; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; using Globals = DotNetNuke.Common.Globals; @@ -43,7 +44,7 @@ public sealed class ModuleHost : Panel private const string DefaultCssProvider = "DnnPageHeaderProvider"; private const string DefaultJsProvider = "DnnBodyProvider"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ModuleHost)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly Regex CdfMatchRegex = new Regex( @"<\!--CDF\((?JAVASCRIPT|CSS|JS-LIBRARY)\|(?.+?)(\|(?.+?)\|(?\d+?))?\)-->", diff --git a/DNN Platform/Library/UI/Skins/SkinController.cs b/DNN Platform/Library/UI/Skins/SkinController.cs index 0253573d666..7a1676b1535 100644 --- a/DNN Platform/Library/UI/Skins/SkinController.cs +++ b/DNN Platform/Library/UI/Skins/SkinController.cs @@ -26,6 +26,7 @@ namespace DotNetNuke.UI.Skins using DotNetNuke.Services.Log.EventLog; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// Handles the Business Control Layer for Skins. public partial class SkinController @@ -33,7 +34,7 @@ public partial class SkinController private const string GlobalSkinPrefix = "[G]"; private const string PortalSystemSkinPrefix = "[S]"; private const string PortalSkinPrefix = "[L]"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(SkinController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly Regex GdirRegex = new Regex("\\[g]", RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex SdirRegex = new Regex("\\[s]", RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex LdirRegex = new Regex("\\[l]", RegexOptions.IgnoreCase | RegexOptions.Compiled); diff --git a/DNN Platform/Library/UI/Skins/SkinFileProcessor.cs b/DNN Platform/Library/UI/Skins/SkinFileProcessor.cs index e2f76d6d833..6c85188a42d 100644 --- a/DNN Platform/Library/UI/Skins/SkinFileProcessor.cs +++ b/DNN Platform/Library/UI/Skins/SkinFileProcessor.cs @@ -17,6 +17,8 @@ namespace DotNetNuke.UI.Skins using DotNetNuke.Instrumentation; using DotNetNuke.Services.Installer; + using Microsoft.Extensions.Logging; + public enum SkinParser { /// Localized parser. @@ -29,7 +31,7 @@ public enum SkinParser /// Handles processing of a list of uploaded skin files into a working skin. public class SkinFileProcessor { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(SkinFileProcessor)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly string dUPLICATEDETAIL = Util.GetLocalizedString("DuplicateSkinObject.Detail"); private readonly string dUPLICATEERROR = Util.GetLocalizedString("DuplicateSkinObject.Error"); private readonly string fILESEND = Util.GetLocalizedString("EndSkinFiles"); diff --git a/DNN Platform/Library/UI/Skins/SkinThumbNailControl.cs b/DNN Platform/Library/UI/Skins/SkinThumbNailControl.cs index 01a6a3b914f..298800f60aa 100644 --- a/DNN Platform/Library/UI/Skins/SkinThumbNailControl.cs +++ b/DNN Platform/Library/UI/Skins/SkinThumbNailControl.cs @@ -16,6 +16,8 @@ namespace DotNetNuke.UI.Skins using DotNetNuke.Instrumentation; using DotNetNuke.Services.Localization; + using Microsoft.Extensions.Logging; + using Image = System.Drawing.Image; /// @@ -38,7 +40,7 @@ public abstract class SkinThumbNailControl : UserControlBase // ReSharper disable once InconsistentNaming protected RadioButtonList OptSkin; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(SkinThumbNailControl)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); public string Border { diff --git a/DNN Platform/Library/UI/WebControls/CaptchaControl.cs b/DNN Platform/Library/UI/WebControls/CaptchaControl.cs index 8a0470d6342..b284a25e346 100644 --- a/DNN Platform/Library/UI/WebControls/CaptchaControl.cs +++ b/DNN Platform/Library/UI/WebControls/CaptchaControl.cs @@ -26,6 +26,8 @@ namespace DotNetNuke.UI.WebControls using DotNetNuke.Services.Exceptions; using DotNetNuke.Services.Localization; + using Microsoft.Extensions.Logging; + using Image = System.Web.UI.WebControls.Image; /// The CaptchaControl control provides a Captcha Challenge control. @@ -37,7 +39,7 @@ public class CaptchaControl : WebControl, INamingContainer, IPostBackDataHandler private const int LENGTHDEFAULT = 6; private const string RENDERURLDEFAULT = "ImageChallenge.captcha.aspx"; private const string CHARSDEFAULT = "abcdefghijklmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(CaptchaControl)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly string[] FontFamilies = { "Comic Sans MS", diff --git a/DNN Platform/Library/UI/WebControls/PropertyEditor/Edit Controls/DNN Edit Controls/DNNListEditControl.cs b/DNN Platform/Library/UI/WebControls/PropertyEditor/Edit Controls/DNN Edit Controls/DNNListEditControl.cs index 52b5685f28a..e20d95a513b 100644 --- a/DNN Platform/Library/UI/WebControls/PropertyEditor/Edit Controls/DNN Edit Controls/DNNListEditControl.cs +++ b/DNN Platform/Library/UI/WebControls/PropertyEditor/Edit Controls/DNN Edit Controls/DNNListEditControl.cs @@ -20,12 +20,13 @@ namespace DotNetNuke.UI.WebControls using DotNetNuke.Services.Localization; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// The DNNListEditControl control provides a standard UI component for selecting from Lists. [ToolboxData("<{0}:DNNListEditControl runat=server>")] public class DNNListEditControl : EditControl, IPostBackEventHandler { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(DNNListEditControl)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly ListController listController; private readonly IPortalController portalController; private readonly IApplicationStatusInfo appStatus; diff --git a/DNN Platform/Library/UI/WebControls/PropertyEditor/Edit Controls/DateEditControl.cs b/DNN Platform/Library/UI/WebControls/PropertyEditor/Edit Controls/DateEditControl.cs index ed6fb752702..ee8832da2ba 100644 --- a/DNN Platform/Library/UI/WebControls/PropertyEditor/Edit Controls/DateEditControl.cs +++ b/DNN Platform/Library/UI/WebControls/PropertyEditor/Edit Controls/DateEditControl.cs @@ -14,6 +14,8 @@ namespace DotNetNuke.UI.WebControls using DotNetNuke.Instrumentation; using DotNetNuke.Services.Localization; + using Microsoft.Extensions.Logging; + using Calendar = DotNetNuke.Common.Utilities.Calendar; /// @@ -23,7 +25,7 @@ namespace DotNetNuke.UI.WebControls [ToolboxData("<{0}:DateEditControl runat=server>")] public class DateEditControl : EditControl { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(DateEditControl)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private TextBox dateField; private HyperLink linkCalendar; diff --git a/DNN Platform/Library/UI/WebControls/PropertyEditor/Edit Controls/IntegerEditControl.cs b/DNN Platform/Library/UI/WebControls/PropertyEditor/Edit Controls/IntegerEditControl.cs index 19f148c4aec..03914b80c95 100644 --- a/DNN Platform/Library/UI/WebControls/PropertyEditor/Edit Controls/IntegerEditControl.cs +++ b/DNN Platform/Library/UI/WebControls/PropertyEditor/Edit Controls/IntegerEditControl.cs @@ -10,11 +10,13 @@ namespace DotNetNuke.UI.WebControls using DotNetNuke.Common.Utilities; using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + /// The IntegerEditControl control provides a standard UI component for editing integer properties. [ToolboxData("<{0}:IntegerEditControl runat=server>")] public class IntegerEditControl : EditControl { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(IntegerEditControl)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// /// Initializes a new instance of the class. diff --git a/DNN Platform/Library/UI/WebControls/PropertyEditor/Edit Controls/TrueFalseEditControl.cs b/DNN Platform/Library/UI/WebControls/PropertyEditor/Edit Controls/TrueFalseEditControl.cs index ab93d212bad..3349ac43510 100644 --- a/DNN Platform/Library/UI/WebControls/PropertyEditor/Edit Controls/TrueFalseEditControl.cs +++ b/DNN Platform/Library/UI/WebControls/PropertyEditor/Edit Controls/TrueFalseEditControl.cs @@ -11,11 +11,13 @@ namespace DotNetNuke.UI.WebControls using DotNetNuke.Instrumentation; using DotNetNuke.Services.Localization; + using Microsoft.Extensions.Logging; + /// The TrueFalseEditControl control provides a standard UI component for editing true/false (boolean) properties. [ToolboxData("<{0}:TrueFalseEditControl runat=server>")] public class TrueFalseEditControl : EditControl { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(TrueFalseEditControl)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// /// Initializes a new instance of the class. diff --git a/DNN Platform/Library/UI/WebControls/PropertyEditor/SettingInfo.cs b/DNN Platform/Library/UI/WebControls/PropertyEditor/SettingInfo.cs index 0b7fc074df6..3d0558443f7 100644 --- a/DNN Platform/Library/UI/WebControls/PropertyEditor/SettingInfo.cs +++ b/DNN Platform/Library/UI/WebControls/PropertyEditor/SettingInfo.cs @@ -8,10 +8,12 @@ namespace DotNetNuke.UI.WebControls using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + /// The SettingInfo class provides a helper class for the Settings Editor. public class SettingInfo { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(SettingInfo)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private Type type; /// Initializes a new instance of the class. diff --git a/DNN Platform/Modules/CoreMessaging/Components/CoreMessagingBusinessController.cs b/DNN Platform/Modules/CoreMessaging/Components/CoreMessagingBusinessController.cs index b8a7db94b61..8551acff77d 100644 --- a/DNN Platform/Modules/CoreMessaging/Components/CoreMessagingBusinessController.cs +++ b/DNN Platform/Modules/CoreMessaging/Components/CoreMessagingBusinessController.cs @@ -16,10 +16,12 @@ namespace DotNetNuke.Modules.CoreMessaging.Components using DotNetNuke.Instrumentation; using DotNetNuke.Services.Upgrade; + using Microsoft.Extensions.Logging; + /// Module business controller to implement Dnn module interfaces. public class CoreMessagingBusinessController : IUpgradeable { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(CoreMessagingBusinessController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// Runs upgrade logic upon module upgrade. /// The version we are upgrading to. diff --git a/DNN Platform/Modules/CoreMessaging/Services/FileUploadController.cs b/DNN Platform/Modules/CoreMessaging/Services/FileUploadController.cs index 0077760801a..0e122b42ccf 100644 --- a/DNN Platform/Modules/CoreMessaging/Services/FileUploadController.cs +++ b/DNN Platform/Modules/CoreMessaging/Services/FileUploadController.cs @@ -16,12 +16,15 @@ namespace DotNetNuke.Modules.CoreMessaging.Services using DotNetNuke.Services.FileSystem; using DotNetNuke.Web.Api; using DotNetNuke.Web.Api.Internal; + + using Microsoft.Extensions.Logging; + using Newtonsoft.Json; /// Provides a file upload web service. public class FileUploadController : DnnApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(FileUploadController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IFileManager fileManager = FileManager.Instance; private readonly IFolderManager folderManager = FolderManager.Instance; private readonly IFileContentTypeManager fileContentTypeManager = FileContentTypeManager.Instance; diff --git a/DNN Platform/Modules/CoreMessaging/Services/MessagingServiceController.cs b/DNN Platform/Modules/CoreMessaging/Services/MessagingServiceController.cs index 9a9c93d7f9c..3f4bad6a251 100644 --- a/DNN Platform/Modules/CoreMessaging/Services/MessagingServiceController.cs +++ b/DNN Platform/Modules/CoreMessaging/Services/MessagingServiceController.cs @@ -28,6 +28,7 @@ namespace DotNetNuke.Modules.CoreMessaging.Services using DotNetNuke.Web.Api; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// Provides messaging web services. /// The portal controller. @@ -40,7 +41,7 @@ namespace DotNetNuke.Modules.CoreMessaging.Services public class MessagingServiceController(IPortalController portalController, IApplicationStatusInfo appStatus, IPortalGroupController portalGroupController, IHostSettings hostSettings) : DnnApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(MessagingServiceController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IPortalController portalController = portalController ?? HttpContextSource.Current.GetScope().ServiceProvider.GetRequiredService(); private readonly IApplicationStatusInfo appStatus = appStatus ?? HttpContextSource.Current.GetScope().ServiceProvider.GetRequiredService(); private readonly IPortalGroupController portalGroupController = portalGroupController ?? HttpContextSource.Current.GetScope().ServiceProvider.GetRequiredService(); diff --git a/DNN Platform/Modules/DnnExportImport/Components/Common/Util.cs b/DNN Platform/Modules/DnnExportImport/Components/Common/Util.cs index 7c9fdfb3bf3..55d430f1ec8 100644 --- a/DNN Platform/Modules/DnnExportImport/Components/Common/Util.cs +++ b/DNN Platform/Modules/DnnExportImport/Components/Common/Util.cs @@ -29,13 +29,14 @@ namespace Dnn.ExportImport.Components.Common using DotNetNuke.Internal.SourceGenerators; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; using Newtonsoft.Json; /// A collection of utilities for import/export. public static partial class Util { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(Util)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(typeof(Util)); private static int noRole = Convert.ToInt32(Globals.glbRoleNothing, CultureInfo.InvariantCulture); /// Checks if a string is either null or empty (""). diff --git a/DNN Platform/Modules/DnnExportImport/Components/Controllers/BaseController.cs b/DNN Platform/Modules/DnnExportImport/Components/Controllers/BaseController.cs index d66e66cf3c8..cefd180e46f 100644 --- a/DNN Platform/Modules/DnnExportImport/Components/Controllers/BaseController.cs +++ b/DNN Platform/Modules/DnnExportImport/Components/Controllers/BaseController.cs @@ -30,6 +30,7 @@ namespace Dnn.ExportImport.Components.Controllers using DotNetNuke.Services.Log.EventLog; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; using Newtonsoft.Json; @@ -39,7 +40,7 @@ public class BaseController /// The full path to the folder used for import/export. public static readonly string ExportFolder; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(BaseController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); static BaseController() { diff --git a/DNN Platform/Modules/DnnExportImport/Components/Engines/ExportImportEngine.cs b/DNN Platform/Modules/DnnExportImport/Components/Engines/ExportImportEngine.cs index 302985c06fa..545ef448728 100644 --- a/DNN Platform/Modules/DnnExportImport/Components/Engines/ExportImportEngine.cs +++ b/DNN Platform/Modules/DnnExportImport/Components/Engines/ExportImportEngine.cs @@ -36,6 +36,7 @@ namespace Dnn.ExportImport.Components.Engines using DotNetNuke.Services.Scheduling; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; using Newtonsoft.Json; @@ -46,7 +47,7 @@ public class ExportImportEngine { private const StringComparison IgnoreCaseComp = StringComparison.InvariantCultureIgnoreCase; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ExportImportEngine)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly string ExportFolder; diff --git a/DNN Platform/Modules/DnnExportImport/Components/Scheduler/ExportImportScheduler.cs b/DNN Platform/Modules/DnnExportImport/Components/Scheduler/ExportImportScheduler.cs index 5507c4f0118..62e1cfeb57a 100644 --- a/DNN Platform/Modules/DnnExportImport/Components/Scheduler/ExportImportScheduler.cs +++ b/DNN Platform/Modules/DnnExportImport/Components/Scheduler/ExportImportScheduler.cs @@ -22,6 +22,7 @@ namespace Dnn.ExportImport.Components.Scheduler using DotNetNuke.Services.Scheduling; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// Implements a SchedulerClient for the Exporting/Importing of site items. public class ExportImportScheduler : SchedulerClient @@ -39,7 +40,7 @@ public class ExportImportScheduler : SchedulerClient private const int EmergencyHistoryNumber = 1; private const int DefaultHistoryNumber = 60; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ExportImportScheduler)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly ExportImportEngine engine; private readonly IEntitiesController entitiesController; diff --git a/DNN Platform/Modules/DnnExportImport/Components/Services/PackagesExportService.cs b/DNN Platform/Modules/DnnExportImport/Components/Services/PackagesExportService.cs index b96c62c48d5..d4538630b7c 100644 --- a/DNN Platform/Modules/DnnExportImport/Components/Services/PackagesExportService.cs +++ b/DNN Platform/Modules/DnnExportImport/Components/Services/PackagesExportService.cs @@ -23,13 +23,14 @@ namespace Dnn.ExportImport.Components.Services using DotNetNuke.Services.Installer.Packages; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; using Newtonsoft.Json; /// An export service for extension packages. public class PackagesExportService : BasePortableService { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(PackagesExportService)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly Regex ExtensionPackageFilesRegex = new Regex(@"^(.+?)_(.+?)_(\d+\.\d+\.\d+).resources$", RegexOptions.Compiled); diff --git a/DNN Platform/Modules/DnnExportImport/Components/Services/PagesExportService.cs b/DNN Platform/Modules/DnnExportImport/Components/Services/PagesExportService.cs index 3e2e763f7c5..ad70f10d261 100644 --- a/DNN Platform/Modules/DnnExportImport/Components/Services/PagesExportService.cs +++ b/DNN Platform/Modules/DnnExportImport/Components/Services/PagesExportService.cs @@ -41,6 +41,7 @@ namespace Dnn.ExportImport.Components.Services using DotNetNuke.Services.Localization; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; using Newtonsoft.Json; @@ -57,7 +58,7 @@ namespace Dnn.ExportImport.Components.Services public class PagesExportService(IBusinessControllerProvider businessControllerProvider, IPortalAliasService portalAliasService, IApplicationStatusInfo appStatus, IEventLogger eventLogger, IHostSettings hostSettings) : BasePortableService { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ExportImportEngine)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IBusinessControllerProvider businessControllerProvider = businessControllerProvider ?? Globals.GetCurrentServiceProvider().GetRequiredService(); private readonly IPortalAliasService portalAliasService = portalAliasService ?? Globals.GetCurrentServiceProvider().GetRequiredService(); diff --git a/DNN Platform/Modules/DnnExportImport/Components/Services/ThemesExportService.cs b/DNN Platform/Modules/DnnExportImport/Components/Services/ThemesExportService.cs index 316957cdca8..4208442c512 100644 --- a/DNN Platform/Modules/DnnExportImport/Components/Services/ThemesExportService.cs +++ b/DNN Platform/Modules/DnnExportImport/Components/Services/ThemesExportService.cs @@ -23,11 +23,12 @@ namespace Dnn.ExportImport.Components.Services using DotNetNuke.UI.Skins; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// An export service for themes. public class ThemesExportService : BasePortableService { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ThemesExportService)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IApplicationStatusInfo appStatus; private ExportImportJob exportImportJob; diff --git a/DNN Platform/Modules/Groups/ModerationServiceController.cs b/DNN Platform/Modules/Groups/ModerationServiceController.cs index daca6d0093b..742bdc1989c 100644 --- a/DNN Platform/Modules/Groups/ModerationServiceController.cs +++ b/DNN Platform/Modules/Groups/ModerationServiceController.cs @@ -29,6 +29,7 @@ namespace DotNetNuke.Modules.Groups using DotNetNuke.Web.Api; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// A web API controller for moderation in the Groups module. /// The navigation manager. @@ -43,7 +44,7 @@ namespace DotNetNuke.Modules.Groups public class ModerationServiceController(INavigationManager navigationManager, RoleProvider roleProvider, IRoleController roleController, IEventManager eventManager, IPortalController portalController, IUserController userController, IEventLogger eventLogger, IHostSettings hostSettings) : DnnApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ModerationServiceController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly RoleProvider roleProvider = roleProvider ?? Globals.GetCurrentServiceProvider().GetRequiredService(); private readonly IRoleController roleController = roleController ?? Globals.GetCurrentServiceProvider().GetRequiredService(); private readonly IEventManager eventManager = eventManager ?? Globals.GetCurrentServiceProvider().GetRequiredService(); diff --git a/DNN Platform/Modules/Journal/FileUploadController.cs b/DNN Platform/Modules/Journal/FileUploadController.cs index a0776309456..c5d72ea5bd7 100644 --- a/DNN Platform/Modules/Journal/FileUploadController.cs +++ b/DNN Platform/Modules/Journal/FileUploadController.cs @@ -17,11 +17,14 @@ namespace DotNetNuke.Modules.Journal using DotNetNuke.Services.Journal; using DotNetNuke.Web.Api; using DotNetNuke.Web.Api.Internal; + + using Microsoft.Extensions.Logging; + using Newtonsoft.Json; public class FileUploadController : DnnApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(FileUploadController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly HashSet ImageExtensions = new HashSet(StringComparer.OrdinalIgnoreCase) { ".JPG", ".JPE", ".BMP", ".GIF", ".PNG", ".JPEG", ".ICO", ".SVG", }; diff --git a/DNN Platform/Modules/Journal/NotificationServicesController.cs b/DNN Platform/Modules/Journal/NotificationServicesController.cs index 3c6421af80c..aeb7d016309 100644 --- a/DNN Platform/Modules/Journal/NotificationServicesController.cs +++ b/DNN Platform/Modules/Journal/NotificationServicesController.cs @@ -18,11 +18,13 @@ namespace DotNetNuke.Modules.Journal using DotNetNuke.Services.Social.Notifications; using DotNetNuke.Web.Api; + using Microsoft.Extensions.Logging; + [DnnModuleAuthorize(AccessLevel = SecurityAccessLevel.View)] [ValidateAntiForgeryToken] public class NotificationServicesController : DnnApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(NotificationServicesController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); [HttpPost] [ValidateAntiForgeryToken] diff --git a/DNN Platform/Modules/Journal/ServicesController.cs b/DNN Platform/Modules/Journal/ServicesController.cs index 47acd84b332..66c143a59a9 100644 --- a/DNN Platform/Modules/Journal/ServicesController.cs +++ b/DNN Platform/Modules/Journal/ServicesController.cs @@ -28,6 +28,7 @@ namespace DotNetNuke.Modules.Journal using DotNetNuke.Web.Api; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// A web API controller for the Journal module. /// The host settings. @@ -40,7 +41,7 @@ public class ServicesController(IHostSettings hostSettings) private const string MentionIdentityChar = "@"; private const int MentionNotificationLength = 100; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ServicesController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly string[] AcceptedFileExtensions = ["jpg", "png", "gif", "jpe", "jpeg", "tiff", "bmp",]; private readonly IHostSettings hostSettings = hostSettings ?? Globals.GetCurrentServiceProvider().GetRequiredService(); diff --git a/DNN Platform/Modules/MemberDirectory/Services/MemberDirectoryController.cs b/DNN Platform/Modules/MemberDirectory/Services/MemberDirectoryController.cs index 198b1970077..ddacf3ec690 100644 --- a/DNN Platform/Modules/MemberDirectory/Services/MemberDirectoryController.cs +++ b/DNN Platform/Modules/MemberDirectory/Services/MemberDirectoryController.cs @@ -24,6 +24,7 @@ namespace DotNetNuke.Modules.MemberDirectory.Services using DotNetNuke.Web.Api; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// A web API controller for the Member Directory module. /// The list controller. @@ -33,7 +34,7 @@ namespace DotNetNuke.Modules.MemberDirectory.Services public class MemberDirectoryController(ListController listController, IHostSettings hostSettings) : DnnApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(MemberDirectoryController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly ListController listController = listController ?? Globals.GetCurrentServiceProvider().GetRequiredService(); private readonly IHostSettings hostSettings = hostSettings ?? Globals.GetCurrentServiceProvider().GetRequiredService(); diff --git a/DNN Platform/Modules/RazorHost/CreateModule.ascx.cs b/DNN Platform/Modules/RazorHost/CreateModule.ascx.cs index 25c91ed6ea8..06e56ad624c 100644 --- a/DNN Platform/Modules/RazorHost/CreateModule.ascx.cs +++ b/DNN Platform/Modules/RazorHost/CreateModule.ascx.cs @@ -24,12 +24,13 @@ namespace DotNetNuke.Modules.RazorHost using DotNetNuke.UI.Modules; using DotNetNuke.UI.Skins.Controls; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// Implements the logic for the CreateModule view. [DnnDeprecated(9, 3, 2, "Use Razor Pages instead")] public partial class CreateModule : ModuleUserControlBase { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(CreateModule)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly INavigationManager navigationManager; private string razorScriptFileFormatString = "~/DesktopModules/RazorModules/RazorHost/Scripts/{0}"; diff --git a/DNN Platform/Modules/ResourceManager/Components/ResourceManagerController.cs b/DNN Platform/Modules/ResourceManager/Components/ResourceManagerController.cs index d41f7924f39..67ca53e636e 100644 --- a/DNN Platform/Modules/ResourceManager/Components/ResourceManagerController.cs +++ b/DNN Platform/Modules/ResourceManager/Components/ResourceManagerController.cs @@ -11,10 +11,12 @@ namespace Dnn.Modules.ResourceManager.Components using DotNetNuke.Instrumentation; using DotNetNuke.Services.Upgrade; + using Microsoft.Extensions.Logging; + /// Provides upgrade support for module. public class ResourceManagerController : IUpgradeable { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ResourceManagerController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// public string UpgradeModule(string version) diff --git a/DNN Platform/Modules/TelerikRemoval/UpgradeController.cs b/DNN Platform/Modules/TelerikRemoval/UpgradeController.cs index 258206ec760..7475c8e463e 100644 --- a/DNN Platform/Modules/TelerikRemoval/UpgradeController.cs +++ b/DNN Platform/Modules/TelerikRemoval/UpgradeController.cs @@ -16,10 +16,12 @@ namespace Dnn.Modules.TelerikRemoval using DotNetNuke.Maintenance.Telerik.Removal; using DotNetNuke.Web; + using Microsoft.Extensions.Logging; + /// An implementation. public class UpgradeController : IUpgradeable { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(UpgradeController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IServiceProvider serviceProvider = GetServiceProvider(); diff --git a/DNN Platform/Providers/CachingProviders/DotNetNuke.Providers.Caching.SimpleWebFarmCachingProvider/SimpleWebFarmCachingProvider.cs b/DNN Platform/Providers/CachingProviders/DotNetNuke.Providers.Caching.SimpleWebFarmCachingProvider/SimpleWebFarmCachingProvider.cs index b923ad86fc7..d5a1beaead4 100644 --- a/DNN Platform/Providers/CachingProviders/DotNetNuke.Providers.Caching.SimpleWebFarmCachingProvider/SimpleWebFarmCachingProvider.cs +++ b/DNN Platform/Providers/CachingProviders/DotNetNuke.Providers.Caching.SimpleWebFarmCachingProvider/SimpleWebFarmCachingProvider.cs @@ -23,13 +23,15 @@ namespace DotNetNuke.Providers.Caching.SimpleWebFarmCachingProvider using DotNetNuke.Services.Exceptions; using DotNetNuke.Services.Log.EventLog; + using Microsoft.Extensions.Logging; + using HttpWebRequest = System.Net.HttpWebRequest; using ICryptographyProvider = DotNetNuke.Abstractions.Security.ICryptographyProvider; /// public class SimpleWebFarmCachingProvider : CachingProvider { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(SimpleWebFarmCachingProvider)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IHostSettingsService hostSettingsService; private readonly ICryptographyProvider cryptographyProvider; private readonly IApplicationStatusInfo appStatus; diff --git a/DNN Platform/Providers/ClientCapabilityProviders/Provider.AspNetCCP/AspNetClientCapability.cs b/DNN Platform/Providers/ClientCapabilityProviders/Provider.AspNetCCP/AspNetClientCapability.cs index 428b16de585..0b5d9f905a8 100644 --- a/DNN Platform/Providers/ClientCapabilityProviders/Provider.AspNetCCP/AspNetClientCapability.cs +++ b/DNN Platform/Providers/ClientCapabilityProviders/Provider.AspNetCCP/AspNetClientCapability.cs @@ -14,6 +14,8 @@ namespace DotNetNuke.Providers.AspNetClientCapabilityProvider using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + /// AspNet Browser Implementation of . public class AspNetClientCapability : Services.ClientCapability.ClientCapability { @@ -30,7 +32,7 @@ public class AspNetClientCapability : Services.ClientCapability.ClientCapability private const string UnixAgent3 = "i386"; private const string X11Agent = "x11"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(AspNetClientCapability)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly Regex MobileCheck = new Regex( @"(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino", diff --git a/DNN Platform/Providers/FolderProviders/AzureFolderProvider/Settings.ascx.cs b/DNN Platform/Providers/FolderProviders/AzureFolderProvider/Settings.ascx.cs index 3787dcbff12..d1d861f32e2 100644 --- a/DNN Platform/Providers/FolderProviders/AzureFolderProvider/Settings.ascx.cs +++ b/DNN Platform/Providers/FolderProviders/AzureFolderProvider/Settings.ascx.cs @@ -17,6 +17,7 @@ namespace DotNetNuke.Providers.FolderProviders.AzureFolderProvider using DotNetNuke.Services.Localization; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; using Microsoft.WindowsAzure.Storage; using Microsoft.WindowsAzure.Storage.Auth; using Microsoft.WindowsAzure.Storage.Blob; @@ -24,7 +25,7 @@ namespace DotNetNuke.Providers.FolderProviders.AzureFolderProvider /// Windows Azure Storage Settings Control. public partial class Settings : FolderMappingSettingsControlBase { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(Settings)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly ICryptographyProvider cryptographyProvider; private readonly IHostSettings hostSettings; diff --git a/DNN Platform/Syndication/OPML/Opml.cs b/DNN Platform/Syndication/OPML/Opml.cs index a8c7f0361e2..a415a4c5b95 100644 --- a/DNN Platform/Syndication/OPML/Opml.cs +++ b/DNN Platform/Syndication/OPML/Opml.cs @@ -9,10 +9,12 @@ namespace DotNetNuke.Services.Syndication using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + /// Class for managing an OPML feed. public class Opml { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(Opml)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private XmlDocument opmlDoc; /// Initializes a new instance of the class. diff --git a/DNN Platform/Syndication/OPML/OpmlDownloadManager.cs b/DNN Platform/Syndication/OPML/OpmlDownloadManager.cs index 200b2b19e9f..3308115bdb7 100644 --- a/DNN Platform/Syndication/OPML/OpmlDownloadManager.cs +++ b/DNN Platform/Syndication/OPML/OpmlDownloadManager.cs @@ -12,11 +12,13 @@ namespace DotNetNuke.Services.Syndication using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + /// Helper class that provides memory and disk caching of the downloaded feeds. internal sealed class OpmlDownloadManager { private const string OPMLDir = "/OPML/"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(OpmlDownloadManager)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly OpmlDownloadManager TheManager = new OpmlDownloadManager(); private readonly Dictionary cache; diff --git a/DNN Platform/Syndication/RSS/RssDownloadManager.cs b/DNN Platform/Syndication/RSS/RssDownloadManager.cs index d2d8481d456..590502c4a18 100644 --- a/DNN Platform/Syndication/RSS/RssDownloadManager.cs +++ b/DNN Platform/Syndication/RSS/RssDownloadManager.cs @@ -12,11 +12,13 @@ namespace DotNetNuke.Services.Syndication using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + /// Helper class that provides memory and disk caching of the downloaded feeds. internal sealed class RssDownloadManager { private const string RSSDir = "/RSS/"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(RssDownloadManager)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly RssDownloadManager TheManager = new RssDownloadManager(); private readonly Dictionary cache; diff --git a/DNN Platform/Tests/DotNetNuke.Tests.Integration/Services/Installer/TestLogSource.cs b/DNN Platform/Tests/DotNetNuke.Tests.Integration/Services/Installer/TestLogSource.cs deleted file mode 100644 index acec668e1b8..00000000000 --- a/DNN Platform/Tests/DotNetNuke.Tests.Integration/Services/Installer/TestLogSource.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information -namespace DotNetNuke.Tests.Integration.Services.Installer -{ - using System; - - using DotNetNuke.Instrumentation; - - internal class TestLogSource : ILoggerSource - { - public ILog GetLogger(string name) - { - return new TestLogger(); - } - - public ILog GetLogger(Type type) - { - return new TestLogger(); - } - } -} diff --git a/DNN Platform/Tests/DotNetNuke.Tests.Integration/Services/Installer/XmlMergeTests.cs b/DNN Platform/Tests/DotNetNuke.Tests.Integration/Services/Installer/XmlMergeTests.cs index 16df9a6d1a4..6c264429aeb 100644 --- a/DNN Platform/Tests/DotNetNuke.Tests.Integration/Services/Installer/XmlMergeTests.cs +++ b/DNN Platform/Tests/DotNetNuke.Tests.Integration/Services/Installer/XmlMergeTests.cs @@ -31,8 +31,6 @@ public override void OneTimeSetUp() public void SetUp() { AppDomain.CurrentDomain.SetData("APPBASE", this.WebsitePhysicalAppPath); - - LoggerSource.SetTestableInstance(new TestLogSource()); } // ReSharper disable PossibleNullReferenceException @@ -485,10 +483,8 @@ private XmlMerge GetXmlMerge(string fileName) private void WriteToDebug(XmlDocument targetDoc) { - // ReSharper disable ConditionIsAlwaysTrueOrFalse + // ReSharper disable once ConditionIsAlwaysTrueOrFalse if (OutputXml) - - // ReSharper restore ConditionIsAlwaysTrueOrFalse { using (var writer = new StreamWriter(new MemoryStream())) { @@ -504,133 +500,4 @@ private void WriteToDebug(XmlDocument targetDoc) // ReSharper restore PossibleNullReferenceException } - - internal class TestLogger : ILog - { - public bool IsDebugEnabled - { - get { return false; } - } - - public bool IsErrorEnabled - { - get { return false; } - } - - public bool IsFatalEnabled - { - get { return false; } - } - - public bool IsInfoEnabled - { - get { return false; } - } - - public bool IsTraceEnabled - { - get { return false; } - } - - public bool IsWarnEnabled - { - get { return false; } - } - - public void Debug(object message, Exception exception) - { - } - - public void Debug(object message) - { - } - - public void DebugFormat(IFormatProvider provider, string format, params object[] args) - { - } - - public void DebugFormat(string format, params object[] args) - { - } - - public void Error(object message, Exception exception) - { - } - - public void Error(object message) - { - } - - public void ErrorFormat(IFormatProvider provider, string format, params object[] args) - { - } - - public void ErrorFormat(string format, params object[] args) - { - } - - public void Fatal(object message, Exception exception) - { - } - - public void Fatal(object message) - { - } - - public void FatalFormat(IFormatProvider provider, string format, params object[] args) - { - } - - public void FatalFormat(string format, params object[] args) - { - } - - public void Info(object message, Exception exception) - { - } - - public void Info(object message) - { - } - - public void InfoFormat(IFormatProvider provider, string format, params object[] args) - { - } - - public void InfoFormat(string format, params object[] args) - { - } - - public void Trace(object message, Exception exception) - { - } - - public void Trace(object message) - { - } - - public void TraceFormat(IFormatProvider provider, string format, params object[] args) - { - } - - public void TraceFormat(string format, params object[] args) - { - } - - public void Warn(object message, Exception exception) - { - } - - public void Warn(object message) - { - } - - public void WarnFormat(IFormatProvider provider, string format, params object[] args) - { - } - - public void WarnFormat(string format, params object[] args) - { - } - } } diff --git a/DNN Platform/Website/Default.aspx.cs b/DNN Platform/Website/Default.aspx.cs index 53bafe4e5be..6f7350caf32 100644 --- a/DNN Platform/Website/Default.aspx.cs +++ b/DNN Platform/Website/Default.aspx.cs @@ -45,6 +45,7 @@ namespace DotNetNuke.Framework using DotNetNuke.Web.Client.ClientResourceManagement; using DotNetNuke.Web.Client.ResourceManager; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; using DataCache = DotNetNuke.Common.Utilities.DataCache; using Globals = DotNetNuke.Common.Globals; @@ -53,7 +54,7 @@ namespace DotNetNuke.Framework /// The DNN default page. public partial class DefaultPage : CDefault, IClientAPICallbackEventHandler { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(DefaultPage)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly Regex HeaderTextRegex = new Regex( "])+name=('|\")robots('|\")", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.Compiled); diff --git a/DNN Platform/Website/DesktopModules/Admin/Authentication/Login.ascx.cs b/DNN Platform/Website/DesktopModules/Admin/Authentication/Login.ascx.cs index ff8ad7465e6..b9c6aaff9fe 100644 --- a/DNN Platform/Website/DesktopModules/Admin/Authentication/Login.ascx.cs +++ b/DNN Platform/Website/DesktopModules/Admin/Authentication/Login.ascx.cs @@ -48,12 +48,13 @@ namespace DotNetNuke.Modules.Admin.Authentication using DotNetNuke.UI.UserControls; using DotNetNuke.UI.WebControls; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// The Signin UserModuleBase is used to provide a login for a registered user. public partial class Login : UserModuleBase { private const string LOGINPATH = "/login"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(Login)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly Regex UserLanguageRegex = new Regex("(.*)(&|\\?)(language=)([^&\\?]+)(.*)", RegexOptions.IgnoreCase | RegexOptions.Compiled); diff --git a/DNN Platform/Website/DesktopModules/Admin/Security/EditUser.ascx.cs b/DNN Platform/Website/DesktopModules/Admin/Security/EditUser.ascx.cs index 2276725123e..c275b0ed06e 100644 --- a/DNN Platform/Website/DesktopModules/Admin/Security/EditUser.ascx.cs +++ b/DNN Platform/Website/DesktopModules/Admin/Security/EditUser.ascx.cs @@ -33,13 +33,14 @@ namespace DotNetNuke.Modules.Admin.Users using DotNetNuke.Services.Mail; using DotNetNuke.UI.Skins.Controls; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; using MembershipProvider = DotNetNuke.Security.Membership.MembershipProvider; /// The ManageUsers UserModuleBase is used to manage Users. public partial class EditUser : UserModuleBase { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(EditUser)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly INavigationManager navigationManager; private readonly IJavaScriptLibraryHelper javaScript; private readonly IPortalController portalController; diff --git a/DNN Platform/Website/DesktopModules/Admin/Security/Password.ascx.cs b/DNN Platform/Website/DesktopModules/Admin/Security/Password.ascx.cs index 47c0554b033..a644bcb3c55 100644 --- a/DNN Platform/Website/DesktopModules/Admin/Security/Password.ascx.cs +++ b/DNN Platform/Website/DesktopModules/Admin/Security/Password.ascx.cs @@ -28,11 +28,12 @@ namespace DotNetNuke.Modules.Admin.Users using DotNetNuke.Web.UI.WebControls; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// The Password UserModuleBase is used to manage Users Passwords. public partial class Password : UserModuleBase { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(Password)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IEventLogger eventLogger; private readonly IJavaScriptLibraryHelper javaScript; private readonly IClientResourceController clientResourceController; diff --git a/DNN Platform/Website/DesktopModules/Admin/Security/SecurityRoles.ascx.cs b/DNN Platform/Website/DesktopModules/Admin/Security/SecurityRoles.ascx.cs index 580898f93cb..937d553aec2 100644 --- a/DNN Platform/Website/DesktopModules/Admin/Security/SecurityRoles.ascx.cs +++ b/DNN Platform/Website/DesktopModules/Admin/Security/SecurityRoles.ascx.cs @@ -31,13 +31,14 @@ namespace DotNetNuke.Modules.Admin.Security using DotNetNuke.UI.Skins.Controls; using DotNetNuke.UI.Utilities; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; using Globals = DotNetNuke.Common.Globals; /// The SecurityRoles PortalModuleBase is used to manage the users and roles they have. public partial class SecurityRoles : PortalModuleBase, IActionable { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(SecurityRoles)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly INavigationManager navigationManager; private readonly RoleProvider roleProvider; private readonly IRoleController roleController; diff --git a/DNN Platform/Website/DesktopModules/Admin/Security/User.ascx.cs b/DNN Platform/Website/DesktopModules/Admin/Security/User.ascx.cs index 641607ed458..ee0dfef0ead 100644 --- a/DNN Platform/Website/DesktopModules/Admin/Security/User.ascx.cs +++ b/DNN Platform/Website/DesktopModules/Admin/Security/User.ascx.cs @@ -27,6 +27,7 @@ namespace DotNetNuke.Modules.Admin.Users using DotNetNuke.Web.UI.WebControls; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; using DataCache = DotNetNuke.Common.Utilities.DataCache; using Globals = DotNetNuke.Common.Globals; @@ -34,7 +35,7 @@ namespace DotNetNuke.Modules.Admin.Users /// The User UserModuleBase is used to manage the base parts of a User. public partial class User : UserUserControlBase { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(User)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IHostSettings hostSettings; private readonly IJavaScriptLibraryHelper javaScript; private readonly IPortalController portalController; diff --git a/DNN Platform/Website/DesktopModules/AuthenticationServices/DNN/Login.ascx.cs b/DNN Platform/Website/DesktopModules/AuthenticationServices/DNN/Login.ascx.cs index 59559736f7f..d42ccc7e78e 100644 --- a/DNN Platform/Website/DesktopModules/AuthenticationServices/DNN/Login.ascx.cs +++ b/DNN Platform/Website/DesktopModules/AuthenticationServices/DNN/Login.ascx.cs @@ -20,13 +20,14 @@ namespace DotNetNuke.Modules.Admin.Authentication.DNN using DotNetNuke.Services.Localization; using DotNetNuke.UI.Skins.Controls; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; using Globals = DotNetNuke.Common.Globals; /// The Login AuthenticationLoginBase is used to provide a login for a registered user portal. public partial class Login : AuthenticationLoginBase { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(Login)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly INavigationManager navigationManager; private readonly IPortalController portalController; private readonly IHostSettings hostSettings; diff --git a/DNN Platform/Website/Install/Install.aspx.cs b/DNN Platform/Website/Install/Install.aspx.cs index 42032a2dfce..069c2b4405b 100644 --- a/DNN Platform/Website/Install/Install.aspx.cs +++ b/DNN Platform/Website/Install/Install.aspx.cs @@ -32,6 +32,7 @@ namespace DotNetNuke.Services.Install using DotNetNuke.Services.Upgrade.Internals.Steps; using DotNetNuke.Web.Client.ClientResourceManagement; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// A page which installs or upgrades DNN. public partial class Install : Page @@ -42,7 +43,7 @@ public partial class Install : Page // ReSharper disable once InconsistentNaming protected static string UpgradeWizardLocalResourceFile = "~/Install/App_LocalResources/UpgradeWizard.aspx.resx"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(Install)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly object InstallLocker = new object(); private readonly IApplicationStatusInfo appStatus; diff --git a/DNN Platform/Website/Install/InstallWizard.aspx.cs b/DNN Platform/Website/Install/InstallWizard.aspx.cs index b711bcb00b2..5904c97dd92 100644 --- a/DNN Platform/Website/Install/InstallWizard.aspx.cs +++ b/DNN Platform/Website/Install/InstallWizard.aspx.cs @@ -41,6 +41,7 @@ namespace DotNetNuke.Services.Install using DotNetNuke.Web.UI.WebControls; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; using Globals = DotNetNuke.Common.Globals; using Localization = DotNetNuke.Services.Localization.Localization; @@ -60,7 +61,7 @@ public partial class InstallWizard : PageBase, IClientAPICallbackEventHandler private static readonly IInstallationStep InstallSiteStep = new InstallSiteStep(); private static readonly IInstallationStep InstallSuperUserStep = new InstallSuperUserStep(); - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(InstallWizard)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); // Ordered List of Steps (and weight in percentage) to be executed private static readonly IDictionary Steps = new Dictionary diff --git a/DNN Platform/Website/Install/UpgradeWizard.aspx.cs b/DNN Platform/Website/Install/UpgradeWizard.aspx.cs index 8d0bcb2b8d9..7d655a49424 100644 --- a/DNN Platform/Website/Install/UpgradeWizard.aspx.cs +++ b/DNN Platform/Website/Install/UpgradeWizard.aspx.cs @@ -35,6 +35,8 @@ namespace DotNetNuke.Services.Install using DotNetNuke.Services.Upgrade.Internals.Steps; using DotNetNuke.Services.UserRequest; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; + using Newtonsoft.Json; using Globals = DotNetNuke.Common.Globals; @@ -60,7 +62,7 @@ public partial class UpgradeWizard : PageBase protected static readonly string StatusFilename = "upgradestat.log.resources.txt"; private const string LocalesFile = "/Install/App_LocalResources/Locales.xml"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(UpgradeWizard)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static string localResourceFile = "~/Install/App_LocalResources/UpgradeWizard.aspx.resx"; private static string culture; private static string[] supportedLanguages; diff --git a/DNN Platform/Website/admin/Modules/Modulesettings.ascx.cs b/DNN Platform/Website/admin/Modules/Modulesettings.ascx.cs index 6d967a4e767..2b7807b08ce 100644 --- a/DNN Platform/Website/admin/Modules/Modulesettings.ascx.cs +++ b/DNN Platform/Website/admin/Modules/Modulesettings.ascx.cs @@ -32,13 +32,14 @@ namespace DotNetNuke.Modules.Admin.Modules using DotNetNuke.UI.Skins; using DotNetNuke.UI.Skins.Controls; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; using Globals = DotNetNuke.Common.Globals; /// The ModuleSettingsPage PortalModuleBase is used to edit the settings for a module. public partial class ModuleSettingsPage : PortalModuleBase { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ModuleSettingsPage)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly INavigationManager navigationManager; private readonly IPortalAliasService portalAliasService; private readonly IModuleControlPipeline moduleControlPipeline; diff --git a/DNN Platform/Website/admin/Sales/PayPalSubscription.aspx.cs b/DNN Platform/Website/admin/Sales/PayPalSubscription.aspx.cs index 0ded9479c13..06411cda44f 100644 --- a/DNN Platform/Website/admin/Sales/PayPalSubscription.aspx.cs +++ b/DNN Platform/Website/admin/Sales/PayPalSubscription.aspx.cs @@ -18,11 +18,13 @@ namespace DotNetNuke.Modules.Admin.Sales using DotNetNuke.Security.Roles; using DotNetNuke.Services.Exceptions; + using Microsoft.Extensions.Logging; + /// A page which receives subscription messages from PayPal. [DnnDeprecated(10, 0, 2, "No replacement")] public partial class PayPalSubscription : PageBase { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(PayPalSubscription)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// Initializes a new instance of the class. public PayPalSubscription() diff --git a/DNN Platform/Website/admin/Security/SendPassword.ascx.cs b/DNN Platform/Website/admin/Security/SendPassword.ascx.cs index 40cd84bc1e9..9e59d86123c 100644 --- a/DNN Platform/Website/admin/Security/SendPassword.ascx.cs +++ b/DNN Platform/Website/admin/Security/SendPassword.ascx.cs @@ -26,11 +26,12 @@ namespace DotNetNuke.Modules.Admin.Security using DotNetNuke.Services.UserRequest; using DotNetNuke.UI.Skins.Controls; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// The SendPassword UserModuleBase is used to allow a user to retrieve their password. public partial class SendPassword : UserModuleBase { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(SendPassword)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly INavigationManager navigationManager; private readonly IEventLogger eventLogger; private readonly IPortalController portalController; diff --git a/DNN Platform/Website/admin/Skins/Toast.ascx.cs b/DNN Platform/Website/admin/Skins/Toast.ascx.cs index db357c4a41c..952483eafbd 100644 --- a/DNN Platform/Website/admin/Skins/Toast.ascx.cs +++ b/DNN Platform/Website/admin/Skins/Toast.ascx.cs @@ -21,13 +21,14 @@ namespace DotNetNuke.UI.Skins.Controls using DotNetNuke.Services.ClientDependency; using DotNetNuke.Services.Localization; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// A skin/theme object which allows the display of toast messages. public partial class Toast : SkinObjectBase { private const string MyFileName = "Toast.ascx"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(Toast)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly string ToastCacheKey = "DNN_Toast_Config"; private readonly INavigationManager navigationManager; private readonly IJavaScriptLibraryHelper javaScript; diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/ConfigConsole/ConfigConsoleController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/ConfigConsole/ConfigConsoleController.cs index 2480bc41ab9..9bc28be5cc9 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/ConfigConsole/ConfigConsoleController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/ConfigConsole/ConfigConsoleController.cs @@ -24,6 +24,7 @@ namespace Dnn.PersonaBar.ConfigConsole.Components using DotNetNuke.Services.Installer; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// Contains business logic for the Config Console component in the Persona Bar. public partial class ConfigConsoleController @@ -33,7 +34,7 @@ public partial class ConfigConsoleController private const string CONFIGEXT = ".config"; private const string ROBOTSEXT = "robots.txt"; // in multi-portal instances, there may be multiple robots.txt files (e.g., site1.com.robots.txt, site2.com.robots.txt, etc.) - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ConfigConsoleController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IApplicationStatusInfo appStatus; private readonly IApplicationInfo appInfo; diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/AuthSystemPackageEditor.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/AuthSystemPackageEditor.cs index e98d3f6c60c..02ae69660a5 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/AuthSystemPackageEditor.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/AuthSystemPackageEditor.cs @@ -16,10 +16,11 @@ namespace Dnn.PersonaBar.Extensions.Components.Editors using DotNetNuke.Services.Authentication.OAuth; using DotNetNuke.Services.Installer.Packages; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; public class AuthSystemPackageEditor : IPackageEditor { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(AuthSystemPackageEditor)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static INavigationManager NavigationManager => Globals.GetCurrentServiceProvider().GetRequiredService(); diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/CoreLanguagePackageEditor.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/CoreLanguagePackageEditor.cs index 25e9c584792..bb0ee739701 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/CoreLanguagePackageEditor.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/CoreLanguagePackageEditor.cs @@ -17,10 +17,11 @@ namespace Dnn.PersonaBar.Extensions.Components.Editors using DotNetNuke.Services.Installer.Packages; using DotNetNuke.Services.Localization; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; public class CoreLanguagePackageEditor : IPackageEditor { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(JsLibraryPackageEditor)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); public CoreLanguagePackageEditor() { diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/ExtensionLanguagePackageEditor.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/ExtensionLanguagePackageEditor.cs index d6c11f55910..4d0affde66f 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/ExtensionLanguagePackageEditor.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/ExtensionLanguagePackageEditor.cs @@ -17,10 +17,11 @@ namespace Dnn.PersonaBar.Extensions.Components.Editors using DotNetNuke.Services.Installer.Packages; using DotNetNuke.Services.Localization; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; public class ExtensionLanguagePackageEditor : IPackageEditor { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(JsLibraryPackageEditor)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// Initializes a new instance of the class. public ExtensionLanguagePackageEditor() diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/JsLibraryPackageEditor.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/JsLibraryPackageEditor.cs index ca75c7282fd..3f855ac2357 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/JsLibraryPackageEditor.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/JsLibraryPackageEditor.cs @@ -14,9 +14,11 @@ namespace Dnn.PersonaBar.Extensions.Components.Editors using DotNetNuke.Instrumentation; using DotNetNuke.Services.Installer.Packages; + using Microsoft.Extensions.Logging; + public class JsLibraryPackageEditor : IPackageEditor { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(JsLibraryPackageEditor)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// public PackageInfoDto GetPackageDetail(int portalId, PackageInfo package) diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/ModulePackageEditor.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/ModulePackageEditor.cs index c57dc1a0c4a..0a8266c9290 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/ModulePackageEditor.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/ModulePackageEditor.cs @@ -26,6 +26,7 @@ namespace Dnn.PersonaBar.Extensions.Components.Editors using DotNetNuke.Services.Installer.Packages; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; using Newtonsoft.Json; @@ -34,7 +35,7 @@ namespace Dnn.PersonaBar.Extensions.Components.Editors /// The event logger. public class ModulePackageEditor(IPermissionDefinitionService permissionDefinitionService, IEventLogger eventLogger) : IPackageEditor { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ModulePackageEditor)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IPermissionDefinitionService permissionDefinitionService = permissionDefinitionService ?? Globals.GetCurrentServiceProvider().GetRequiredService(); private readonly IEventLogger eventLogger = eventLogger ?? Globals.GetCurrentServiceProvider().GetRequiredService(); diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/SkinObjectPackageEditor.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/SkinObjectPackageEditor.cs index 230a9468439..f12378c411d 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/SkinObjectPackageEditor.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/SkinObjectPackageEditor.cs @@ -13,9 +13,11 @@ namespace Dnn.PersonaBar.Extensions.Components.Editors using DotNetNuke.Instrumentation; using DotNetNuke.Services.Installer.Packages; + using Microsoft.Extensions.Logging; + public class SkinObjectPackageEditor : IPackageEditor { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(SkinObjectPackageEditor)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// public PackageInfoDto GetPackageDetail(int portalId, PackageInfo package) diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/SkinPackageEditor.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/SkinPackageEditor.cs index 7d094dad21f..3b2b15c4f53 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/SkinPackageEditor.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/SkinPackageEditor.cs @@ -13,9 +13,11 @@ namespace Dnn.PersonaBar.Extensions.Components.Editors using DotNetNuke.Services.Installer.Packages; using DotNetNuke.UI.Skins; + using Microsoft.Extensions.Logging; + public class SkinPackageEditor : IPackageEditor { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(SkinPackageEditor)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// public PackageInfoDto GetPackageDetail(int portalId, PackageInfo package) diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/InstallController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/InstallController.cs index 24fc7059d3f..453bd462c54 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/InstallController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/InstallController.cs @@ -22,9 +22,11 @@ namespace Dnn.PersonaBar.Extensions.Components using DotNetNuke.Instrumentation; using DotNetNuke.Services.Installer; + using Microsoft.Extensions.Logging; + public class InstallController : ServiceLocator, IInstallController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(InstallController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// [SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration", Justification = "Breaking change")] diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Commands/Application/RestartApplication.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Commands/Application/RestartApplication.cs index e9705cdc899..8884c295b0a 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Commands/Application/RestartApplication.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Commands/Application/RestartApplication.cs @@ -14,11 +14,13 @@ namespace Dnn.PersonaBar.Prompt.Components.Commands.Application using DotNetNuke.Instrumentation; using DotNetNuke.Services.Log.EventLog; + using Microsoft.Extensions.Logging; + [ConsoleCommand("restart-application", Constants.HostCategory, "Prompt_RestartApplication_Description")] public class RestartApplication : ConsoleCommandBase { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(RestartApplication)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); public override string LocalResourceFile => Constants.LocalResourcesFile; diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Commands/Commands/ListCommands.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Commands/Commands/ListCommands.cs index 57576b75bfc..37e4e6c4d24 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Commands/Commands/ListCommands.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Commands/Commands/ListCommands.cs @@ -18,10 +18,12 @@ namespace Dnn.PersonaBar.Prompt.Components.Commands.Commands using Dnn.PersonaBar.Prompt.Components.Repositories; using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + [ConsoleCommand("list-commands", Constants.GeneralCategory, "Prompt_ListCommands_Description")] public class ListCommands : ConsoleCommandBase { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ListCommands)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// public override string LocalResourceFile => Constants.LocalResourcesFile; diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Commands/Host/ClearCache.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Commands/Host/ClearCache.cs index 8a4c4095724..5d01fcdab06 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Commands/Host/ClearCache.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Commands/Host/ClearCache.cs @@ -12,11 +12,13 @@ namespace Dnn.PersonaBar.Prompt.Components.Commands.Host using DotNetNuke.Common.Utilities; using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + [ConsoleCommand("clear-cache", Constants.HostCategory, "Prompt_ClearCache_Description")] public class ClearCache : ConsoleCommandBase { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ClearCache)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// public override string LocalResourceFile => Constants.LocalResourcesFile; diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Commands/Portal/ClearLog.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Commands/Portal/ClearLog.cs index 77aef055791..20f0fc34c9c 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Commands/Portal/ClearLog.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Commands/Portal/ClearLog.cs @@ -16,11 +16,12 @@ namespace Dnn.PersonaBar.Prompt.Components.Commands.Portal using DotNetNuke.Services.Log.EventLog; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; [ConsoleCommand("clear-log", Constants.PortalCategory, "Prompt_ClearLog_Description")] public class ClearLog : ConsoleCommandBase { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ClearLog)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IEventLogService eventLogService; /// Initializes a new instance of the class. diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/ModulesController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/ModulesController.cs index 0ac56f26dfd..71903ec9064 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/ModulesController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/ModulesController.cs @@ -22,11 +22,13 @@ namespace Dnn.PersonaBar.Prompt.Components using DotNetNuke.Security.Permissions; using DotNetNuke.Services.Localization; + using Microsoft.Extensions.Logging; + /// [DnnDeprecated(9, 2, 1, "Moved to Dnn.PersonaBar.Library.Controllers because of multiple dependency.")] public partial class ModulesController : ServiceLocator, IModulesController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ModulesController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// public List AddNewModule(PortalSettings portalSettings, string title, int desktopModuleId, int tabId, string paneName, int position, int permissionType, string align, out KeyValuePair message) diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Utilities.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Utilities.cs index 0eac282d169..1799438f498 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Utilities.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Utilities.cs @@ -13,9 +13,11 @@ namespace Dnn.PersonaBar.Prompt.Components using DotNetNuke.Security.Roles; using DotNetNuke.Services.Localization; + using Microsoft.Extensions.Logging; + public class Utilities { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(Utilities)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); public static RoleInfo CreateRole(string roleName, int portalId, RoleStatus status, string description = "", bool isPublic = false, bool autoAssign = false, int roleGroupId = -1) { diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Recyclebin/RecyclebinController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Recyclebin/RecyclebinController.cs index 5f04fd1f887..d267599787a 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Recyclebin/RecyclebinController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Recyclebin/RecyclebinController.cs @@ -27,13 +27,15 @@ namespace Dnn.PersonaBar.Recyclebin.Components using DotNetNuke.Security.Permissions; using DotNetNuke.Services.Localization; + using Microsoft.Extensions.Logging; + public class RecyclebinController : ServiceLocator, IRecyclebinController { [SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMustBePrivate", Justification = "Breaking change")] [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields", Justification = "Breaking change")] public static readonly string PageDateTimeFormat = "yyyy-MM-dd hh:mm tt"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(RecyclebinController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly ITabController tabController; private readonly ITabVersionSettings tabVersionSettings; private readonly ITabChangeSettings tabChangeSettings; diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Roles/Prompt/Commands/DeleteRole.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Roles/Prompt/Commands/DeleteRole.cs index 4608b3f87a2..6d6975ac7e9 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Roles/Prompt/Commands/DeleteRole.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Roles/Prompt/Commands/DeleteRole.cs @@ -17,6 +17,8 @@ namespace Dnn.PersonaBar.Roles.Components.Prompt.Commands using DotNetNuke.Entities.Users; using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + [ConsoleCommand("delete-role", Constants.RolesCategory, "Prompt_DeleteRole_Description")] public class DeleteRole : ConsoleCommandBase @@ -24,7 +26,7 @@ public class DeleteRole : ConsoleCommandBase [FlagParameter("id", "Prompt_DeleteRole_FlagId", "Integer", true)] private const string FlagId = "id"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(DeleteRole)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// public override string LocalResourceFile => Constants.LocalResourcesFile; diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Roles/Prompt/Commands/ListRoles.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Roles/Prompt/Commands/ListRoles.cs index 0a40bd0a044..a617f560d5b 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Roles/Prompt/Commands/ListRoles.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Roles/Prompt/Commands/ListRoles.cs @@ -16,6 +16,8 @@ namespace Dnn.PersonaBar.Roles.Components.Prompt.Commands using DotNetNuke.Entities.Users; using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + [ConsoleCommand("list-roles", Constants.RolesCategory, "Prompt_ListRoles_Description")] public class ListRoles : ConsoleCommandBase { @@ -25,7 +27,7 @@ public class ListRoles : ConsoleCommandBase [FlagParameter("max", "Prompt_ListRoles_FlagMax", "Integer", "10")] private const string FlagMax = "max"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ListRoles)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// public override string LocalResourceFile => Constants.LocalResourcesFile; diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Roles/Prompt/Commands/NewRole.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Roles/Prompt/Commands/NewRole.cs index 6553c79bf3c..ce83ff21e5b 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Roles/Prompt/Commands/NewRole.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Roles/Prompt/Commands/NewRole.cs @@ -20,6 +20,8 @@ namespace Dnn.PersonaBar.Roles.Components.Prompt.Commands using DotNetNuke.Instrumentation; using DotNetNuke.Security.Roles; + using Microsoft.Extensions.Logging; + [ConsoleCommand("new-role", Constants.RolesCategory, "Prompt_NewRole_Description")] public class NewRole : ConsoleCommandBase { @@ -38,7 +40,7 @@ public class NewRole : ConsoleCommandBase [FlagParameter("status", "Prompt_NewRole_FlagStatus", "Boolean", "approved")] private const string FlagStatus = "status"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(NewRole)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// public override string LocalResourceFile => Constants.LocalResourcesFile; diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Roles/Prompt/Commands/SetRole.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Roles/Prompt/Commands/SetRole.cs index 48baa3005fe..97c96f96432 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Roles/Prompt/Commands/SetRole.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Roles/Prompt/Commands/SetRole.cs @@ -19,6 +19,8 @@ namespace Dnn.PersonaBar.Roles.Components.Prompt.Commands using DotNetNuke.Instrumentation; using DotNetNuke.Security.Roles; + using Microsoft.Extensions.Logging; + [ConsoleCommand("set-role", Constants.RolesCategory, "Prompt_SetRole_Description")] public class SetRole : ConsoleCommandBase { @@ -40,7 +42,7 @@ public class SetRole : ConsoleCommandBase [FlagParameter("status", "Prompt_SetRole_FlagStatus", "Boolean")] private const string FlagStatus = "status"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(SetRole)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// public override string LocalResourceFile => Constants.LocalResourcesFile; diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/SiteSettings/LanguagesControllerTasks.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/SiteSettings/LanguagesControllerTasks.cs index 703bf84e830..d812e4028c3 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/SiteSettings/LanguagesControllerTasks.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/SiteSettings/LanguagesControllerTasks.cs @@ -19,13 +19,16 @@ namespace Dnn.PersonaBar.SiteSettings.Components using DotNetNuke.Entities.Tabs; using DotNetNuke.Instrumentation; using DotNetNuke.Services.Localization; + + using Microsoft.Extensions.Logging; + using Newtonsoft.Json; internal class LanguagesControllerTasks { private const string LocalResourcesFile = "~/DesktopModules/admin/Dnn.PersonaBar/Modules/Dnn.SiteSettings/App_LocalResources/SiteSettings.resx"; private const string LocalizationProgressFile = "PersonaBarLocalizationProgress.txt"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(LanguagesControllerTasks)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); public static void LocalizeSitePages(LocalizationProgress progress, int portalId, bool translatePages, string defaultLanguage) { diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Sites/SitesController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Sites/SitesController.cs index 8c0ef863a56..6f1a7fcebb2 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Sites/SitesController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Sites/SitesController.cs @@ -39,12 +39,14 @@ namespace Dnn.PersonaBar.Sites.Components using DotNetNuke.Services.Localization; using DotNetNuke.Services.Mail; + using Microsoft.Extensions.Logging; + using FileInfo = DotNetNuke.Services.FileSystem.FileInfo; public class SitesController { internal static readonly IList ImageExtensions = new List() { ".png", ".jpg", ".jpeg" }; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(SitesController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly TabsController tabsController = new TabsController(); [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = "Breaking change")] diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/TaskScheduler/Prompt/Commands/GetTask.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/TaskScheduler/Prompt/Commands/GetTask.cs index c689a8a87b6..0a791ba6465 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/TaskScheduler/Prompt/Commands/GetTask.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/TaskScheduler/Prompt/Commands/GetTask.cs @@ -17,13 +17,15 @@ namespace Dnn.PersonaBar.TaskScheduler.Components.Prompt.Commands using DotNetNuke.Instrumentation; using DotNetNuke.Services.Scheduling; + using Microsoft.Extensions.Logging; + [ConsoleCommand("get-task", Constants.SchedulerCategory, "Prompt_GetTask_Description")] public class GetTask : ConsoleCommandBase { [FlagParameter("id", "Prompt_GetTask_FlagId", "Integer", true)] private const string FlagId = "id"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(GetTask)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// public override string LocalResourceFile => Constants.LocalResourcesFile; diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/TaskScheduler/Prompt/Commands/SetTask.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/TaskScheduler/Prompt/Commands/SetTask.cs index 841e8fe5bdb..969167a4c8a 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/TaskScheduler/Prompt/Commands/SetTask.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/TaskScheduler/Prompt/Commands/SetTask.cs @@ -17,6 +17,8 @@ namespace Dnn.PersonaBar.TaskScheduler.Components.Prompt.Commands using DotNetNuke.Instrumentation; using DotNetNuke.Services.Scheduling; + using Microsoft.Extensions.Logging; + [ConsoleCommand("set-task", Constants.SchedulerCategory, "Prompt_SetTask_Description")] public class SetTask : ConsoleCommandBase { @@ -26,7 +28,7 @@ public class SetTask : ConsoleCommandBase [FlagParameter("enabled", "Prompt_SetTask_FlagEnabled", "Boolean", true)] private const string FlagEnabled = "enabled"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(SetTask)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); public override string LocalResourceFile => Constants.LocalResourcesFile; diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/TaskScheduler/TaskSchedulerController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/TaskScheduler/TaskSchedulerController.cs index 035489c02f1..a915050417a 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/TaskScheduler/TaskSchedulerController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/TaskScheduler/TaskSchedulerController.cs @@ -17,11 +17,12 @@ namespace Dnn.PersonaBar.TaskScheduler.Components using DotNetNuke.Services.Localization; using DotNetNuke.Services.Scheduling; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; public class TaskSchedulerController { private static readonly string SchedulersToRunOnSameWebServerKey = "SchedulersToRunOnSameWebServer"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(TaskSchedulerController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static string LocalResourcesFile => Path.Combine("~/DesktopModules/admin/Dnn.PersonaBar/Modules/Dnn.TaskScheduler/App_LocalResources/TaskScheduler.resx"); diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Themes/ThemesController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Themes/ThemesController.cs index 051ea27e34c..660a1336901 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Themes/ThemesController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Themes/ThemesController.cs @@ -20,6 +20,8 @@ namespace Dnn.PersonaBar.Themes.Components using DotNetNuke.Services.Exceptions; using DotNetNuke.UI.Skins; + using Microsoft.Extensions.Logging; + using Image = System.Drawing.Image; public class ThemesController : ServiceLocator, IThemesController @@ -28,7 +30,7 @@ public class ThemesController : ServiceLocator DefaultLayoutNames = new List() { "Default", "2-Col", "Home", "Index", "Main" }; internal static readonly IList DefaultContainerNames = new List() { "Title-h2", "NoTitle", "Main", "Default" }; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ThemesController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly object ThreadLocker = new object(); diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Users/UsersController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Users/UsersController.cs index 3deaa815902..338bd2ddd62 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Users/UsersController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Users/UsersController.cs @@ -30,11 +30,13 @@ namespace Dnn.PersonaBar.Users.Components using DotNetNuke.Services.Localization; using DotNetNuke.Services.Mail; + using Microsoft.Extensions.Logging; + using MembershipProvider = DotNetNuke.Security.Membership.MembershipProvider; public class UsersController : ServiceLocator, IUsersController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(Services.UsersController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static PortalSettings PortalSettings => PortalSettings.Current; diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/AdminLogsController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/AdminLogsController.cs index 139016084f4..96b036e286d 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/AdminLogsController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/AdminLogsController.cs @@ -19,12 +19,15 @@ namespace Dnn.PersonaBar.AdminLogs.Services using DotNetNuke.Services.Localization; using DotNetNuke.Services.Log.EventLog; using DotNetNuke.Web.Api; + + using Microsoft.Extensions.Logging; + using Newtonsoft.Json.Linq; [MenuPermission(MenuName = Components.Constants.MenuName)] public class AdminLogsController : PersonaBarApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(AdminLogsController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly Components.AdminLogsController controller = new Components.AdminLogsController(); /// GET: api/AdminLogs/GetLogTypes diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/CommandController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/CommandController.cs index 2c8e2cc884e..37eeb6390f5 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/CommandController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/CommandController.cs @@ -27,6 +27,7 @@ namespace Dnn.PersonaBar.Prompt.Services using DotNetNuke.Web.Api; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; using IConsoleCommand = DotNetNuke.Abstractions.Prompt.IConsoleCommand; #pragma warning disable CS0618 @@ -37,7 +38,7 @@ namespace Dnn.PersonaBar.Prompt.Services [RequireHost] public class CommandController : ControllerBase, IServiceRouteMapper { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(CommandController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly string[] DenyList = ["smtppassword", "password", "pwd", "pass", "apikey",]; private static readonly string[] Namespaces = ["Dnn.PersonaBar.Prompt.Services",]; private static readonly char[] Separators = [',', '|', ' ',]; diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ConfigConsoleController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ConfigConsoleController.cs index 37ded45b5fe..88d2ab1713b 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ConfigConsoleController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ConfigConsoleController.cs @@ -20,12 +20,13 @@ namespace Dnn.PersonaBar.ConfigConsole.Services using DotNetNuke.Web.Api; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// The web API controller for the Config Console component in the Persona Bar. [MenuPermission(Scope = ServiceScope.Host)] public class ConfigConsoleController : PersonaBarApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ConfigConsoleController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private Components.ConfigConsoleController controller; /// Initializes a new instance of the class. diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ConnectorsController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ConnectorsController.cs index 5b80c5746f3..2313a3264d7 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ConnectorsController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ConnectorsController.cs @@ -21,10 +21,12 @@ namespace Dnn.PersonaBar.Connectors.Services using DotNetNuke.Services.Localization; using DotNetNuke.Web.Api; + using Microsoft.Extensions.Logging; + [MenuPermission(MenuName = "Dnn.Connectors")] public class ConnectorsController : PersonaBarApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ConnectorsController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IServiceProvider serviceProvider; private readonly IConnectionsManager connectionsManager; diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/CssEditorController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/CssEditorController.cs index 1444db3f013..2272b005c93 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/CssEditorController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/CssEditorController.cs @@ -22,10 +22,12 @@ namespace Dnn.PersonaBar.CssEditor.Services using DotNetNuke.Web.Client; using DotNetNuke.Web.Client.ClientResourceManagement; + using Microsoft.Extensions.Logging; + [MenuPermission(Scope = ServiceScope.Admin)] public class CssEditorController : PersonaBarApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(CssEditorController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// GET: api/CssEditor/GetStyleSheet /// Gets portal.css of specific portal. diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ExtensionsController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ExtensionsController.cs index 26f09ed776a..af13c41c532 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ExtensionsController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ExtensionsController.cs @@ -43,6 +43,8 @@ namespace Dnn.PersonaBar.Extensions.Services using DotNetNuke.Web.Api; using DotNetNuke.Web.Api.Internal; + using Microsoft.Extensions.Logging; + using Constants = Dnn.PersonaBar.Extensions.Components.Constants; using Util = DotNetNuke.Entities.Content.Common.Util; @@ -50,7 +52,7 @@ namespace Dnn.PersonaBar.Extensions.Services public class ExtensionsController : PersonaBarApiController { private const string AuthFailureMessage = "Authorization has been denied for this request."; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ExtensionsController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly Regex ManifestExensionsRegex = new Regex(@"dnn\d*$"); private static readonly string[] SpecialModuleFolders = new[] { "mvc" }; private readonly Components.ExtensionsController controller = new Components.ExtensionsController(); diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/LanguagesController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/LanguagesController.cs index f4f944b5ab9..db632e7a548 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/LanguagesController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/LanguagesController.cs @@ -34,6 +34,8 @@ namespace Dnn.PersonaBar.SiteSettings.Services using DotNetNuke.Services.Log.EventLog; using DotNetNuke.Web.Api; + using Microsoft.Extensions.Logging; + [MenuPermission(Scope = ServiceScope.Admin)] public class LanguagesController : PersonaBarApiController { @@ -55,7 +57,7 @@ public class LanguagesController : PersonaBarApiController private const string AuthFailureMessage = "Authorization has been denied for this request."; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(LanguagesController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly string[] RootFolders = [ diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/LicensingController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/LicensingController.cs index 7662b4e9455..93108501b9e 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/LicensingController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/LicensingController.cs @@ -14,10 +14,12 @@ namespace Dnn.PersonaBar.Licensing.Services using DotNetNuke.Application; using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + [MenuPermission(Scope = ServiceScope.Host)] public class LicensingController : PersonaBarApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(LicensingController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// GET: api/Licensing/GetProduct /// Gets product info. diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/PagesController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/PagesController.cs index d9b17737cfa..5be2bab1c5e 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/PagesController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/PagesController.cs @@ -37,6 +37,8 @@ namespace Dnn.PersonaBar.Pages.Services using DotNetNuke.Web.Api; using DotNetNuke.Web.UI.WebControls; + using Microsoft.Extensions.Logging; + using Localization = Dnn.PersonaBar.Pages.Components.Localization; /// API controller for the Pages persona bar module. @@ -45,7 +47,7 @@ namespace Dnn.PersonaBar.Pages.Services public class PagesController : PersonaBarApiController { private const string LocalResourceFile = Library.Constants.PersonaBarRelativePath + "Modules/Dnn.Pages/App_LocalResources/Pages.resx"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(PagesController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IPagesController pagesController; private readonly IBulkPagesController bulkPagesController; diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/RolesController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/RolesController.cs index 740844ad49f..52e479223b5 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/RolesController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/RolesController.cs @@ -26,10 +26,12 @@ namespace Dnn.PersonaBar.Roles.Services using DotNetNuke.Services.Localization; using DotNetNuke.Web.Api; + using Microsoft.Extensions.Logging; + [MenuPermission(MenuName = Components.Constants.MenuName)] public class RolesController : PersonaBarApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(RolesController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); [HttpGet] public HttpResponseMessage GetRoles(int groupId, string keyword, int startIndex, int pageSize) diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SecurityController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SecurityController.cs index c4b6d4421a0..7cbfb1a3d20 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SecurityController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SecurityController.cs @@ -47,6 +47,7 @@ namespace Dnn.PersonaBar.Security.Services using DotNetNuke.Web.Api.Auth.ApiTokens.Models; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; using Constants = Dnn.PersonaBar.Library.Constants; using Localization = DotNetNuke.Services.Localization.Localization; @@ -58,7 +59,7 @@ public class SecurityController : PersonaBarApiController private const string BULLETINXMLNODEPATH = "//channel/item"; private const string UserRequestIPHeaderSettingName = "UserRequestIPHeader"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(SecurityController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly Components.SecurityController controller; private readonly IPagesController pagesController; diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SeoController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SeoController.cs index 63bfc0629bc..d3900e229a9 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SeoController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SeoController.cs @@ -33,10 +33,12 @@ namespace Dnn.PersonaBar.Seo.Services using DotNetNuke.Services.Url.FriendlyUrl; using DotNetNuke.Web.Api; + using Microsoft.Extensions.Logging; + [MenuPermission(MenuName = "Dnn.Seo")] public class SeoController : PersonaBarApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(SeoController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly string LocalResourcesFile = Path.Combine("~/DesktopModules/admin/Dnn.PersonaBar/Modules/Dnn.Seo/App_LocalResources/Seo.resx"); private readonly Components.SeoController controller; diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerController.cs index 85c8b1c0ea7..0d31712b7ab 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerController.cs @@ -22,10 +22,12 @@ namespace Dnn.PersonaBar.Servers.Services using DotNetNuke.Web.Api; using DotNetNuke.Web.Client.ClientResourceManagement; + using Microsoft.Extensions.Logging; + [MenuPermission(Scope = ServiceScope.Host)] public class ServerController : PersonaBarApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ServerController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); public ServerController(INavigationManager navigationManager) { diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerSettingsLogsController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerSettingsLogsController.cs index c9bd97ce9b4..ae1dffa4b22 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerSettingsLogsController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerSettingsLogsController.cs @@ -17,10 +17,12 @@ namespace Dnn.PersonaBar.Servers.Services using DotNetNuke.Data; using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + [MenuPermission(Scope = ServiceScope.Host)] public class ServerSettingsLogsController : PersonaBarApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ServerSettingsLogsController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly LogController logController = new LogController(); [HttpGet] diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerSettingsPerformanceController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerSettingsPerformanceController.cs index 64be29946ef..27e96fc2b6f 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerSettingsPerformanceController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerSettingsPerformanceController.cs @@ -24,12 +24,13 @@ namespace Dnn.PersonaBar.Servers.Services using DotNetNuke.Web.Client; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; [MenuPermission(Scope = ServiceScope.Host)] public class ServerSettingsPerformanceController : PersonaBarApiController { private const string UseSSLKey = "UseSSLForCacheSync"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ServerSettingsPerformanceController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly PerformanceController performanceController = new PerformanceController(); private readonly IHostSettings hostSettings; private readonly IHostSettingsService hostSettingsService; diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerSettingsSmtpAdminController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerSettingsSmtpAdminController.cs index a7051c592ae..541a4455652 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerSettingsSmtpAdminController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerSettingsSmtpAdminController.cs @@ -28,12 +28,14 @@ namespace Dnn.PersonaBar.Servers.Services using DotNetNuke.Services.Mail.OAuth; using DotNetNuke.Web.Api; + using Microsoft.Extensions.Logging; + /// Provides the APIs for SMTP settings management. [MenuPermission(Scope = ServiceScope.Admin)] public class ServerSettingsSmtpAdminController : PersonaBarApiController { private const string ObfuscateString = "*****"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ServerSettingsSmtpHostController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IHostSettingsService hostSettingsService; private readonly ISmtpOAuthController smtpOAuthController; diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerSettingsSmtpHostController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerSettingsSmtpHostController.cs index 9ed4effe688..5738d4457db 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerSettingsSmtpHostController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerSettingsSmtpHostController.cs @@ -27,12 +27,14 @@ namespace Dnn.PersonaBar.Servers.Services using DotNetNuke.Services.Mail.OAuth; using DotNetNuke.Web.Api; + using Microsoft.Extensions.Logging; + /// Provides the APIs for SMTP settings management. [MenuPermission(Scope = ServiceScope.Host)] public class ServerSettingsSmtpHostController : PersonaBarApiController { private const string ObfuscateString = "*****"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ServerSettingsSmtpHostController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IHostSettingsService hostSettingsService; private readonly ISmtpOAuthController smtpOAuthController; diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SiteGroupsController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SiteGroupsController.cs index f286e8e57b3..ed0a82e00b8 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SiteGroupsController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SiteGroupsController.cs @@ -15,10 +15,12 @@ namespace Dnn.PersonaBar.SiteGroups.Services using DotNetNuke.Instrumentation; using DotNetNuke.Web.Api; + using Microsoft.Extensions.Logging; + [MenuPermission(Scope = ServiceScope.Host)] public class SiteGroupsController : PersonaBarApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(SiteGroupsController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static IManagePortalGroups GroupManager => SiteGroups.Instance; diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SiteSettingsController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SiteSettingsController.cs index 3409e706cbd..2279505a093 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SiteSettingsController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SiteSettingsController.cs @@ -53,6 +53,7 @@ namespace Dnn.PersonaBar.SiteSettings.Services using DotNetNuke.Web.UI.WebControls; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; using Constants = Dnn.PersonaBar.Library.Constants; using FileInfo = System.IO.FileInfo; @@ -91,7 +92,7 @@ public class SiteSettingsController(INavigationManager navigationManager, IAppli private const string SearchAuthorBoostSetting = "Search_Author_Boost"; private const double DefaultMessagingThrottlingInterval = 0.5; // set default MessagingThrottlingInterval value to 30 seconds. - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(SiteSettingsController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly Components.SiteSettingsController controller = new Components.SiteSettingsController(); private readonly INavigationManager navigationManager = navigationManager ?? Globals.GetCurrentServiceProvider().GetRequiredService(); diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SitesController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SitesController.cs index 6288eac0919..7a2219dcb58 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SitesController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SitesController.cs @@ -22,10 +22,12 @@ namespace Dnn.PersonaBar.Sites.Services using DotNetNuke.Services.Localization; using DotNetNuke.Web.Api; + using Microsoft.Extensions.Logging; + [MenuPermission(Scope = ServiceScope.Host)] public class SitesController : PersonaBarApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(SitesController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly Components.SitesController controller = new Components.SitesController(); /// Gets list of portals. diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoApplicationAdminController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoApplicationAdminController.cs index 21d6bd1658e..be4ca54823d 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoApplicationAdminController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoApplicationAdminController.cs @@ -18,10 +18,12 @@ namespace Dnn.PersonaBar.Servers.Services using DotNetNuke.Framework.Providers; using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + [MenuPermission(Scope = ServiceScope.Admin)] public class SystemInfoApplicationAdminController : PersonaBarApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(SystemInfoApplicationAdminController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); public static string FirstCharToUpper(string input) => FirstCharToUpper(input, CultureInfo.CurrentCulture); diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoApplicationHostController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoApplicationHostController.cs index 4ab845a026a..2d4b3afb34b 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoApplicationHostController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoApplicationHostController.cs @@ -18,10 +18,12 @@ namespace Dnn.PersonaBar.Servers.Services using DotNetNuke.Framework.Providers; using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + [MenuPermission(Scope = ServiceScope.Host)] public class SystemInfoApplicationHostController : PersonaBarApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(SystemInfoApplicationHostController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); public static string FirstCharToUpper(string input) => FirstCharToUpper(input, CultureInfo.CurrentCulture); diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoDatabaseController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoDatabaseController.cs index 2df66f8b54f..8233d819875 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoDatabaseController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoDatabaseController.cs @@ -15,10 +15,12 @@ namespace Dnn.PersonaBar.Servers.Services using Dnn.PersonaBar.Servers.Components.DatabaseServer; using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + [MenuPermission(Scope = ServiceScope.Host)] public class SystemInfoDatabaseController : PersonaBarApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(SystemInfoDatabaseController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly DatabaseController databaseController = new DatabaseController(); [HttpGet] diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoServersController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoServersController.cs index 227ece43c2b..c46612ed263 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoServersController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoServersController.cs @@ -16,10 +16,12 @@ namespace Dnn.PersonaBar.Servers.Services using Dnn.PersonaBar.Library.Attributes; using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + [MenuPermission(Scope = ServiceScope.Host)] public class SystemInfoServersController : PersonaBarApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(SystemInfoServersController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); [HttpGet] public HttpResponseMessage GetServers() diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoWebController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoWebController.cs index 9a848f9e887..298a4376aac 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoWebController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoWebController.cs @@ -14,10 +14,12 @@ namespace Dnn.PersonaBar.Servers.Services using Dnn.PersonaBar.Servers.Components.WebServer; using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + [MenuPermission(Scope = ServiceScope.Host)] public class SystemInfoWebController : PersonaBarApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(SystemInfoWebController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); [HttpGet] public HttpResponseMessage GetWebServerInfo() diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/TaskSchedulerController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/TaskSchedulerController.cs index c87db96a665..0df220b1d05 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/TaskSchedulerController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/TaskSchedulerController.cs @@ -24,12 +24,14 @@ namespace Dnn.PersonaBar.TaskScheduler.Services using DotNetNuke.Services.Localization; using DotNetNuke.Services.Scheduling; using DotNetNuke.Web.Api; + + using Microsoft.Extensions.Logging; using Microsoft.VisualBasic; [MenuPermission(Scope = ServiceScope.Host)] public class TaskSchedulerController : PersonaBarApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(TaskSchedulerController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static string localResourcesFile = Path.Combine("~/DesktopModules/admin/Dnn.PersonaBar/Modules/Dnn.TaskScheduler/App_LocalResources/TaskScheduler.resx"); private Components.TaskSchedulerController controller = new Components.TaskSchedulerController(); diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ThemesController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ThemesController.cs index ef3ecb600d7..8b08a21becb 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ThemesController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ThemesController.cs @@ -30,11 +30,12 @@ namespace Dnn.PersonaBar.Themes.Services using DotNetNuke.Web.Api; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; [MenuPermission(MenuName = Components.Constants.MenuName)] public class ThemesController : PersonaBarApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ThemesController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IThemesController controller; private readonly IHostSettings hostSettings; private readonly IApplicationStatusInfo appStatus; diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/UpgradesController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/UpgradesController.cs index 16ae2876d38..0df605a33e7 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/UpgradesController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/UpgradesController.cs @@ -23,11 +23,13 @@ namespace Dnn.PersonaBar.Extensions.Services using DotNetNuke.Services.Localization; using DotNetNuke.Web.Api.Internal; + using Microsoft.Extensions.Logging; + [MenuPermission(Scope = ServiceScope.Host)] public class UpgradesController : PersonaBarApiController { private const string ResourceFile = "~/DesktopModules/Admin/Dnn.PersonaBar/Modules/Dnn.Servers/App_LocalResources/Servers.resx"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(UpgradesController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IApplicationStatusInfo applicationStatusInfo; private readonly ILocalUpgradeService localUpgradeService; diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/UsersController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/UsersController.cs index 8a352a680df..2560e8c88e7 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/UsersController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/UsersController.cs @@ -29,10 +29,12 @@ namespace Dnn.PersonaBar.Users.Services using DotNetNuke.Services.Mail; using DotNetNuke.Web.Api; + using Microsoft.Extensions.Logging; + [MenuPermission(MenuName = "Dnn.Users")] public class UsersController : PersonaBarApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(UsersController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// Create a User. /// Information about the user to create. diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/VocabulariesController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/VocabulariesController.cs index 1bb2a79a744..8f0b1bd6987 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/VocabulariesController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/VocabulariesController.cs @@ -21,13 +21,15 @@ namespace Dnn.PersonaBar.Vocabularies.Services using DotNetNuke.Services.Localization; using DotNetNuke.Web.Api; + using Microsoft.Extensions.Logging; + using Constants = Dnn.PersonaBar.Vocabularies.Components.Constants; [MenuPermission(MenuName = Constants.MenuIdentifier)] public class VocabulariesController : PersonaBarApiController { private const string AuthFailureMessage = "Authorization has been denied for this request."; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(VocabulariesController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private Components.VocabulariesController controller = new Components.VocabulariesController(); private static string LocalResourcesFile => Path.Combine(Library.Constants.PersonaBarRelativePath, "Modules/Dnn.Vocabularies/App_LocalResources/Vocabularies.resx"); diff --git a/Dnn.AdminExperience/EditBar/Dnn.EditBar.UI/Controllers/EditBarController.cs b/Dnn.AdminExperience/EditBar/Dnn.EditBar.UI/Controllers/EditBarController.cs index 667a2db1de2..c869dd095be 100644 --- a/Dnn.AdminExperience/EditBar/Dnn.EditBar.UI/Controllers/EditBarController.cs +++ b/Dnn.AdminExperience/EditBar/Dnn.EditBar.UI/Controllers/EditBarController.cs @@ -26,6 +26,7 @@ namespace Dnn.EditBar.UI.Controllers using DotNetNuke.Services.Log.EventLog; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// An implementation. /// The host settings. @@ -33,7 +34,7 @@ namespace Dnn.EditBar.UI.Controllers public class EditBarController(IHostSettings hostSettings, IEnumerable menuItems) : ServiceLocator, IEditBarController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(EditBarController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IHostSettings hostSettings = hostSettings ?? HttpContextSource.Current?.GetScope().ServiceProvider.GetRequiredService() ?? diff --git a/Dnn.AdminExperience/EditBar/Dnn.EditBar.UI/Services/ContentEditorController.cs b/Dnn.AdminExperience/EditBar/Dnn.EditBar.UI/Services/ContentEditorController.cs index c1688fd1ef1..c05334fdbaa 100644 --- a/Dnn.AdminExperience/EditBar/Dnn.EditBar.UI/Services/ContentEditorController.cs +++ b/Dnn.AdminExperience/EditBar/Dnn.EditBar.UI/Services/ContentEditorController.cs @@ -28,6 +28,7 @@ namespace Dnn.EditBar.UI.Services using DotNetNuke.Web.InternalServices; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// A web API controller for content editing. /// The application status. @@ -39,7 +40,7 @@ public class ContentEditorController(IApplicationStatusInfo appStatus, IHostSett { private const string DefaultExtensionImage = "icon_extensions_32px.png"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ContentEditorController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IApplicationStatusInfo appSettings = appStatus ?? HttpContextSource.Current.GetScope().ServiceProvider.GetRequiredService(); private readonly IHostSettings hostSettings = hostSettings ?? HttpContextSource.Current.GetScope().ServiceProvider.GetRequiredService(); diff --git a/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/AppEvents/EventsController.cs b/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/AppEvents/EventsController.cs index 2fd8992667c..abe7cf3e3ae 100644 --- a/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/AppEvents/EventsController.cs +++ b/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/AppEvents/EventsController.cs @@ -17,9 +17,11 @@ namespace Dnn.PersonaBar.Library.AppEvents using DotNetNuke.Framework.Reflections; using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + public class EventsController : ServiceLocator, IEventsController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(EventsController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly object LockThis = new object(); private static bool isInitialized; diff --git a/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Common/IocUtil.cs b/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Common/IocUtil.cs index e21f90a6383..33bf0dc7c0e 100644 --- a/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Common/IocUtil.cs +++ b/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Common/IocUtil.cs @@ -11,9 +11,11 @@ namespace Dnn.PersonaBar.Library.Common using DotNetNuke.ComponentModel; using DotNetNuke.Instrumentation; + using Microsoft.Extensions.Logging; + public class IocUtil { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(IocUtil)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// Register a component into the IOC container for later instantiation. /// Contract interface for the component to registr with the IOC container. diff --git a/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Controllers/ModulesController.cs b/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Controllers/ModulesController.cs index 277c5cf5aae..180119d7e19 100644 --- a/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Controllers/ModulesController.cs +++ b/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Controllers/ModulesController.cs @@ -22,9 +22,11 @@ namespace Dnn.PersonaBar.Library.Controllers using DotNetNuke.Security.Permissions; using DotNetNuke.Services.Localization; + using Microsoft.Extensions.Logging; + public class ModulesController : ServiceLocator, IModulesController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ModulesController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private IContentVerifier contentVerifier; /// Initializes a new instance of the class. diff --git a/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Controllers/PersonaBarController.cs b/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Controllers/PersonaBarController.cs index b8cd76d6d6d..7937535f205 100644 --- a/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Controllers/PersonaBarController.cs +++ b/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Controllers/PersonaBarController.cs @@ -20,6 +20,8 @@ namespace Dnn.PersonaBar.Library.Controllers using DotNetNuke.Framework; using DotNetNuke.Instrumentation; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; + using Newtonsoft.Json; using MenuItem = Dnn.PersonaBar.Library.Model.MenuItem; @@ -28,7 +30,7 @@ namespace Dnn.PersonaBar.Library.Controllers public class PersonaBarController(IServiceScopeFactory serviceScopeFactory, IPersonaBarRepository personaBarRepository, IHostSettings hostSettings, IPortalController portalController) : ServiceLocator, IPersonaBarController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(PersonaBarController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IServiceScopeFactory serviceScopeFactory = serviceScopeFactory ?? Globals.GetCurrentServiceProvider().GetRequiredService(); private readonly IPersonaBarRepository personaBarRepository = personaBarRepository ?? PersonaBarRepository.Instance; diff --git a/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Permissions/MenuPermissionController.cs b/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Permissions/MenuPermissionController.cs index 8ef04b244f7..58e51c45094 100644 --- a/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Permissions/MenuPermissionController.cs +++ b/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Permissions/MenuPermissionController.cs @@ -25,6 +25,7 @@ namespace Dnn.PersonaBar.Library.Permissions using DotNetNuke.Security.Roles; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; using PermissionInfo = Dnn.PersonaBar.Library.Model.PermissionInfo; @@ -37,7 +38,7 @@ public partial class MenuPermissionController private const string ViewPermissionKey = "VIEW"; - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(MenuPermissionController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly DataService DataService = new DataService(); private static readonly object ThreadLocker = new object(); diff --git a/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Components/BusinessController.cs b/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Components/BusinessController.cs index 07f27ca6465..59dd85f5601 100644 --- a/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Components/BusinessController.cs +++ b/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Components/BusinessController.cs @@ -28,11 +28,12 @@ namespace Dnn.PersonaBar.UI.Components using DotNetNuke.Services.Localization; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// Provides upgrade logic for the Persona Bar. public class BusinessController(IHostSettingsService hostSettingsService, IHostSettings hostSettings, IPortalController portalController) : IUpgradeable { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(BusinessController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IHostSettingsService hostSettingsService = hostSettingsService ?? Globals.GetCurrentServiceProvider().GetRequiredService(); private readonly IHostSettings hostSettings = hostSettings ?? Globals.GetCurrentServiceProvider().GetRequiredService(); private readonly IPortalController portalController = portalController ?? Globals.GetCurrentServiceProvider().GetRequiredService(); diff --git a/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/HttpModules/PersonaBarModule.cs b/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/HttpModules/PersonaBarModule.cs index 2b48c651f34..400ed324771 100644 --- a/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/HttpModules/PersonaBarModule.cs +++ b/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/HttpModules/PersonaBarModule.cs @@ -16,10 +16,12 @@ namespace Dnn.PersonaBar.UI.HttpModules using DotNetNuke.Instrumentation; using DotNetNuke.UI.Skins.EventListeners; + using Microsoft.Extensions.Logging; + /// An which registers components for the Persona Bar. public class PersonaBarModule : IHttpModule { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(PersonaBarModule)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly object LockAppStarted = new object(); private static bool hasAppStarted; diff --git a/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/ComponentsController.cs b/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/ComponentsController.cs index 1f19fd81106..35ba78fade9 100644 --- a/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/ComponentsController.cs +++ b/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/ComponentsController.cs @@ -26,12 +26,13 @@ namespace Dnn.PersonaBar.UI.Services using DotNetNuke.Web.Api.Internal; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// Services used for common components. [MenuPermission(Scope = ServiceScope.Regular)] public class ComponentsController : PersonaBarApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(ComponentsController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly RoleProvider roleProvider; /// Initializes a new instance of the class. diff --git a/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/MenuExtensionsController.cs b/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/MenuExtensionsController.cs index 2b98a4c0608..a0faac2e80d 100644 --- a/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/MenuExtensionsController.cs +++ b/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/MenuExtensionsController.cs @@ -22,12 +22,13 @@ namespace Dnn.PersonaBar.UI.Services using DotNetNuke.Services.Exceptions; using Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Logging; /// An API controller for the menu of the Persona Bar. [MenuPermission(Scope = ServiceScope.Regular)] public class MenuExtensionsController : PersonaBarApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(MenuExtensionsController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IServiceProvider serviceProvider; /// Initializes a new instance of the class. diff --git a/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/PortalsController.cs b/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/PortalsController.cs index deabc073eb7..51c5f30e819 100644 --- a/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/PortalsController.cs +++ b/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/PortalsController.cs @@ -18,11 +18,13 @@ namespace Dnn.PersonaBar.UI.Services using DotNetNuke.Instrumentation; using DotNetNuke.Services.Localization; + using Microsoft.Extensions.Logging; + /// Service to perform portal operations. [MenuPermission(Scope = ServiceScope.Regular)] public class PortalsController : PersonaBarApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(PortalsController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// GET: api/Portals/GetPortals /// Gets portals. diff --git a/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/TabsController.cs b/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/TabsController.cs index ee3afb7ecb2..18ac562f2ef 100644 --- a/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/TabsController.cs +++ b/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/TabsController.cs @@ -19,11 +19,13 @@ namespace Dnn.PersonaBar.UI.Services using DotNetNuke.Instrumentation; using DotNetNuke.Services.Localization; + using Microsoft.Extensions.Logging; + /// A Persona Bar API controller for pages. [MenuPermission(Scope = ServiceScope.Regular)] public class TabsController : PersonaBarApiController { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(TabsController)); + private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly Library.Controllers.TabsController controller = new Library.Controllers.TabsController(); /// Gets the local resource file path. From 0f627b83f7865cfa809acaad7e8536d38a50b418 Mon Sep 17 00:00:00 2001 From: Brian Dukes Date: Tue, 24 Mar 2026 14:01:41 -0500 Subject: [PATCH 24/30] Add LogWrapper for API that expects ILog --- .../Extensions/TypeExtensions.cs | 14 ++- .../DotNetNuke.Instrumentation/LogWrapper.cs | 96 +++++++++++++++++++ 2 files changed, 107 insertions(+), 3 deletions(-) create mode 100644 DNN Platform/DotNetNuke.Instrumentation/LogWrapper.cs diff --git a/DNN Platform/DotNetNuke.DependencyInjection/Extensions/TypeExtensions.cs b/DNN Platform/DotNetNuke.DependencyInjection/Extensions/TypeExtensions.cs index 5a5fcc8ef20..8c003a26a0d 100644 --- a/DNN Platform/DotNetNuke.DependencyInjection/Extensions/TypeExtensions.cs +++ b/DNN Platform/DotNetNuke.DependencyInjection/Extensions/TypeExtensions.cs @@ -24,14 +24,22 @@ public static partial class TypeExtensions [DnnDeprecated(9, 9, 0, "Please use the SafeGetTypes overload with the ILog parameter")] public static partial Type[] SafeGetTypes(this Assembly assembly) { - return assembly.SafeGetTypes(null); + return assembly.SafeGetTypes((ILogger)null); } /// Safely Get all Types from the assembly. If there is an error while retrieving the types it will return an empty array of . /// The assembly to retrieve all types from. - /// A optional object. This will log issues loading the types. + /// An optional object. This will log issues loading the types. /// An array of all in the given . - public static Type[] SafeGetTypes(this Assembly assembly, ILog logger) + [DnnDeprecated(10, 4, 0, "Use overload taking ILogger")] + public static partial Type[] SafeGetTypes(this Assembly assembly, ILog logger) + => assembly.SafeGetTypes(logger is null ? null : new LogWrapper(logger)); + + /// Safely Get all Types from the assembly. If there is an error while retrieving the types it will return an empty array of . + /// The assembly to retrieve all types from. + /// An optional object. This will log issues loading the types. + /// An array of all in the given . + public static Type[] SafeGetTypes(this Assembly assembly, ILogger logger) { var (types, exception) = assembly.GetTypesAndException(); if (logger is null || exception is null) diff --git a/DNN Platform/DotNetNuke.Instrumentation/LogWrapper.cs b/DNN Platform/DotNetNuke.Instrumentation/LogWrapper.cs new file mode 100644 index 00000000000..a526ffd81e7 --- /dev/null +++ b/DNN Platform/DotNetNuke.Instrumentation/LogWrapper.cs @@ -0,0 +1,96 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace DotNetNuke.Instrumentation +{ + using System; + + using DotNetNuke.Internal.SourceGenerators; + + using Microsoft.Extensions.Logging; + + /// A wrapper to convert an instance to an instance. + /// An implementation. + [DnnDeprecated(10, 4, 0, "Use Microsoft.Extensions.Logging.ILogger")] + public partial class LogWrapper(ILog log) : ILogger + { + private static readonly IDisposable ScopeInstance = new Scope(); + private readonly ILog log = log; + + /// + public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter) + { + if (formatter == null) + { + throw new ArgumentNullException(nameof(formatter)); + } + + switch (logLevel) + { + case LogLevel.Trace: + LogWithLevel(this.log.Trace, eventId, state, exception, formatter); + return; + case LogLevel.Debug: + LogWithLevel(this.log.Debug, eventId, state, exception, formatter); + return; + case LogLevel.Information: + LogWithLevel(this.log.Info, eventId, state, exception, formatter); + return; + case LogLevel.Warning: + LogWithLevel(this.log.Warn, eventId, state, exception, formatter); + return; + case LogLevel.Error: + LogWithLevel(this.log.Error, eventId, state, exception, formatter); + return; + case LogLevel.Critical: + LogWithLevel(this.log.Fatal, eventId, state, exception, formatter); + return; + case LogLevel.None: + return; + default: + throw new ArgumentOutOfRangeException(nameof(logLevel), logLevel, FormattableString.Invariant($"Unexpected log level: {logLevel}")); + } + + static void LogWithLevel( + Action logException, + EventId eventId, + TState state, + Exception exception, + Func formatter) + { + logException($"[{eventId}] {formatter(state, exception)}", exception); + } + } + + /// + public bool IsEnabled(LogLevel logLevel) + { + return logLevel switch + { + LogLevel.Trace => this.log.IsTraceEnabled, + LogLevel.Debug => this.log.IsDebugEnabled, + LogLevel.Information => this.log.IsInfoEnabled, + LogLevel.Warning => this.log.IsWarnEnabled, + LogLevel.Error => this.log.IsErrorEnabled, + LogLevel.Critical => this.log.IsFatalEnabled, + _ => false, + }; + } + + /// + public IDisposable BeginScope(TState state) + where TState : notnull + { + return ScopeInstance; + } + + private sealed class Scope : IDisposable + { + /// + public void Dispose() + { + } + } + } +} From dd914202c57244bbd7bc142108be5f26bb4a93fd Mon Sep 17 00:00:00 2001 From: Brian Dukes Date: Tue, 24 Mar 2026 14:06:49 -0500 Subject: [PATCH 25/30] Mark old logging interfaces as deprecated --- DNN Platform/DotNetNuke.Instrumentation/ILog.cs | 5 ++++- DNN Platform/DotNetNuke.Instrumentation/ILoggerSource.cs | 5 ++++- DNN Platform/DotNetNuke.Instrumentation/LoggerSource.cs | 5 ++++- DNN Platform/DotNetNuke.Instrumentation/LoggerSourceImpl.cs | 3 +++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/DNN Platform/DotNetNuke.Instrumentation/ILog.cs b/DNN Platform/DotNetNuke.Instrumentation/ILog.cs index f7fc6363f8b..2175f63a478 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/ILog.cs +++ b/DNN Platform/DotNetNuke.Instrumentation/ILog.cs @@ -6,8 +6,11 @@ namespace DotNetNuke.Instrumentation using System; using System.Diagnostics.CodeAnalysis; + using DotNetNuke.Internal.SourceGenerators; + /// A contract specifying the ability to log information. - public interface ILog + [DnnDeprecated(10, 4, 0, "Use Microsoft.Extensions.Logging.ILogger")] + public partial interface ILog { /// Gets a value indicating whether the Debug log level is enabled. bool IsDebugEnabled { get; } diff --git a/DNN Platform/DotNetNuke.Instrumentation/ILoggerSource.cs b/DNN Platform/DotNetNuke.Instrumentation/ILoggerSource.cs index e4118b5afe6..7ccfb0f0cbd 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/ILoggerSource.cs +++ b/DNN Platform/DotNetNuke.Instrumentation/ILoggerSource.cs @@ -5,8 +5,11 @@ namespace DotNetNuke.Instrumentation { using System; + using DotNetNuke.Internal.SourceGenerators; + /// A contract specifying the ability to provide instances. - public interface ILoggerSource + [DnnDeprecated(10, 4, 0, "Use Microsoft.Extensions.Logging.ILogger")] + public partial interface ILoggerSource { /// Gets the logger for the given . /// The type providing the name for the logger instance. diff --git a/DNN Platform/DotNetNuke.Instrumentation/LoggerSource.cs b/DNN Platform/DotNetNuke.Instrumentation/LoggerSource.cs index f5081075acd..bac7d92333b 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/LoggerSource.cs +++ b/DNN Platform/DotNetNuke.Instrumentation/LoggerSource.cs @@ -4,8 +4,11 @@ namespace DotNetNuke.Instrumentation { + using DotNetNuke.Internal.SourceGenerators; + /// Provides access to an instance. - public static class LoggerSource + [DnnDeprecated(10, 4, 0, "Use Microsoft.Extensions.Logging.ILogger")] + public static partial class LoggerSource { /// Gets the instance. public static ILoggerSource Instance { get; private set; } = new LoggerSourceImpl(); diff --git a/DNN Platform/DotNetNuke.Instrumentation/LoggerSourceImpl.cs b/DNN Platform/DotNetNuke.Instrumentation/LoggerSourceImpl.cs index 71a3b36bc1e..ac4914c20b0 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/LoggerSourceImpl.cs +++ b/DNN Platform/DotNetNuke.Instrumentation/LoggerSourceImpl.cs @@ -8,10 +8,13 @@ namespace DotNetNuke.Instrumentation using System.Diagnostics.CodeAnalysis; using System.Globalization; + using DotNetNuke.Internal.SourceGenerators; + using Serilog; /// An implementation. [SuppressMessage("Microsoft.Design", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix", Justification = "Breaking change")] + [DnnDeprecated(10, 4, 0, "Use Microsoft.Extensions.Logging.ILogger")] public partial class LoggerSourceImpl : ILoggerSource { /// From d3dc37ce93634a552e4ee2194836765d1f48fe0a Mon Sep 17 00:00:00 2001 From: Peter Donker Date: Fri, 27 Mar 2026 11:24:17 +0100 Subject: [PATCH 26/30] Add a DNN Enricher to add portal and user ids --- .../DotNetNuke.Instrumentation/DnnEnricher.cs | 51 +++++++++++++++++++ .../SerilogController.cs | 2 + 2 files changed, 53 insertions(+) create mode 100644 DNN Platform/DotNetNuke.Instrumentation/DnnEnricher.cs diff --git a/DNN Platform/DotNetNuke.Instrumentation/DnnEnricher.cs b/DNN Platform/DotNetNuke.Instrumentation/DnnEnricher.cs new file mode 100644 index 00000000000..c947d7f5a55 --- /dev/null +++ b/DNN Platform/DotNetNuke.Instrumentation/DnnEnricher.cs @@ -0,0 +1,51 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace DotNetNuke.Instrumentation; + +using System.Web; + +using DotNetNuke.Abstractions.Portals; +using DotNetNuke.Abstractions.Users; +using Serilog.Core; +using Serilog.Events; + +/// +/// A Serilog log event enricher that adds DNN-specific properties to log events. +/// +public class DnnEnricher : ILogEventEnricher +{ + /// + /// Enriches the log event with DNN-specific properties including UserId and PortalId. + /// + /// The log event to enrich. + /// The factory used to create log event properties. + public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory) + { + var portalId = -1; + if (HttpContext.Current != null) + { + object contextObject = HttpContext.Current.Items["PortalSettings"]; + if (contextObject != null) + { + var portalSettings = (IPortalSettings)contextObject; + portalId = portalSettings.PortalId; + } + } + + var userId = -1; + if (HttpContext.Current != null) + { + object contextObject = HttpContext.Current.Items["UserInfo"]; + if (contextObject != null) + { + var userInfo = (IUserInfo)contextObject; + userId = userInfo.UserID; + } + } + + logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty("UserId", userId)); + logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty("PortalId", portalId)); + } +} diff --git a/DNN Platform/DotNetNuke.Instrumentation/SerilogController.cs b/DNN Platform/DotNetNuke.Instrumentation/SerilogController.cs index eb6265c143d..cf0eb168019 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/SerilogController.cs +++ b/DNN Platform/DotNetNuke.Instrumentation/SerilogController.cs @@ -35,6 +35,7 @@ internal static void AddSerilog(string applicationMapPath) if (File.Exists(configFile)) { config = new LoggerConfiguration() + .Enrich.With(new DnnEnricher()) .ReadFrom.Configuration(new ConfigurationBuilder() .AddJsonFile(configFile, optional: false, reloadOnChange: true) .Build()); @@ -42,6 +43,7 @@ internal static void AddSerilog(string applicationMapPath) else { config = new LoggerConfiguration() + .Enrich.With(new DnnEnricher()) .WriteTo.File( Path.Combine(applicationMapPath, "Portals\\_default\\Logs\\log.resources"), outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] [{SourceContext}] {Message:lj}{NewLine}{Exception}", From 1be27dbfd69ccbb6622274f02c9235ec20c96b1f Mon Sep 17 00:00:00 2001 From: Peter Donker Date: Fri, 27 Mar 2026 14:19:40 +0100 Subject: [PATCH 27/30] Different approach to log enriching which should allow us more flexibility in the future --- .../DotNetNuke.Instrumentation/DnnEnricher.cs | 51 ------------------- .../DnnLoggingController.cs | 13 +++++ .../SerilogController.cs | 4 +- .../Api/Internal/DnnContextMessageHandler.cs | 3 ++ .../Membership/MembershipModule.cs | 1 + 5 files changed, 19 insertions(+), 53 deletions(-) delete mode 100644 DNN Platform/DotNetNuke.Instrumentation/DnnEnricher.cs diff --git a/DNN Platform/DotNetNuke.Instrumentation/DnnEnricher.cs b/DNN Platform/DotNetNuke.Instrumentation/DnnEnricher.cs deleted file mode 100644 index c947d7f5a55..00000000000 --- a/DNN Platform/DotNetNuke.Instrumentation/DnnEnricher.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information - -namespace DotNetNuke.Instrumentation; - -using System.Web; - -using DotNetNuke.Abstractions.Portals; -using DotNetNuke.Abstractions.Users; -using Serilog.Core; -using Serilog.Events; - -/// -/// A Serilog log event enricher that adds DNN-specific properties to log events. -/// -public class DnnEnricher : ILogEventEnricher -{ - /// - /// Enriches the log event with DNN-specific properties including UserId and PortalId. - /// - /// The log event to enrich. - /// The factory used to create log event properties. - public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory) - { - var portalId = -1; - if (HttpContext.Current != null) - { - object contextObject = HttpContext.Current.Items["PortalSettings"]; - if (contextObject != null) - { - var portalSettings = (IPortalSettings)contextObject; - portalId = portalSettings.PortalId; - } - } - - var userId = -1; - if (HttpContext.Current != null) - { - object contextObject = HttpContext.Current.Items["UserInfo"]; - if (contextObject != null) - { - var userInfo = (IUserInfo)contextObject; - userId = userInfo.UserID; - } - } - - logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty("UserId", userId)); - logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty("PortalId", portalId)); - } -} diff --git a/DNN Platform/DotNetNuke.Instrumentation/DnnLoggingController.cs b/DNN Platform/DotNetNuke.Instrumentation/DnnLoggingController.cs index 8c76c940c79..678dff4a602 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/DnnLoggingController.cs +++ b/DNN Platform/DotNetNuke.Instrumentation/DnnLoggingController.cs @@ -69,5 +69,18 @@ public static Microsoft.Extensions.Logging.ILogger GetLogger(string categoryName return new SerilogLoggerFactory(Log.Logger).CreateLogger(categoryName); } + + /// Adds a property to the Serilog log context. + /// The property key/name to add to the log context. + /// The value to associate with the property. + /// + /// Properties added to the log context will be included in all subsequent log events + /// until the context is disposed or cleared. The property is added using Serilog's + /// method. + /// + public static void AddToLogContext(string key, object value) + { + Serilog.Context.LogContext.PushProperty(key, value); + } } } diff --git a/DNN Platform/DotNetNuke.Instrumentation/SerilogController.cs b/DNN Platform/DotNetNuke.Instrumentation/SerilogController.cs index cf0eb168019..6914dbdc747 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/SerilogController.cs +++ b/DNN Platform/DotNetNuke.Instrumentation/SerilogController.cs @@ -35,7 +35,7 @@ internal static void AddSerilog(string applicationMapPath) if (File.Exists(configFile)) { config = new LoggerConfiguration() - .Enrich.With(new DnnEnricher()) + .Enrich.FromLogContext() .ReadFrom.Configuration(new ConfigurationBuilder() .AddJsonFile(configFile, optional: false, reloadOnChange: true) .Build()); @@ -43,7 +43,7 @@ internal static void AddSerilog(string applicationMapPath) else { config = new LoggerConfiguration() - .Enrich.With(new DnnEnricher()) + .Enrich.FromLogContext() .WriteTo.File( Path.Combine(applicationMapPath, "Portals\\_default\\Logs\\log.resources"), outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] [{SourceContext}] {Message:lj}{NewLine}{Exception}", diff --git a/DNN Platform/DotNetNuke.Web/Api/Internal/DnnContextMessageHandler.cs b/DNN Platform/DotNetNuke.Web/Api/Internal/DnnContextMessageHandler.cs index d6f28b952a7..70185293199 100644 --- a/DNN Platform/DotNetNuke.Web/Api/Internal/DnnContextMessageHandler.cs +++ b/DNN Platform/DotNetNuke.Web/Api/Internal/DnnContextMessageHandler.cs @@ -16,6 +16,7 @@ namespace DotNetNuke.Web.Api.Internal using DotNetNuke.Entities.Modules; using DotNetNuke.Entities.Portals; using DotNetNuke.Entities.Tabs; + using DotNetNuke.Instrumentation; using DotNetNuke.Services.Localization; using DotNetNuke.Services.Localization.Internal; @@ -57,6 +58,8 @@ private static PortalSettings SetupPortalSettings(HttpRequestMessage request) var portalSettings = new PortalSettings(tabId, alias); request.GetHttpContext().Items["PortalSettings"] = portalSettings; + DnnLoggingController.AddToLogContext("PortalId", portalSettings.PortalId); + DnnLoggingController.AddToLogContext("TabId", portalSettings.ActiveTab.TabID); return portalSettings; #pragma warning restore CS0618 // Type or member is obsolete } diff --git a/DNN Platform/HttpModules/Membership/MembershipModule.cs b/DNN Platform/HttpModules/Membership/MembershipModule.cs index e20ccd63f2a..c00fcb97790 100644 --- a/DNN Platform/HttpModules/Membership/MembershipModule.cs +++ b/DNN Platform/HttpModules/Membership/MembershipModule.cs @@ -193,6 +193,7 @@ public static void AuthenticateRequest(IHostSettingsService hostSettingsService, else { context.Items.Add("UserInfo", user); + DnnLoggingController.AddToLogContext("UserId", user.UserID); } // Localization.SetLanguage also updates the user profile, so this needs to go after the profile is loaded From 4ec91b365db7a8926060f35a044071280e0fe3c0 Mon Sep 17 00:00:00 2001 From: Peter Donker Date: Fri, 27 Mar 2026 23:54:25 +0100 Subject: [PATCH 28/30] That didn't work as well. Rolling back to an enricher again. --- .../DotNetNuke.Instrumentation/DnnEnricher.cs | 51 +++++++++++++++++++ .../SerilogController.cs | 2 + .../Api/Internal/DnnContextMessageHandler.cs | 3 -- .../Membership/MembershipModule.cs | 1 - 4 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 DNN Platform/DotNetNuke.Instrumentation/DnnEnricher.cs diff --git a/DNN Platform/DotNetNuke.Instrumentation/DnnEnricher.cs b/DNN Platform/DotNetNuke.Instrumentation/DnnEnricher.cs new file mode 100644 index 00000000000..c947d7f5a55 --- /dev/null +++ b/DNN Platform/DotNetNuke.Instrumentation/DnnEnricher.cs @@ -0,0 +1,51 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace DotNetNuke.Instrumentation; + +using System.Web; + +using DotNetNuke.Abstractions.Portals; +using DotNetNuke.Abstractions.Users; +using Serilog.Core; +using Serilog.Events; + +/// +/// A Serilog log event enricher that adds DNN-specific properties to log events. +/// +public class DnnEnricher : ILogEventEnricher +{ + /// + /// Enriches the log event with DNN-specific properties including UserId and PortalId. + /// + /// The log event to enrich. + /// The factory used to create log event properties. + public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory) + { + var portalId = -1; + if (HttpContext.Current != null) + { + object contextObject = HttpContext.Current.Items["PortalSettings"]; + if (contextObject != null) + { + var portalSettings = (IPortalSettings)contextObject; + portalId = portalSettings.PortalId; + } + } + + var userId = -1; + if (HttpContext.Current != null) + { + object contextObject = HttpContext.Current.Items["UserInfo"]; + if (contextObject != null) + { + var userInfo = (IUserInfo)contextObject; + userId = userInfo.UserID; + } + } + + logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty("UserId", userId)); + logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty("PortalId", portalId)); + } +} diff --git a/DNN Platform/DotNetNuke.Instrumentation/SerilogController.cs b/DNN Platform/DotNetNuke.Instrumentation/SerilogController.cs index 6914dbdc747..8207052acf1 100644 --- a/DNN Platform/DotNetNuke.Instrumentation/SerilogController.cs +++ b/DNN Platform/DotNetNuke.Instrumentation/SerilogController.cs @@ -36,6 +36,7 @@ internal static void AddSerilog(string applicationMapPath) { config = new LoggerConfiguration() .Enrich.FromLogContext() + .Enrich.With(new DnnEnricher()) .ReadFrom.Configuration(new ConfigurationBuilder() .AddJsonFile(configFile, optional: false, reloadOnChange: true) .Build()); @@ -44,6 +45,7 @@ internal static void AddSerilog(string applicationMapPath) { config = new LoggerConfiguration() .Enrich.FromLogContext() + .Enrich.With(new DnnEnricher()) .WriteTo.File( Path.Combine(applicationMapPath, "Portals\\_default\\Logs\\log.resources"), outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] [{SourceContext}] {Message:lj}{NewLine}{Exception}", diff --git a/DNN Platform/DotNetNuke.Web/Api/Internal/DnnContextMessageHandler.cs b/DNN Platform/DotNetNuke.Web/Api/Internal/DnnContextMessageHandler.cs index 70185293199..d6f28b952a7 100644 --- a/DNN Platform/DotNetNuke.Web/Api/Internal/DnnContextMessageHandler.cs +++ b/DNN Platform/DotNetNuke.Web/Api/Internal/DnnContextMessageHandler.cs @@ -16,7 +16,6 @@ namespace DotNetNuke.Web.Api.Internal using DotNetNuke.Entities.Modules; using DotNetNuke.Entities.Portals; using DotNetNuke.Entities.Tabs; - using DotNetNuke.Instrumentation; using DotNetNuke.Services.Localization; using DotNetNuke.Services.Localization.Internal; @@ -58,8 +57,6 @@ private static PortalSettings SetupPortalSettings(HttpRequestMessage request) var portalSettings = new PortalSettings(tabId, alias); request.GetHttpContext().Items["PortalSettings"] = portalSettings; - DnnLoggingController.AddToLogContext("PortalId", portalSettings.PortalId); - DnnLoggingController.AddToLogContext("TabId", portalSettings.ActiveTab.TabID); return portalSettings; #pragma warning restore CS0618 // Type or member is obsolete } diff --git a/DNN Platform/HttpModules/Membership/MembershipModule.cs b/DNN Platform/HttpModules/Membership/MembershipModule.cs index c00fcb97790..e20ccd63f2a 100644 --- a/DNN Platform/HttpModules/Membership/MembershipModule.cs +++ b/DNN Platform/HttpModules/Membership/MembershipModule.cs @@ -193,7 +193,6 @@ public static void AuthenticateRequest(IHostSettingsService hostSettingsService, else { context.Items.Add("UserInfo", user); - DnnLoggingController.AddToLogContext("UserId", user.UserID); } // Localization.SetLanguage also updates the user profile, so this needs to go after the profile is loaded From 1bd71c7ddb0db941813900704e688badf2c31aad Mon Sep 17 00:00:00 2001 From: Brian Dukes Date: Sat, 4 Apr 2026 16:52:38 -0500 Subject: [PATCH 29/30] Use LoggerMessage for logging statements (#130) * Replace usages of IsDebugEnabled * Replace usages of Debug(Exception) * Replace remaining usages of Debug * Replace usages of IsInfoEnabled * Replace usages of InfoFormat(IFormatProvider, string, object[]) * Replace usages of Info(object) * Replace remaining usages of Info * Replace usages of IsTraceEnabled * Replace usages of TraceFormat(IFormatProvider, string, object[]) * Replace remaining usages of Trace * Replace usages of IsWarnEnabled * Replace usages of Warn(object) * Replace usages of WarnFormat(IFormatProvider, string, object[]) * Replace usages of Warn(string, Exception) * Replace remaining usages of Warn * Replace usages of ErrorFormat(IFormatProvider, string, object[]) * Replace usages of Error(object) * Replace usages of Error(string, Exception) * Replace remaining usages of Error * Replace usages of Fatal * Remove LoggingMigrationExtensions * Use explicit form of LoggerMessage attribute For consistency between messages with and without an explicit message * Organize LoggerMessage event IDs in DotNetNuke.dll * Organize LoggerMessage event IDs by project --- .../Dnn.Modules.Console.csproj | 1 + .../Dnn.Modules.Console/LoggerMessages.cs | 21 + .../Dnn.Modules.Console/Settings.ascx.cs | 2 +- .../Dnn.Modules.Console/ViewConsole.ascx.cs | 2 +- .../Extensions/TypeExtensions.cs | 12 +- .../LoggerMessages.cs | 24 + .../LoggingMigrationExtensions.cs | 149 -- .../DotNetNuke.Maintenance/LoggerMessages.cs | 20 + .../Telerik/Removal/Steps/StepBase.cs | 2 +- .../Telerik/TelerikUtils.cs | 2 +- .../LoggerMessages.cs | 23 + .../ModuleControlPipeline.cs | 53 +- .../ClientResourceController.cs | 10 +- .../LoggerMessages.cs | 28 + .../ClientResourceManager.cs | 37 +- .../ClientResourceSettings.cs | 10 +- .../DependencyInjection.cs | 2 +- .../DotNetNuke.Web.Client/LoggerMessages.cs | 47 + .../DotNetNuke.Web.Mvc/LoggerMessages.cs | 29 + .../Routing/MvcRoutingManager.cs | 11 +- .../StandardTabAndModuleInfoProvider.cs | 7 +- .../Api/Auth/ApiTokenAuthMessageHandler.cs | 13 +- .../Api/Auth/ApiTokens/ApiTokenController.cs | 26 +- .../Api/Auth/AuthMessageHandlerBase.cs | 11 +- .../Api/Internal/ServicesRoutingManager.cs | 26 +- .../Api/StandardTabAndModuleInfoProvider.cs | 5 +- .../DotNetNuke.Web/Api/TraceWriter.cs | 39 +- .../Common/DotNetNukeHttpApplication.cs | 28 +- .../Common/DotNetNukeShutdownOverload.cs | 46 +- .../DependencyInjection/BuildUpExtensions.cs | 3 +- .../DependencyInjectionInitialize.cs | 7 +- .../InternalServices/ControlBarController.cs | 10 +- .../EventLogServiceController.cs | 2 +- .../InternalServices/FileUploadController.cs | 6 +- .../ItemListServiceController.cs | 2 +- .../MessagingServiceController.cs | 6 +- .../ModuleServiceController.cs | 4 +- .../NotificationsServiceController.cs | 2 +- .../RelationshipServiceController.cs | 6 +- .../InternalServices/UserFileController.cs | 2 +- DNN Platform/DotNetNuke.Web/LoggerMessages.cs | 224 +++ .../DotNetNuke.Web/UI/RibbonBarManager.cs | 2 +- .../UI/WebControls/DnnFilePicker.cs | 4 +- .../PropertyEditorControls/DateEditControl.cs | 4 +- .../DateTimeEditControl.cs | 4 +- .../HttpModules/Analytics/AnalyticsModule.cs | 4 +- .../Config/AnalyticsEngineConfiguration.cs | 2 +- .../HttpModules/Exception/ExceptionModule.cs | 4 +- DNN Platform/HttpModules/LoggerMessages.cs | 40 + .../Membership/MembershipModule.cs | 2 +- .../UrlRewrite/BasicUrlRewriter.cs | 53 +- .../Application/ApplicationStatusInfo.cs | 14 +- .../Collections/CollectionExtensions.cs | 2 +- DNN Platform/Library/Common/Globals.cs | 20 +- DNN Platform/Library/Common/Initialize.cs | 28 +- .../Common/Internal/EventHandlersContainer.cs | 2 +- .../Common/Internal/ServicesRoutingManager.cs | 2 +- .../Common/Lists/ListInfoCollection.cs | 8 +- .../Library/Common/Utilities/Config.cs | 14 +- .../Library/Common/Utilities/DataCache.cs | 2 +- .../Utilities/FileSystemPermissionVerifier.cs | 8 +- .../Common/Utilities/FileSystemUtils.cs | 75 +- .../Common/Utilities/RetryableAction.cs | 14 +- .../ComponentModel/ComponentFactory.cs | 2 +- .../ContainerWithServiceProviderFallback.cs | 6 +- .../ComponentModel/ProviderInstaller.cs | 2 +- DNN Platform/Library/Data/DataProvider.cs | 6 +- .../Library/Data/PetaPoco/PetaPocoHelper.cs | 14 +- DNN Platform/Library/Data/SqlDataProvider.cs | 23 +- .../Entities/Content/AttachmentController.cs | 2 +- .../Entities/Controllers/HostController.cs | 2 +- .../Library/Entities/Host/ServerController.cs | 24 +- .../Library/Entities/Icons/IconController.cs | 2 +- .../Modules/DesktopModuleController.cs | 8 +- .../Entities/Modules/EventMessageProcessor.cs | 2 +- .../Entities/Modules/ModuleController.cs | 11 +- .../Library/Entities/Modules/ModuleInfo.cs | 2 +- .../Entities/Modules/PortalModuleBase.cs | 27 +- .../Entities/Modules/Prompt/AddModule.cs | 2 +- .../Entities/Portals/PortalController.cs | 50 +- .../Entities/Portals/PortalGroupController.cs | 2 +- .../Templates/PortalTemplateImporter.cs | 8 +- .../Portals/Templates/PortalTemplateInfo.cs | 14 +- .../Entities/Profile/ProfileController.cs | 8 +- .../Library/Entities/Tabs/TabController.cs | 10 +- .../Entities/Tabs/TabPublishingController.cs | 2 +- .../Tabs/TabVersions/TabVersionBuilder.cs | 4 +- .../Entities/Tabs/TabWorkflowTracker.cs | 4 +- .../Urls/Config/RewriterConfiguration.cs | 2 +- .../Library/Entities/Urls/UrlRewriterUtils.cs | 4 +- .../Entities/Users/Profile/UserProfile.cs | 2 +- .../Users Online/UserOnlineController.cs | 2 +- DNN Platform/Library/Framework/PageBase.cs | 9 +- DNN Platform/Library/Framework/Reflection.cs | 6 +- DNN Platform/Library/LoggerMessages.cs | 1602 +++++++++++++++++ .../Membership/AspNetMembershipProvider.cs | 2 +- .../Library/Security/Roles/DNNRoleProvider.cs | 2 +- .../Library/Security/Roles/RoleController.cs | 2 +- .../Config/AnalyticsConfiguration.cs | 11 +- .../Analytics/GoogleAnalyticsController.cs | 2 +- .../Authentication/AuthenticationConfig.cs | 2 +- .../AuthenticationController.cs | 2 +- .../Authentication/OAuth/OAuthClientBase.cs | 2 +- .../Library/Services/Cache/CachingProvider.cs | 4 +- .../Services/Cache/FBCachingProvider.cs | 2 +- .../Exceptions/BasePortalException.cs | 10 +- .../Library/Services/Exceptions/Exceptions.cs | 27 +- .../Services/Exceptions/SecurityException.cs | 2 +- .../Services/FileSystem/FileManager.cs | 36 +- .../Services/FileSystem/FileServerHandler.cs | 2 +- .../Services/FileSystem/FolderManager.cs | 20 +- .../FolderMappingsConfigController.cs | 4 +- .../Internal/FileDeletionController.cs | 2 +- .../Internal/FileSecurityController.cs | 2 +- .../Providers/StandardFolderProvider.cs | 8 +- .../Library/Services/Installer/Installer.cs | 10 +- .../Installer/Installers/CleanupInstaller.cs | 6 +- .../Installers/ResourceFileInstaller.cs | 2 +- .../Library/Services/Installer/Log/Logger.cs | 12 +- .../Installer/Writers/ModulePackageWriter.cs | 2 +- .../Services/Localization/Localization.cs | 2 +- .../Localization/LocalizationProvider.cs | 5 +- .../Log/EventLog/DBLoggingProvider.cs | 6 +- .../Services/Log/EventLog/LogController.cs | 16 +- .../Services/Mail/SendTokenizedBulkEmail.cs | 6 +- .../Services/ModuleCache/PurgeModuleCache.cs | 10 +- .../Services/OutputCache/PurgeOutputCache.cs | 10 +- .../Services/Scheduling/ProcessGroup.cs | 8 +- .../Scheduling/ScheduleHistoryItem.cs | 15 +- .../Library/Services/Scheduling/Scheduler.cs | 33 +- .../Controllers/ModuleResultController.cs | 2 +- .../Internals/InternalSearchControllerImpl.cs | 2 +- .../Search/Internals/LuceneControllerImpl.cs | 22 +- .../Library/Services/Search/ModuleIndexer.cs | 17 +- .../Library/Services/Search/SearchEngine.cs | 4 +- .../Services/Search/SearchEngineScheduler.cs | 4 +- .../Library/Services/Search/TabIndexer.cs | 8 +- .../Services/Sitemap/CoreSitemapProvider.cs | 4 +- .../Services/SystemHealth/WebServerMonitor.cs | 33 +- .../Upgrade/Internals/Steps/AddFcnModeStep.cs | 4 +- .../Steps/FilePermissionCheckStep.cs | 6 +- .../Internals/Steps/InstallExtensionsStep.cs | 2 +- .../Internals/Steps/InstallVersionStep.cs | 8 +- .../Internals/Steps/UpdateLanguagePackStep.cs | 2 +- .../Library/Services/Upgrade/Upgrade.cs | 69 +- .../UserProfile/UserProfilePageHandler.cs | 13 +- .../Library/UI/Containers/Container.cs | 22 +- .../UI/Modules/ModuleControlFactory.cs | 52 +- DNN Platform/Library/UI/Modules/ModuleHost.cs | 15 +- .../Library/UI/Skins/SkinController.cs | 2 +- .../Library/UI/Skins/SkinFileProcessor.cs | 9 +- .../Library/UI/Skins/SkinThumbNailControl.cs | 2 +- .../Library/UI/WebControls/CaptchaControl.cs | 8 +- .../DNN Edit Controls/DNNListEditControl.cs | 4 +- .../Edit Controls/DateEditControl.cs | 4 +- .../Edit Controls/IntegerEditControl.cs | 4 +- .../Edit Controls/TrueFalseEditControl.cs | 6 +- .../WebControls/PropertyEditor/SettingInfo.cs | 4 +- .../CoreMessagingBusinessController.cs | 2 +- .../DotNetNuke.Modules.CoreMessaging.csproj | 1 + .../Modules/CoreMessaging/LoggerMessages.cs | 69 + .../Services/FileUploadController.cs | 2 +- .../Services/MessagingServiceController.cs | 82 +- .../Components/Controllers/BaseController.cs | 3 +- .../Components/Engines/ExportImportEngine.cs | 6 +- .../Scheduler/ExportImportScheduler.cs | 4 +- .../Services/PackagesExportService.cs | 4 +- .../Components/Services/PagesExportService.cs | 27 +- .../Services/ThemesExportService.cs | 2 +- .../Modules/DnnExportImport/LoggerMessages.cs | 55 + .../Groups/DotNetNuke.Modules.Groups.csproj | 1 + DNN Platform/Modules/Groups/LoggerMessages.cs | 33 + .../Groups/ModerationServiceController.cs | 12 +- .../Journal/DotNetNuke.Modules.Journal.csproj | 1 + .../Modules/Journal/FileUploadController.cs | 2 +- .../Modules/Journal/LoggerMessages.cs | 48 + .../Journal/NotificationServicesController.cs | 17 +- .../Modules/Journal/ServicesController.cs | 18 +- .../DotNetNuke.Modules.MemberDirectory.csproj | 1 + .../Modules/MemberDirectory/LoggerMessages.cs | 42 + .../Services/MemberDirectoryController.cs | 18 +- .../Modules/RazorHost/CreateModule.ascx.cs | 4 +- .../DotNetNuke.Modules.RazorHost.csproj | 1 + .../Modules/RazorHost/LoggerMessages.cs | 18 + .../Components/ResourceManagerController.cs | 10 +- .../Dnn.Modules.ResourceManager.csproj | 1 + .../Modules/ResourceManager/LoggerMessages.cs | 27 + .../AspNetClientCapability.cs | 2 +- .../Provider.AspNetCCP/LoggerMessages.cs | 17 + .../AzureFolderProvider/Settings.ascx.cs | 12 +- ...otNetNuke.Providers.FolderProviders.csproj | 1 + .../FolderProviders/LoggerMessages.cs | 33 + DNN Platform/Syndication/LoggerMessages.cs | 32 + DNN Platform/Syndication/OPML/Opml.cs | 8 +- .../Syndication/OPML/OpmlDownloadManager.cs | 2 +- .../Syndication/RSS/RssDownloadManager.cs | 2 +- DNN Platform/Website/Default.aspx.cs | 4 +- .../Admin/Authentication/Login.ascx.cs | 4 +- .../Admin/Security/EditUser.ascx.cs | 4 +- .../Admin/Security/Password.ascx.cs | 17 +- .../Admin/Security/SecurityRoles.ascx.cs | 11 +- .../Admin/Security/User.ascx.cs | 3 +- .../AuthenticationServices/DNN/Login.ascx.cs | 6 +- .../Website/DotNetNuke.Website.csproj | 1 + DNN Platform/Website/Install/Install.aspx.cs | 10 +- .../Website/Install/InstallWizard.aspx.cs | 3 +- .../Website/Install/UpgradeWizard.aspx.cs | 4 +- DNN Platform/Website/LoggerMessages.cs | 86 + .../admin/Modules/Modulesettings.ascx.cs | 3 +- .../admin/Sales/PayPalSubscription.aspx.cs | 3 +- .../Website/admin/Skins/Toast.ascx.cs | 4 +- .../ConfigConsole/ConfigConsoleController.cs | 8 +- .../Editors/AuthSystemPackageEditor.cs | 2 +- .../Editors/CoreLanguagePackageEditor.cs | 2 +- .../Editors/ExtensionLanguagePackageEditor.cs | 2 +- .../Editors/JsLibraryPackageEditor.cs | 5 +- .../Extensions/Editors/ModulePackageEditor.cs | 2 +- .../Editors/SkinObjectPackageEditor.cs | 2 +- .../Extensions/Editors/SkinPackageEditor.cs | 5 +- .../Extensions/InstallController.cs | 6 +- .../Application/RestartApplication.cs | 2 +- .../Prompt/Commands/Commands/ListCommands.cs | 2 +- .../Prompt/Commands/Host/ClearCache.cs | 2 +- .../Prompt/Commands/Portal/ClearLog.cs | 2 +- .../Components/Prompt/ModulesController.cs | 4 +- .../Recyclebin/RecyclebinController.cs | 4 +- .../Roles/Prompt/Commands/DeleteRole.cs | 5 +- .../Roles/Prompt/Commands/ListRoles.cs | 2 +- .../Roles/Prompt/Commands/NewRole.cs | 2 +- .../Roles/Prompt/Commands/SetRole.cs | 4 +- .../Components/Security/Checks/BaseCheck.cs | 2 +- .../SiteSettings/LanguagesControllerTasks.cs | 4 +- .../Components/Sites/SitesController.cs | 6 +- .../TaskScheduler/Prompt/Commands/GetTask.cs | 2 +- .../TaskScheduler/Prompt/Commands/SetTask.cs | 2 +- .../TaskScheduler/TaskSchedulerController.cs | 2 +- .../Components/Themes/ThemesController.cs | 4 +- .../Components/Users/UsersController.cs | 6 +- .../LoggerMessages.cs | 1235 +++++++++++++ .../Services/AdminLogsController.cs | 50 +- .../Services/CommandController.cs | 8 +- .../Services/ConfigConsoleController.cs | 10 +- .../Services/ConnectorsController.cs | 10 +- .../Services/CssEditorController.cs | 174 +- .../Services/ExtensionsController.cs | 56 +- .../Services/LanguagesController.cs | 30 +- .../Services/LicensingController.cs | 2 +- .../Services/PagesController.cs | 55 +- .../Services/RolesController.cs | 22 +- .../Services/SecurityController.cs | 90 +- .../Services/SeoController.cs | 28 +- .../Services/ServerController.cs | 4 +- .../Services/ServerSettingsLogsController.cs | 6 +- .../ServerSettingsPerformanceController.cs | 8 +- .../ServerSettingsSmtpAdminController.cs | 8 +- .../ServerSettingsSmtpHostController.cs | 8 +- .../Services/SiteGroupsController.cs | 4 +- .../Services/SiteSettingsController.cs | 122 +- .../Services/SitesController.cs | 20 +- .../SystemInfoApplicationAdminController.cs | 4 +- .../SystemInfoApplicationHostController.cs | 4 +- .../Services/SystemInfoDatabaseController.cs | 2 +- .../Services/SystemInfoServersController.cs | 8 +- .../Services/SystemInfoWebController.cs | 2 +- .../Services/TaskSchedulerController.cs | 26 +- .../Services/ThemesController.cs | 24 +- .../Services/UpgradesController.cs | 4 +- .../Services/UsersController.cs | 93 +- .../Services/VocabulariesController.cs | 29 +- .../Controllers/EditBarController.cs | 6 +- .../EditBar/Dnn.EditBar.UI/LoggerMessages.cs | 17 + .../AppEvents/EventsController.cs | 30 +- .../Dnn.PersonaBar.Library/Common/IocUtil.cs | 14 +- .../Controllers/ModulesController.cs | 4 +- .../Controllers/PersonaBarController.cs | 8 +- .../Dnn.PersonaBar.Library/LoggerMessages.cs | 108 ++ .../Permissions/MenuPermissionController.cs | 8 +- .../Components/BusinessController.cs | 11 +- .../HttpModules/PersonaBarModule.cs | 28 +- .../Dnn.PersonaBar.UI/LoggerMessages.cs | 62 + .../Services/ComponentsController.cs | 6 +- .../Services/MenuExtensionsController.cs | 2 +- .../Services/PortalsController.cs | 2 +- .../Services/TabsController.cs | 10 +- 284 files changed, 5271 insertions(+), 1816 deletions(-) create mode 100644 DNN Platform/Admin Modules/Dnn.Modules.Console/LoggerMessages.cs create mode 100644 DNN Platform/DotNetNuke.DependencyInjection/LoggerMessages.cs delete mode 100644 DNN Platform/DotNetNuke.Instrumentation/LoggingMigrationExtensions.cs create mode 100644 DNN Platform/DotNetNuke.Maintenance/LoggerMessages.cs create mode 100644 DNN Platform/DotNetNuke.ModulePipeline/LoggerMessages.cs create mode 100644 DNN Platform/DotNetNuke.Web.Client.ResourceManager/LoggerMessages.cs create mode 100644 DNN Platform/DotNetNuke.Web.Client/LoggerMessages.cs create mode 100644 DNN Platform/DotNetNuke.Web.Mvc/LoggerMessages.cs create mode 100644 DNN Platform/DotNetNuke.Web/LoggerMessages.cs create mode 100644 DNN Platform/HttpModules/LoggerMessages.cs create mode 100644 DNN Platform/Library/LoggerMessages.cs create mode 100644 DNN Platform/Modules/CoreMessaging/LoggerMessages.cs create mode 100644 DNN Platform/Modules/DnnExportImport/LoggerMessages.cs create mode 100644 DNN Platform/Modules/Groups/LoggerMessages.cs create mode 100644 DNN Platform/Modules/Journal/LoggerMessages.cs create mode 100644 DNN Platform/Modules/MemberDirectory/LoggerMessages.cs create mode 100644 DNN Platform/Modules/RazorHost/LoggerMessages.cs create mode 100644 DNN Platform/Modules/ResourceManager/LoggerMessages.cs create mode 100644 DNN Platform/Providers/ClientCapabilityProviders/Provider.AspNetCCP/LoggerMessages.cs create mode 100644 DNN Platform/Providers/FolderProviders/LoggerMessages.cs create mode 100644 DNN Platform/Syndication/LoggerMessages.cs create mode 100644 DNN Platform/Website/LoggerMessages.cs create mode 100644 Dnn.AdminExperience/Dnn.PersonaBar.Extensions/LoggerMessages.cs create mode 100644 Dnn.AdminExperience/EditBar/Dnn.EditBar.UI/LoggerMessages.cs create mode 100644 Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/LoggerMessages.cs create mode 100644 Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/LoggerMessages.cs diff --git a/DNN Platform/Admin Modules/Dnn.Modules.Console/Dnn.Modules.Console.csproj b/DNN Platform/Admin Modules/Dnn.Modules.Console/Dnn.Modules.Console.csproj index 45d886cf63c..2aca3863772 100644 --- a/DNN Platform/Admin Modules/Dnn.Modules.Console/Dnn.Modules.Console.csproj +++ b/DNN Platform/Admin Modules/Dnn.Modules.Console/Dnn.Modules.Console.csproj @@ -73,6 +73,7 @@ + Settings.ascx diff --git a/DNN Platform/Admin Modules/Dnn.Modules.Console/LoggerMessages.cs b/DNN Platform/Admin Modules/Dnn.Modules.Console/LoggerMessages.cs new file mode 100644 index 00000000000..1c03ab2b00b --- /dev/null +++ b/DNN Platform/Admin Modules/Dnn.Modules.Console/LoggerMessages.cs @@ -0,0 +1,21 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.Console +{ + using System; + + using Microsoft.Extensions.Logging; + + /// Extension methods for for pre-defined logging messages. + /// The Dnn.Modules.Console project has been assigned event IDs from 3,500,000 to 3,599,999. + internal static partial class LoggerMessages + { + [LoggerMessage(EventId = 3_500_000, Level = LogLevel.Error)] + public static partial void SettingsParseWidthException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_500_100, Level = LogLevel.Error)] + public static partial void ViewConsoleParseConsoleModuleIdException(this ILogger logger, Exception exception); + } +} diff --git a/DNN Platform/Admin Modules/Dnn.Modules.Console/Settings.ascx.cs b/DNN Platform/Admin Modules/Dnn.Modules.Console/Settings.ascx.cs index 04c7dcbd1d4..5f6876c4389 100644 --- a/DNN Platform/Admin Modules/Dnn.Modules.Console/Settings.ascx.cs +++ b/DNN Platform/Admin Modules/Dnn.Modules.Console/Settings.ascx.cs @@ -114,7 +114,7 @@ public override void UpdateSettings() } catch (Exception exc) { - Logger.Error(exc); + Logger.SettingsParseWidthException(exc); throw new Exception("ConsoleWidth value is invalid. Value must be numeric."); } diff --git a/DNN Platform/Admin Modules/Dnn.Modules.Console/ViewConsole.ascx.cs b/DNN Platform/Admin Modules/Dnn.Modules.Console/ViewConsole.ascx.cs index 742402a8706..002375e3675 100644 --- a/DNN Platform/Admin Modules/Dnn.Modules.Console/ViewConsole.ascx.cs +++ b/DNN Platform/Admin Modules/Dnn.Modules.Console/ViewConsole.ascx.cs @@ -486,7 +486,7 @@ private void SavePersonalizedSettings() } catch (Exception exc) { - Logger.Error(exc); + Logger.ViewConsoleParseConsoleModuleIdException(exc); consoleModuleID = -1; } diff --git a/DNN Platform/DotNetNuke.DependencyInjection/Extensions/TypeExtensions.cs b/DNN Platform/DotNetNuke.DependencyInjection/Extensions/TypeExtensions.cs index 8c003a26a0d..76ae199667d 100644 --- a/DNN Platform/DotNetNuke.DependencyInjection/Extensions/TypeExtensions.cs +++ b/DNN Platform/DotNetNuke.DependencyInjection/Extensions/TypeExtensions.cs @@ -49,16 +49,12 @@ public static Type[] SafeGetTypes(this Assembly assembly, ILogger logger) if (exception is ReflectionTypeLoadException loadException) { - var messageBuilder = BuildLoaderExceptionMessage( - new StringBuilder($"Unable to get all types for {assembly.FullName}, see exception for details").AppendLine(), - assembly, - loadException); - - logger.Warn(messageBuilder.ToString(), loadException); + var messageBuilder = BuildLoaderExceptionMessage(new StringBuilder(), assembly, loadException); + logger.TypeExtensionsUnableToGetAllTypesFor(loadException, assembly.FullName, messageBuilder.ToString()); } else { - logger.Error($"Unable to get any types for {assembly.FullName}, see exception for details", exception); + logger.TypeExtensionsUnableToGetAnyTypesFor(exception, assembly.FullName); } return types.ToArray(); @@ -114,7 +110,7 @@ public static void LogOtherExceptions(this TypesResult result, ILogger logger) { var assembly = exceptionPair.Key; var exception = exceptionPair.Value; - logger.Error($"Unable to get any types for {assembly.FullName}, see exception for details", exception); + logger.TypeExtensionsOtherExceptions(exception, assembly.FullName); } } diff --git a/DNN Platform/DotNetNuke.DependencyInjection/LoggerMessages.cs b/DNN Platform/DotNetNuke.DependencyInjection/LoggerMessages.cs new file mode 100644 index 00000000000..a1a2bdd8b06 --- /dev/null +++ b/DNN Platform/DotNetNuke.DependencyInjection/LoggerMessages.cs @@ -0,0 +1,24 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace DotNetNuke.DependencyInjection; + +using System; +using System.Reflection; + +using Microsoft.Extensions.Logging; + +/// Extension methods for for pre-defined logging messages. +/// The DotNetNuke.DependencyInjection project has been assigned event IDs from 2,100,000 to 2,299,999. +internal static partial class LoggerMessages +{ + [LoggerMessage(EventId = 2_100_000, Level = LogLevel.Warning, Message = "Unable to get all types for {AssemblyFullName}, see exception for details\n{Message}")] + public static partial void TypeExtensionsUnableToGetAllTypesFor(this ILogger logger, ReflectionTypeLoadException exception, string assemblyFullName, string message); + + [LoggerMessage(EventId = 2_100_001, Level = LogLevel.Error, Message = "Unable to get any types for {AssemblyFullName}, see exception for details")] + public static partial void TypeExtensionsUnableToGetAnyTypesFor(this ILogger logger, Exception exception, string assemblyFullName); + + [LoggerMessage(EventId = 2_100_002, Level = LogLevel.Error, Message = "Unable to get any types for {AssemblyFullName}, see exception for details")] + public static partial void TypeExtensionsOtherExceptions(this ILogger logger, Exception exception, string assemblyFullName); +} diff --git a/DNN Platform/DotNetNuke.Instrumentation/LoggingMigrationExtensions.cs b/DNN Platform/DotNetNuke.Instrumentation/LoggingMigrationExtensions.cs deleted file mode 100644 index 49f03f65341..00000000000 --- a/DNN Platform/DotNetNuke.Instrumentation/LoggingMigrationExtensions.cs +++ /dev/null @@ -1,149 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information - -namespace DotNetNuke.Instrumentation -{ - using System; - - using Microsoft.Extensions.Logging; - - /// Provides extension methods to ease transition from to . - public static class LoggingMigrationExtensions - { - extension(ILogger logger) - { -#pragma warning disable CA1848 // Use the LoggerMessage delegates -#pragma warning disable CA2254 // Template should be a static expression -#pragma warning disable SA1101 // Prefix local calls with this - /// - public bool IsDebugEnabled => logger.IsEnabled(LogLevel.Debug); - - /// - public bool IsInfoEnabled => logger.IsEnabled(LogLevel.Information); - - /// - public bool IsTraceEnabled => logger.IsEnabled(LogLevel.Trace); - - /// - public bool IsWarnEnabled => logger.IsEnabled(LogLevel.Warning); - - /// - public bool IsErrorEnabled => logger.IsEnabled(LogLevel.Error); - - /// - public bool IsFatalEnabled => logger.IsEnabled(LogLevel.Critical); - - /// - public void Debug(object message) => logger.Debug(message?.ToString()); - - /// - public void Debug(string message) => logger.LogDebug(message); - - /// - public void Debug(object message, Exception exception) => logger.Debug(message?.ToString(), exception); - - /// - public void Debug(string message, Exception exception) => logger.LogDebug(exception, message); - - /// - public void DebugFormat(string format, params object[] args) => logger.LogDebug(format, args); - - /// - public void DebugFormat(IFormatProvider provider, string format, params object[] args) => logger.Debug(string.Format(provider, format, args)); - - /// - public void Info(object message) => logger.Info(message?.ToString()); - - /// - public void Info(string message) => logger.LogInformation(message); - - /// - public void Info(object message, Exception exception) => logger.Info(message?.ToString(), exception); - - /// - public void Info(string message, Exception exception) => logger.LogInformation(exception, message); - - /// - public void InfoFormat(string format, params object[] args) => logger.LogInformation(format, args); - - /// - public void InfoFormat(IFormatProvider provider, string format, params object[] args) => logger.Info(string.Format(provider, format, args)); - - /// - public void Trace(object message) => logger.Trace(message?.ToString()); - - /// - public void Trace(string message) => logger.LogTrace(message); - - /// - public void Trace(object message, Exception exception) => logger.Trace(message?.ToString(), exception); - - /// - public void Trace(string message, Exception exception) => logger.LogTrace(exception, message); - - /// - public void TraceFormat(string format, params object[] args) => logger.LogTrace(format, args); - - /// - public void TraceFormat(IFormatProvider provider, string format, params object[] args) => logger.Trace(string.Format(provider, format, args)); - - /// - public void Warn(object message) => logger.Warn(message?.ToString()); - - /// - public void Warn(string message) => logger.LogWarning(message); - - /// - public void Warn(object message, Exception exception) => logger.Warn(message?.ToString(), exception); - - /// - public void Warn(string message, Exception exception) => logger.LogWarning(exception, message); - - /// - public void WarnFormat(string format, params object[] args) => logger.LogWarning(format, args); - - /// - public void WarnFormat(IFormatProvider provider, string format, params object[] args) => logger.Warn(string.Format(provider, format, args)); - - /// - public void Error(object message) => logger.Error(message?.ToString()); - - /// - public void Error(string message) => logger.LogError(message); - - /// - public void Error(object message, Exception exception) => logger.Error(message?.ToString(), exception); - - /// - public void Error(string message, Exception exception) => logger.LogError(exception, message); - - /// - public void ErrorFormat(string format, params object[] args) => logger.LogError(format, args); - - /// - public void ErrorFormat(IFormatProvider provider, string format, params object[] args) => logger.Error(string.Format(provider, format, args)); - - /// - public void Fatal(object message) => logger.Fatal(message?.ToString()); - - /// - public void Fatal(string message) => logger.LogCritical(message); - - /// - public void Fatal(object message, Exception exception) => logger.Fatal(message?.ToString(), exception); - - /// - public void Fatal(string message, Exception exception) => logger.LogCritical(exception, message); - - /// - public void FatalFormat(string format, params object[] args) => logger.LogCritical(format, args); - - /// - public void FatalFormat(IFormatProvider provider, string format, params object[] args) => logger.Fatal(string.Format(provider, format, args)); - } - } -#pragma warning restore SA1101 // Prefix local calls with this -#pragma warning restore CA2254 // Template should be a static expression -#pragma warning restore CA1848 // Use the LoggerMessage delegates -} diff --git a/DNN Platform/DotNetNuke.Maintenance/LoggerMessages.cs b/DNN Platform/DotNetNuke.Maintenance/LoggerMessages.cs new file mode 100644 index 00000000000..f3ced6fa379 --- /dev/null +++ b/DNN Platform/DotNetNuke.Maintenance/LoggerMessages.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace DotNetNuke.Maintenance; + +using System; + +using Microsoft.Extensions.Logging; + +/// Extension methods for for pre-defined logging messages. +/// The DotNetNuke.Maintenance project has been assigned event IDs from 2,200,000 to 2,299,999. +internal static partial class LoggerMessages +{ + [LoggerMessage(EventId = 2_200_000, Level = LogLevel.Warning, Message = "Could not determine Telerik dependencies on some assemblies.")] + public static partial void TelerikUtilsCountNotDetermineTelerikDependenciesOnSomeAssemblies(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 2_200_100, Level = LogLevel.Error)] + public static partial void StepBaseExecuteException(this ILogger logger, Exception exception); +} diff --git a/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/StepBase.cs b/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/StepBase.cs index 4a673a435ae..2754bf7189a 100644 --- a/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/StepBase.cs +++ b/DNN Platform/DotNetNuke.Maintenance/Telerik/Removal/Steps/StepBase.cs @@ -52,7 +52,7 @@ public void Execute() } catch (Exception ex) { - this.Log.Error(ex); + this.Log.StepBaseExecuteException(ex); this.Success = false; this.Notes = this.Localize("UninstallStepInternalError"); } diff --git a/DNN Platform/DotNetNuke.Maintenance/Telerik/TelerikUtils.cs b/DNN Platform/DotNetNuke.Maintenance/Telerik/TelerikUtils.cs index bf5c82c774b..2678af10c93 100644 --- a/DNN Platform/DotNetNuke.Maintenance/Telerik/TelerikUtils.cs +++ b/DNN Platform/DotNetNuke.Maintenance/Telerik/TelerikUtils.cs @@ -134,7 +134,7 @@ private bool AssemblyDependsOnTelerik(string path, AppDomain domain) catch (Exception ex) { // If we can't get the referenced assemblies, then it can't depend on Telerik. - this.log.Warn("Could not determine Telerik dependencies on some assemblies.", ex); + this.log.TelerikUtilsCountNotDetermineTelerikDependenciesOnSomeAssemblies(ex); return false; } } diff --git a/DNN Platform/DotNetNuke.ModulePipeline/LoggerMessages.cs b/DNN Platform/DotNetNuke.ModulePipeline/LoggerMessages.cs new file mode 100644 index 00000000000..01b3583c86b --- /dev/null +++ b/DNN Platform/DotNetNuke.ModulePipeline/LoggerMessages.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace DotNetNuke.ModulePipeline; + +using Microsoft.Extensions.Logging; + +/// Extension methods for for pre-defined logging messages. +internal static partial class LoggerMessages +{ + [LoggerMessage(EventId = 1, Level = LogLevel.Debug, Message = "ModuleControlFactory.LoadModuleControl Start (TabId:{TabId},ModuleId:{ModuleId}): ModuleControlSource:{ModuleControlSource}")] + public static partial void ModuleControlPipelineLoadModuleControlStart(this ILogger logger, int tabId, int moduleId, string moduleControlSource); + + [LoggerMessage(EventId = 2, Level = LogLevel.Debug, Message = "ModuleControlFactory.LoadModuleControl End (TabId:{TabId},ModuleId:{ModuleId}): ModuleControlSource:{ModuleControlSource}")] + public static partial void ModuleControlPipelineLoadModuleControlEnd(this ILogger logger, int tabId, int moduleId, string moduleControlSource); + + [LoggerMessage(EventId = 3, Level = LogLevel.Debug, Message = "ModuleControlFactory.LoadSettingsControl Start (TabId:{TabId},ModuleId:{ModuleId}): ModuleControlSource:{ModuleControlSource}")] + public static partial void ModuleControlPipelineLoadSettingsControlStart(this ILogger logger, int tabId, int moduleId, string moduleControlSource); + + [LoggerMessage(EventId = 4, Level = LogLevel.Debug, Message = "ModuleControlFactory.LoadSettingsControl End (TabId:{TabId},ModuleId:{ModuleId}): ModuleControlSource:{ModuleControlSource}")] + public static partial void ModuleControlPipelineLoadSettingsControlEnd(this ILogger logger, int tabId, int moduleId, string moduleControlSource); +} diff --git a/DNN Platform/DotNetNuke.ModulePipeline/ModuleControlPipeline.cs b/DNN Platform/DotNetNuke.ModulePipeline/ModuleControlPipeline.cs index 2a3836bb475..085e4de057b 100644 --- a/DNN Platform/DotNetNuke.ModulePipeline/ModuleControlPipeline.cs +++ b/DNN Platform/DotNetNuke.ModulePipeline/ModuleControlPipeline.cs @@ -19,7 +19,7 @@ namespace DotNetNuke.ModulePipeline /// The Module Pipeline that determines which Module pattern /// to invoke based on the input module type. /// - public class ModuleControlPipeline : IModuleControlPipeline + public partial class ModuleControlPipeline : IModuleControlPipeline { private static readonly ILogger TraceLogger = DnnLoggingController.GetLogger("DNN.Trace"); @@ -35,10 +35,7 @@ public ModuleControlPipeline(IEnumerable factories) /// public Control LoadModuleControl(TemplateControl containerControl, ModuleInfo moduleConfiguration, string controlKey, string controlSrc) { - if (TraceLogger.IsDebugEnabled) - { - TraceLogger.Debug($"ModuleControlFactory.LoadModuleControl Start (TabId:{moduleConfiguration.TabID},ModuleId:{moduleConfiguration.ModuleID}): ModuleControlSource:{moduleConfiguration.ModuleControl.ControlSrc}"); - } + TraceLogger.ModuleControlPipelineLoadModuleControlStart(moduleConfiguration.TabID, moduleConfiguration.ModuleID, moduleConfiguration.ModuleControl.ControlSrc); Control control = null; IModuleControlFactory controlFactory = this.GetModuleControlFactory(moduleConfiguration, controlSrc); @@ -48,35 +45,26 @@ public Control LoadModuleControl(TemplateControl containerControl, ModuleInfo mo control = controlFactory.CreateControl(containerControl, controlKey, controlSrc); } - // set the control ID to the resource file name ( ie. controlname.ascx = controlname ) + // set the control ID to the resource file name ( i.e. controlname.ascx = controlname ) // this is necessary for the Localization in PageBase if (control != null) { control.ID = Path.GetFileNameWithoutExtension(controlSrc); - var moduleControl = control as IModuleControl; - - if (moduleControl != null) + if (control is IModuleControl moduleControl) { moduleControl.ModuleContext.Configuration = moduleConfiguration; } } - if (TraceLogger.IsDebugEnabled) - { - TraceLogger.Debug($"ModuleControlFactory.LoadModuleControl End (TabId:{moduleConfiguration.TabID},ModuleId:{moduleConfiguration.ModuleID}): ModuleControlSource:{moduleConfiguration.ModuleControl.ControlSrc}"); - } - + TraceLogger.ModuleControlPipelineLoadModuleControlEnd(moduleConfiguration.TabID, moduleConfiguration.ModuleID, moduleConfiguration.ModuleControl.ControlSrc); return control; } /// public Control LoadModuleControl(TemplateControl containerControl, ModuleInfo moduleConfiguration) { - if (TraceLogger.IsDebugEnabled) - { - TraceLogger.Debug($"ModuleControlFactory.LoadModuleControl Start (TabId:{moduleConfiguration.TabID},ModuleId:{moduleConfiguration.ModuleID}): ModuleControlSource:{moduleConfiguration.ModuleControl.ControlSrc}"); - } + TraceLogger.ModuleControlPipelineLoadModuleControlStart(moduleConfiguration.TabID, moduleConfiguration.ModuleID, moduleConfiguration.ModuleControl.ControlSrc); Control control = null; IModuleControlFactory controlFactory = this.GetModuleControlFactory(moduleConfiguration, moduleConfiguration.ModuleControl.ControlSrc); @@ -86,35 +74,26 @@ public Control LoadModuleControl(TemplateControl containerControl, ModuleInfo mo control = controlFactory.CreateModuleControl(containerControl, moduleConfiguration); } - // set the control ID to the resource file name ( ie. controlname.ascx = controlname ) + // set the control ID to the resource file name ( i.e. controlname.ascx = controlname ) // this is necessary for the Localization in PageBase if (control != null) { control.ID = Path.GetFileNameWithoutExtension(moduleConfiguration.ModuleControl.ControlSrc); - var moduleControl = control as IModuleControl; - - if (moduleControl != null) + if (control is IModuleControl moduleControl) { moduleControl.ModuleContext.Configuration = moduleConfiguration; } } - if (TraceLogger.IsDebugEnabled) - { - TraceLogger.Debug($"ModuleControlFactory.LoadModuleControl End (TabId:{moduleConfiguration.TabID},ModuleId:{moduleConfiguration.ModuleID}): ModuleControlSource:{moduleConfiguration.ModuleControl.ControlSrc}"); - } - + TraceLogger.ModuleControlPipelineLoadModuleControlEnd(moduleConfiguration.TabID, moduleConfiguration.ModuleID, moduleConfiguration.ModuleControl.ControlSrc); return control; } /// public Control LoadSettingsControl(TemplateControl containerControl, ModuleInfo moduleConfiguration, string controlSrc) { - if (TraceLogger.IsDebugEnabled) - { - TraceLogger.Debug($"ModuleControlFactory.LoadSettingsControl Start (TabId:{moduleConfiguration.TabID},ModuleId:{moduleConfiguration.ModuleID}): ModuleControlSource:{moduleConfiguration.ModuleControl.ControlSrc}"); - } + TraceLogger.ModuleControlPipelineLoadSettingsControlStart(moduleConfiguration.TabID, moduleConfiguration.ModuleID, moduleConfiguration.ModuleControl.ControlSrc); Control control = null; IModuleControlFactory controlFactory = this.GetModuleControlFactory(moduleConfiguration, controlSrc); @@ -124,7 +103,7 @@ public Control LoadSettingsControl(TemplateControl containerControl, ModuleInfo control = controlFactory.CreateSettingsControl(containerControl, moduleConfiguration, controlSrc); } - // set the control ID to the resource file name ( ie. controlname.ascx = controlname ) + // set the control ID to the resource file name ( i.e. controlname.ascx = controlname ) // this is necessary for the Localization in PageBase if (control != null) { @@ -134,19 +113,13 @@ public Control LoadSettingsControl(TemplateControl containerControl, ModuleInfo control.ID = fileNameWithoutExtension.Replace('.', '-'); } - var settingsControl = control as ISettingsControl; - - if (settingsControl != null) + if (control is ISettingsControl settingsControl) { settingsControl.ModuleContext.Configuration = moduleConfiguration; } } - if (TraceLogger.IsDebugEnabled) - { - TraceLogger.Debug($"ModuleControlFactory.LoadSettingsControl End (TabId:{moduleConfiguration.TabID},ModuleId:{moduleConfiguration.ModuleID}): ModuleControlSource:{moduleConfiguration.ModuleControl.ControlSrc}"); - } - + TraceLogger.ModuleControlPipelineLoadSettingsControlEnd(moduleConfiguration.TabID, moduleConfiguration.ModuleID, moduleConfiguration.ModuleControl.ControlSrc); return control; } diff --git a/DNN Platform/DotNetNuke.Web.Client.ResourceManager/ClientResourceController.cs b/DNN Platform/DotNetNuke.Web.Client.ResourceManager/ClientResourceController.cs index d620fd022ee..a4e60c46eac 100644 --- a/DNN Platform/DotNetNuke.Web.Client.ResourceManager/ClientResourceController.cs +++ b/DNN Platform/DotNetNuke.Web.Client.ResourceManager/ClientResourceController.cs @@ -16,7 +16,7 @@ namespace DotNetNuke.Web.Client.ResourceManager using Microsoft.Extensions.Logging; /// - public class ClientResourceController : IClientResourceController + public partial class ClientResourceController : IClientResourceController { private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IHostSettings hostSettings; @@ -59,7 +59,7 @@ public ClientResourceController(IHostSettings hostSettings, IApplicationStatusIn this.crmVersion = clientResourceSettings.OverrideDefaultSettings ? clientResourceSettings.PortalCrmVersion : clientResourceSettings.HostCrmVersion; } - Logger.Debug($"ClientResourceController initialized with ID {this.controllerId}"); + Logger.ClientResourceControllerControllerInitialized(this.controllerId); } private List Fonts { get; set; } = []; @@ -225,7 +225,7 @@ public void RemoveStylesheetByPath(string stylesheetPath, string pathNameAlias) public string RenderDependencies(ResourceType resourceType, string provider, string applicationPath) { this.hasBegunRendering = true; - Logger.Debug($"Rendering dependencies for CRC id {this.controllerId} with ResourceType={resourceType}, Provider={provider}, ApplicationPath={applicationPath}. We have {this.Scripts.Count} scripts, {this.Stylesheets.Count} stylesheets and {this.Fonts.Count} fonts."); + Logger.ClientResourceControllerRenderingDependencies(this.controllerId, resourceType, provider, applicationPath, this.Scripts.Count, this.Stylesheets.Count, this.Fonts.Count); var sortedList = new List(); if (resourceType is ResourceType.Font or ResourceType.All) { @@ -292,11 +292,11 @@ private List AddResource(List resources, T resource) where T : IResource { resource.ResolvedPath = this.ResolvePath(resource.FilePath, resource.PathNameAlias); - Logger.Debug($"Adding resource {resource.ResolvedPath} to CRC id {this.controllerId} which currently has {resources.Count} resources"); + Logger.ClientResourceControllerAddingResource(resource.ResolvedPath, this.controllerId, resources.Count); if (this.hasBegunRendering) { - Logger.Error($"Cannot add resource {resource.ResolvedPath} to CRC id {this.controllerId} because rendering has already begun"); + Logger.ClientResourceControllerCannotAddResourceBecauseRenderingHasAlreadyBegun(resource.ResolvedPath, this.controllerId); ////throw new InvalidOperationException("Cannot add resources after rendering has begun."); } diff --git a/DNN Platform/DotNetNuke.Web.Client.ResourceManager/LoggerMessages.cs b/DNN Platform/DotNetNuke.Web.Client.ResourceManager/LoggerMessages.cs new file mode 100644 index 00000000000..f27296fcab2 --- /dev/null +++ b/DNN Platform/DotNetNuke.Web.Client.ResourceManager/LoggerMessages.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace DotNetNuke.Web.Client.ResourceManager; + +using System; + +using DotNetNuke.Abstractions.ClientResources; + +using Microsoft.Extensions.Logging; + +/// Extension methods for for pre-defined logging messages. +/// The DotNetNuke.Web.Client.ResourceManager project has been assigned event IDs from 1,650,000 to 1,699,999. +internal static partial class LoggerMessages +{ + [LoggerMessage(EventId = 1_650_000, Level = LogLevel.Debug, Message = "ClientResourceController initialized with ID {ControllerId}")] + public static partial void ClientResourceControllerControllerInitialized(this ILogger logger, Guid controllerId); + + [LoggerMessage(EventId = 1_650_001, Level = LogLevel.Debug, Message = "Rendering dependencies for CRC id {ControllerId} with ResourceType={ResourceType}, Provider={Provider}, ApplicationPath={ApplicationPath}. We have {ScriptsCount} scripts, {StylesheetsCount} stylesheets and {FontsCount} fonts.")] + public static partial void ClientResourceControllerRenderingDependencies(this ILogger logger, Guid controllerId, ResourceType resourceType, string provider, string applicationPath, int scriptsCount, int stylesheetsCount, int fontsCount); + + [LoggerMessage(EventId = 1_650_002, Level = LogLevel.Debug, Message = "Adding resource {ResolvedPath} to CRC id {ControllerId} which currently has {Count} resources")] + public static partial void ClientResourceControllerAddingResource(this ILogger logger, string resolvedPath, Guid controllerId, int count); + + [LoggerMessage(EventId = 1_650_003, Level = LogLevel.Error, Message = "Cannot add resource {ResolvedPath} to CRC id {ControllerId} because rendering has already begun")] + public static partial void ClientResourceControllerCannotAddResourceBecauseRenderingHasAlreadyBegun(this ILogger logger, string resolvedPath, Guid controllerId); +} diff --git a/DNN Platform/DotNetNuke.Web.Client/ClientResourceManager.cs b/DNN Platform/DotNetNuke.Web.Client/ClientResourceManager.cs index dade693e795..989091cd645 100644 --- a/DNN Platform/DotNetNuke.Web.Client/ClientResourceManager.cs +++ b/DNN Platform/DotNetNuke.Web.Client/ClientResourceManager.cs @@ -135,7 +135,7 @@ public static void AddConfiguration() /// Remove the client dependency configuration from the web.config. public static void RemoveConfiguration() { - Logger.Info("Removing ClientDependency from web.config"); + Logger.ClientResourceManagerRemovingClientDependencyFromWebConfig(); var configPath = HostingEnvironment.MapPath("~/web.config"); if (string.IsNullOrEmpty(configPath)) @@ -151,45 +151,36 @@ public static void RemoveConfiguration() // Config Sections var sectionsConfig = xmlDoc.DocumentElement?.SelectSingleNode("configSections"); - if (sectionsConfig != null) + var clientDependencySectionConfig = sectionsConfig?.SelectSingleNode("section[@name='clientDependency']"); + if (clientDependencySectionConfig != null) { - var clientDependencySectionConfig = sectionsConfig.SelectSingleNode("section[@name='clientDependency']"); - if (clientDependencySectionConfig != null) - { - Logger.Info("Removing configSections/clientDependency"); - sectionsConfig.RemoveChild(clientDependencySectionConfig); - } + Logger.ClientResourceManagerRemovingClientDependencyConfigSection(); + sectionsConfig.RemoveChild(clientDependencySectionConfig); } // Module Config var systemWebServerModulesConfig = xmlDoc.DocumentElement?.SelectSingleNode("system.webServer/modules"); - if (systemWebServerModulesConfig != null) + var moduleConfig = systemWebServerModulesConfig?.SelectSingleNode("add[@name=\"ClientDependencyModule\"]"); + if (moduleConfig != null) { - var moduleConfig = systemWebServerModulesConfig.SelectSingleNode("add[@name=\"ClientDependencyModule\"]"); - if (moduleConfig != null) - { - Logger.Info("Removing system.webServer/modules/ClientDependencyModule"); - systemWebServerModulesConfig.RemoveChild(moduleConfig); - } + Logger.ClientResourceManagerRemovingClientDependencyModule(); + systemWebServerModulesConfig.RemoveChild(moduleConfig); } // Handler Config var systemWebServerHandlersConfig = xmlDoc.DocumentElement?.SelectSingleNode("system.webServer/handlers"); - if (systemWebServerHandlersConfig != null) + var handlerConfig = systemWebServerHandlersConfig?.SelectSingleNode("add[@name=\"ClientDependencyHandler\"]"); + if (handlerConfig != null) { - var handlerConfig = systemWebServerHandlersConfig.SelectSingleNode("add[@name=\"ClientDependencyHandler\"]"); - if (handlerConfig != null) - { - Logger.Info("Removing system.webServer/handlers/ClientDependencyHandler"); - systemWebServerHandlersConfig.RemoveChild(handlerConfig); - } + Logger.ClientResourceManagerRemovingClientDependencyHandler(); + systemWebServerHandlersConfig.RemoveChild(handlerConfig); } // ClientDependency Config var clientDependencyConfig = xmlDoc.DocumentElement?.SelectSingleNode("clientDependency"); if (clientDependencyConfig != null) { - Logger.Info("Removing clientDependency"); + Logger.ClientResourceManagerRemovingClientDependencyElement(); xmlDoc.DocumentElement?.RemoveChild(clientDependencyConfig); } diff --git a/DNN Platform/DotNetNuke.Web.Client/ClientResourceSettings.cs b/DNN Platform/DotNetNuke.Web.Client/ClientResourceSettings.cs index 894de8c72b9..a2ee9e91b3a 100644 --- a/DNN Platform/DotNetNuke.Web.Client/ClientResourceSettings.cs +++ b/DNN Platform/DotNetNuke.Web.Client/ClientResourceSettings.cs @@ -61,7 +61,7 @@ static ClientResourceSettings() } catch (Exception exception) { - DnnLoggingController.GetLogger().Warn("Failed to get get types for reflection", exception); + DnnLoggingController.GetLogger().ClientResourceSettingsFailedToGetTypesForReflection(exception); } } @@ -242,7 +242,7 @@ private static string GetPortalSettingThroughReflection(int? portalId, string se } catch (Exception exception) { - DnnLoggingController.GetLogger().Warn("Failed to Get Portal Setting Through Reflection", exception); + DnnLoggingController.GetLogger().ClientResourceSettingsFailedToGetPortalSettingThroughReflection(exception); } return null; @@ -265,7 +265,7 @@ private static string GetPortalSettingThroughReflection(int? portalId, string se } catch (Exception exception) { - DnnLoggingController.GetLogger().Warn("Failed to Get Portal ID Through Reflection", exception); + DnnLoggingController.GetLogger().ClientResourceSettingsFailedToGetPortalIdThroughReflection(exception); } return null; @@ -286,7 +286,7 @@ private static string GetHostSettingThroughReflection(string settingKey) } catch (Exception exception) { - DnnLoggingController.GetLogger().Warn("Failed to Get Host Setting Through Reflection", exception); + DnnLoggingController.GetLogger().ClientResourceSettingsFailedToGetHostSettingThroughReflection(exception); } return null; @@ -302,7 +302,7 @@ private static UpgradeStatus GetStatusByReflection() } catch (Exception exception) { - DnnLoggingController.GetLogger().Warn("Failed to Get Status By Reflection", exception); + DnnLoggingController.GetLogger().ClientResourceSettingsFailedToGetStatusThroughReflection(exception); return UpgradeStatus.Unknown; } } diff --git a/DNN Platform/DotNetNuke.Web.Client/DependencyInjection.cs b/DNN Platform/DotNetNuke.Web.Client/DependencyInjection.cs index e63dd7279c6..ed7020f9543 100644 --- a/DNN Platform/DotNetNuke.Web.Client/DependencyInjection.cs +++ b/DNN Platform/DotNetNuke.Web.Client/DependencyInjection.cs @@ -26,7 +26,7 @@ static DependencyInjection() } catch (Exception exception) { - DnnLoggingController.GetLogger(typeof(DependencyInjection)).Warn("Failed to get get types for reflection", exception); + DnnLoggingController.GetLogger(typeof(DependencyInjection)).DependencyInjectionFailedToGetTypesForReflection(exception); } } diff --git a/DNN Platform/DotNetNuke.Web.Client/LoggerMessages.cs b/DNN Platform/DotNetNuke.Web.Client/LoggerMessages.cs new file mode 100644 index 00000000000..3c85755c2b9 --- /dev/null +++ b/DNN Platform/DotNetNuke.Web.Client/LoggerMessages.cs @@ -0,0 +1,47 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace DotNetNuke.Web.Client; + +using System; + +using Microsoft.Extensions.Logging; + +/// Extension methods for for pre-defined logging messages. +/// The DotNetNuke.Web.Client project has been assigned event IDs from 1,600,000 to 1,649,999. +internal static partial class LoggerMessages +{ + [LoggerMessage(EventId = 1_600_000, Level = LogLevel.Information, Message = "Removing ClientDependency from web.config")] + public static partial void ClientResourceManagerRemovingClientDependencyFromWebConfig(this ILogger logger); + + [LoggerMessage(EventId = 1_600_001, Level = LogLevel.Information, Message = "Removing configSections/clientDependency")] + public static partial void ClientResourceManagerRemovingClientDependencyConfigSection(this ILogger logger); + + [LoggerMessage(EventId = 1_600_002, Level = LogLevel.Information, Message = "Removing system.webServer/modules/ClientDependencyModule")] + public static partial void ClientResourceManagerRemovingClientDependencyModule(this ILogger logger); + + [LoggerMessage(EventId = 1_600_003, Level = LogLevel.Information, Message = "Removing system.webServer/handlers/ClientDependencyHandler")] + public static partial void ClientResourceManagerRemovingClientDependencyHandler(this ILogger logger); + + [LoggerMessage(EventId = 1_600_004, Level = LogLevel.Information, Message = "Removing clientDependency")] + public static partial void ClientResourceManagerRemovingClientDependencyElement(this ILogger logger); + + [LoggerMessage(EventId = 1_600_100, Level = LogLevel.Warning, Message = "Failed to get get types for reflection")] + public static partial void DependencyInjectionFailedToGetTypesForReflection(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_600_200, Level = LogLevel.Warning, Message = "Failed to get get types for reflection")] + public static partial void ClientResourceSettingsFailedToGetTypesForReflection(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_600_201, Level = LogLevel.Warning, Message = "Failed to Get Portal Setting Through Reflection")] + public static partial void ClientResourceSettingsFailedToGetPortalSettingThroughReflection(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_600_202, Level = LogLevel.Warning, Message = "Failed to Get Portal ID Through Reflection")] + public static partial void ClientResourceSettingsFailedToGetPortalIdThroughReflection(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_600_203, Level = LogLevel.Warning, Message = "Failed to Get Host Setting Through Reflection")] + public static partial void ClientResourceSettingsFailedToGetHostSettingThroughReflection(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_600_204, Level = LogLevel.Warning, Message = "Failed to Get Status By Reflection")] + public static partial void ClientResourceSettingsFailedToGetStatusThroughReflection(this ILogger logger, Exception exception); +} diff --git a/DNN Platform/DotNetNuke.Web.Mvc/LoggerMessages.cs b/DNN Platform/DotNetNuke.Web.Mvc/LoggerMessages.cs new file mode 100644 index 00000000000..15c3264349d --- /dev/null +++ b/DNN Platform/DotNetNuke.Web.Mvc/LoggerMessages.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace DotNetNuke.Web.Mvc; + +using System; + +using Microsoft.Extensions.Logging; + +/// Extension methods for for pre-defined logging messages. +/// The DotNetNuke.Web.MVC project has been assigned event IDs from 1,500,000 to 1,599,999. +internal static partial class LoggerMessages +{ + [LoggerMessage(EventId = 1_500_000, Level = LogLevel.Trace, Message = "Registered a total of {Count} routes")] + public static partial void MvcRoutingManagerRegisteredRoutes(this ILogger logger, int count); + + [LoggerMessage(EventId = 1_500_001, Level = LogLevel.Trace, Message = "Mapping route: {FullRouteName} @ {RouteUrl}")] + public static partial void MvcRoutingManagerMappingRoute(this ILogger logger, string fullRouteName, string routeUrl); + + [LoggerMessage(EventId = 1_500_002, Level = LogLevel.Error, Message = "{FullTypeName}.RegisterRoutes threw an exception.")] + public static partial void MvcRoutingManagerRegisterRoutesThrewException(this ILogger logger, Exception exception, string fullTypeName); + + [LoggerMessage(EventId = 1_500_002, Level = LogLevel.Error, Message = "Unable to create {fullTypeName} while registering service routes.")] + public static partial void MvcRoutingManagerUnableToCreateMapper(this ILogger logger, Exception exception, string fullTypeName); + + [LoggerMessage(EventId = 1_500_100, Level = LogLevel.Warning, Message = "The specified moniker ({Moniker}) is not defined in the system")] + public static partial void StandardTabAndModuleInfoProviderMonikerIsNotDefined(this ILogger logger, string moniker); +} diff --git a/DNN Platform/DotNetNuke.Web.Mvc/Routing/MvcRoutingManager.cs b/DNN Platform/DotNetNuke.Web.Mvc/Routing/MvcRoutingManager.cs index 4a9d50fd542..f9a117d7fad 100644 --- a/DNN Platform/DotNetNuke.Web.Mvc/Routing/MvcRoutingManager.cs +++ b/DNN Platform/DotNetNuke.Web.Mvc/Routing/MvcRoutingManager.cs @@ -20,7 +20,8 @@ namespace DotNetNuke.Web.Mvc.Routing using Microsoft.Extensions.Logging; - public sealed class MvcRoutingManager : IMapRoute, IRoutingManager + /// An for MVC extensions. + public sealed partial class MvcRoutingManager : IMapRoute, IRoutingManager { private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly RouteCollection routes; @@ -93,7 +94,7 @@ public Route MapRoute(string moduleFolderName, string routeName, string url, obj var routeUrl = this.portalAliasMvcRouteManager.GetRouteUrl(moduleFolderName, url, count); route = MapRouteWithNamespace(fullRouteName, routeUrl, defaults, constraints, namespaces); this.routes.Add(route); - Logger.Trace($"Mapping route: {fullRouteName} @ {routeUrl}"); + Logger.MvcRoutingManagerMappingRoute(fullRouteName, routeUrl); } return route; @@ -109,7 +110,7 @@ public void RegisterRoutes() this.LocateServicesAndMapRoutes(); } - Logger.TraceFormat(CultureInfo.InvariantCulture, "Registered a total of {0} routes", this.routes.Count); + Logger.MvcRoutingManagerRegisteredRoutes(this.routes.Count); } internal static bool IsValidServiceRouteMapper(Type t) @@ -169,7 +170,7 @@ private void LocateServicesAndMapRoutes() } catch (Exception e) { - Logger.ErrorFormat(CultureInfo.InvariantCulture, "{0}.RegisterRoutes threw an exception. {1}\r\n{2}", routeMapper.GetType().FullName, e.Message, e.StackTrace); + Logger.MvcRoutingManagerRegisterRoutesThrewException(e, routeMapper.GetType().FullName); } } } @@ -192,7 +193,7 @@ private IEnumerable GetServiceRouteMappers() } catch (Exception e) { - Logger.ErrorFormat(CultureInfo.InvariantCulture, "Unable to create {0} while registering service routes. {1}", routeMapperType.FullName, e.Message); + Logger.MvcRoutingManagerUnableToCreateMapper(e, routeMapperType.FullName); routeMapper = null; } diff --git a/DNN Platform/DotNetNuke.Web.Mvc/StandardTabAndModuleInfoProvider.cs b/DNN Platform/DotNetNuke.Web.Mvc/StandardTabAndModuleInfoProvider.cs index 596f1367d6d..ec9e9f4993a 100644 --- a/DNN Platform/DotNetNuke.Web.Mvc/StandardTabAndModuleInfoProvider.cs +++ b/DNN Platform/DotNetNuke.Web.Mvc/StandardTabAndModuleInfoProvider.cs @@ -4,10 +4,8 @@ namespace DotNetNuke.Web.Mvc { - using System.Collections.Generic; using System.Globalization; using System.Linq; - using System.Net.Http; using System.Web; using DotNetNuke.Common.Utilities; @@ -157,10 +155,7 @@ private static int GetTabModuleInfoFromMoniker(string monikerValue) return ids.First(); } - if (Logger.IsWarnEnabled) - { - Logger.WarnFormat(CultureInfo.InvariantCulture, "The specified moniker ({0}) is not defined in the system", monikerValue); - } + Logger.StandardTabAndModuleInfoProviderMonikerIsNotDefined(monikerValue); } return Null.NullInteger; diff --git a/DNN Platform/DotNetNuke.Web/Api/Auth/ApiTokenAuthMessageHandler.cs b/DNN Platform/DotNetNuke.Web/Api/Auth/ApiTokenAuthMessageHandler.cs index 1cea277d47e..da0705f4161 100644 --- a/DNN Platform/DotNetNuke.Web/Api/Auth/ApiTokenAuthMessageHandler.cs +++ b/DNN Platform/DotNetNuke.Web/Api/Auth/ApiTokenAuthMessageHandler.cs @@ -17,7 +17,7 @@ namespace DotNetNuke.Web.Api.Auth /// /// Authentication message handler that authorizes an HTTP request based on a valid API token. /// - public class ApiTokenAuthMessageHandler : AuthMessageHandlerBase + public partial class ApiTokenAuthMessageHandler : AuthMessageHandlerBase { private static readonly ILogger Logger = DnnLoggingController.GetLogger(); @@ -42,9 +42,7 @@ public ApiTokenAuthMessageHandler(bool includeByDefault, bool forceSsl, IApiToke /// public override bool BypassAntiForgeryToken => true; - /// - /// Gets or sets a value indicating whether the authentication message handler is enabled in the web.config. - /// + /// Gets or sets a value indicating whether the authentication message handler is enabled in the web.config. internal static bool IsEnabled { get; set; } /// @@ -65,10 +63,7 @@ private void TryToAuthenticate(HttpRequestMessage request) var (token, user) = this.apiTokenController.ValidateToken(request); if (token != null) { - if (Logger.IsTraceEnabled) - { - Logger.Trace($"Authenticated using API token {token.ApiTokenId}"); - } + Logger.ApiTokenAuthMessageHandlerAuthenticatedUsingApiToken(token.ApiTokenId); this.apiTokenController.SetApiTokenForRequest(token); @@ -80,7 +75,7 @@ private void TryToAuthenticate(HttpRequestMessage request) } catch (Exception ex) { - Logger.Error("Unexpected error authenticating API Token. " + ex); + Logger.ApiTokenAuthMessageHandlerUnexpectedErrorAuthenticatingApiToken(ex); } } } diff --git a/DNN Platform/DotNetNuke.Web/Api/Auth/ApiTokens/ApiTokenController.cs b/DNN Platform/DotNetNuke.Web/Api/Auth/ApiTokens/ApiTokenController.cs index 15d7c693460..340bdbdefd4 100644 --- a/DNN Platform/DotNetNuke.Web/Api/Auth/ApiTokens/ApiTokenController.cs +++ b/DNN Platform/DotNetNuke.Web/Api/Auth/ApiTokens/ApiTokenController.cs @@ -30,7 +30,7 @@ namespace DotNetNuke.Web.Api.Auth.ApiTokens using Microsoft.Extensions.Logging; /// - public class ApiTokenController : IApiTokenController + public partial class ApiTokenController : IApiTokenController { private const string AuthScheme = "Bearer"; @@ -71,7 +71,7 @@ public ApiTokenController(IApiTokenRepository apiTokenRepository, IEventLogger e { if (!ApiTokenAuthMessageHandler.IsEnabled) { - Logger.Trace(this.SchemeType + " is not registered/enabled in web.config file"); + Logger.ApiTokenControllerSchemeIsNotEnabledInWebConfig(this.SchemeType); return (null, null); } @@ -204,10 +204,7 @@ private static string ValidateAuthHeader(AuthenticationHeaderValue authHdr) if (!string.Equals(authHdr.Scheme, AuthScheme, StringComparison.OrdinalIgnoreCase)) { - if (Logger.IsTraceEnabled) - { - Logger.Trace("Authorization header scheme in the request is not equal to " + AuthScheme); - } + Logger.ApiTokenControllerAuthorizationHeaderSchemeDoesNotMatchAuthScheme(AuthScheme); return null; } @@ -215,11 +212,7 @@ private static string ValidateAuthHeader(AuthenticationHeaderValue authHdr) var authorization = authHdr.Parameter; if (string.IsNullOrEmpty(authorization)) { - if (Logger.IsTraceEnabled) - { - Logger.Trace("Missing authorization header value in the request"); - } - + Logger.ApiTokenControllerMissingAuthorizationHeaderValue(); return null; } @@ -246,10 +239,7 @@ private static string GetHashedStr(string data) { if (apiToken.ExpiresOn < DateUtils.GetDatabaseUtcTime() || apiToken.IsRevoked) { - if (Logger.IsTraceEnabled) - { - Logger.Trace("Token expired"); - } + Logger.ApiTokenControllerTokenExpired(); this.eventLogger.AddLog("Token Auth", authorization, EventLogType.APITOKEN_AUTHENTICATION_FAILED); return (null, null); @@ -263,11 +253,7 @@ private static string GetHashedStr(string data) var userInfo = UserController.GetUserById(this.hostSettings, PortalSettings.PortalId, apiToken.CreatedByUserId); if (userInfo == null) { - if (Logger.IsTraceEnabled) - { - Logger.Trace("Invalid user"); - } - + Logger.ApiTokenControllerInvalidUser(); return (null, null); } diff --git a/DNN Platform/DotNetNuke.Web/Api/Auth/AuthMessageHandlerBase.cs b/DNN Platform/DotNetNuke.Web/Api/Auth/AuthMessageHandlerBase.cs index 669f22fdb1a..7aadd607a5c 100644 --- a/DNN Platform/DotNetNuke.Web/Api/Auth/AuthMessageHandlerBase.cs +++ b/DNN Platform/DotNetNuke.Web/Api/Auth/AuthMessageHandlerBase.cs @@ -17,7 +17,7 @@ namespace DotNetNuke.Web.Api.Auth using Microsoft.Extensions.Logging; /// Base class for authentication providers message handlers. - public abstract class AuthMessageHandlerBase : DelegatingHandler + public abstract partial class AuthMessageHandlerBase : DelegatingHandler { private static readonly ILogger Logger = DnnLoggingController.GetLogger(); @@ -111,16 +111,13 @@ protected bool NeedsAuthentication(HttpRequestMessage request) return !Thread.CurrentPrincipal.Identity.IsAuthenticated; } - if (Logger.IsTraceEnabled) - { - Logger.Trace($"{this.AuthScheme}: Validating request vs. SSL mode ({this.ForceSsl}) failed. "); - } + Logger.AuthMessageHandlerBaseValidatingRequestVsSslModeFailed(this.AuthScheme, this.ForceSsl); - // will let callers to return without authenticating the user + // will let callers return without authenticating the user return false; } - /// Validated the setting of the instane against the HTTP(S) request. + /// Validated the setting of the instance against the HTTP(S) request. /// True if matcher the request scheme; false otherwise. private bool MustEnforceSslInRequest(HttpRequestMessage request) { diff --git a/DNN Platform/DotNetNuke.Web/Api/Internal/ServicesRoutingManager.cs b/DNN Platform/DotNetNuke.Web/Api/Internal/ServicesRoutingManager.cs index 30e2eabc6f3..4af601b06d4 100644 --- a/DNN Platform/DotNetNuke.Web/Api/Internal/ServicesRoutingManager.cs +++ b/DNN Platform/DotNetNuke.Web/Api/Internal/ServicesRoutingManager.cs @@ -29,7 +29,7 @@ namespace DotNetNuke.Web.Api.Internal using Microsoft.Extensions.Logging; /// Allows registering web API routes. - public sealed class ServicesRoutingManager : IMapRoute, IRoutingManager + public sealed partial class ServicesRoutingManager : IMapRoute, IRoutingManager { private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IServiceProvider serviceProvider; @@ -92,10 +92,7 @@ public IList MapHttpRoute(string moduleFolderName, string routeName, stri var routeUrl = this.portalAliasRouteManager.GetRouteUrl(moduleFolderName, url, count); var route = this.MapHttpRouteWithNamespace(fullRouteName, routeUrl, defaults, constraints, namespaces); mappedRoutes.Add(route); - if (Logger.IsTraceEnabled) - { - Logger.Trace("Mapping route: " + fullRouteName + " @ " + routeUrl); - } + Logger.ServicesRoutingManagerMappingRoute(fullRouteName, routeUrl); // compatible with old service path: DesktopModules/{namespace}/API/{controller}/{action}. var oldRouteName = $"{fullRouteName}-old"; @@ -106,10 +103,7 @@ public IList MapHttpRoute(string moduleFolderName, string routeName, stri var oldRoute = this.MapHttpRouteWithNamespace(oldRouteName, oldRouteUrl, defaults, constraints, namespaces); mappedRoutes.Add(oldRoute); - if (Logger.IsTraceEnabled) - { - Logger.Trace("Mapping route: " + oldRouteName + " @ " + oldRouteUrl); - } + Logger.ServicesRoutingManagerMappingOldRoute(oldRouteName, oldRouteUrl); } return mappedRoutes; @@ -176,7 +170,7 @@ public void RegisterRoutes() this.LocateServicesAndMapRoutes(); } - Logger.TraceFormat(CultureInfo.InvariantCulture, "Registered a total of {0} routes", this.routes.Count); + Logger.ServicesRoutingManagerRegisteredRoutes(this.routes.Count); } /// Determines whether the given is a valid . @@ -218,7 +212,7 @@ private void RegisterAuthenticationHandlers() { if (!handlerEntry.Enabled) { - Logger.Trace("The following handler is disabled " + handlerEntry.ClassName); + Logger.ServicesRoutingManagerHandlerIsDisabled(handlerEntry.ClassName); continue; } @@ -233,14 +227,14 @@ private void RegisterAuthenticationHandlers() var schemeName = handler.AuthScheme.ToUpperInvariant(); if (registeredSchemes.Contains(schemeName)) { - Logger.Trace($"The following handler scheme '{handlerEntry.ClassName}' is already added and will be skipped"); + Logger.ServicesRoutingManagerHandlerIsAlreadyAdded(handlerEntry.ClassName); handler.Dispose(); continue; } GlobalConfiguration.Configuration.MessageHandlers.Add(handler); registeredSchemes.Add(schemeName); - Logger.Trace($"Instantiated/Activated instance of {handler.AuthScheme}, class: {handler.GetType().FullName}"); + Logger.ServicesRoutingManagerHandlerIsActivated(handler.AuthScheme, handler.GetType().FullName); if (handlerEntry.DefaultInclude) { @@ -254,7 +248,7 @@ private void RegisterAuthenticationHandlers() } catch (Exception ex) { - Logger.Error("Cannot instantiate/activate instance of " + handlerEntry.ClassName + Environment.NewLine + ex); + Logger.ServicesRoutingManagerCannotInstantiateInstanceOf(ex, handlerEntry.ClassName); } } } @@ -273,7 +267,7 @@ private void LocateServicesAndMapRoutes() } catch (Exception e) { - Logger.ErrorFormat(CultureInfo.InvariantCulture, "{0}.RegisterRoutes threw an exception. {1}\r\n{2}", routeMapper.GetType().FullName, e.Message, e.StackTrace); + Logger.ServicesRoutingManagerRegisterRoutesThrewAnException(e, routeMapper.GetType().FullName); } } } @@ -294,7 +288,7 @@ private IEnumerable GetServiceRouteMappers(IServiceProvider } catch (Exception e) { - Logger.ErrorFormat(CultureInfo.InvariantCulture, "Unable to create {0} while registering service routes. {1}", routeMapperType.FullName, e.Message); + Logger.ServicesRoutingManagerUnableToCreateRouteMapper(e, routeMapperType.FullName); routeMapper = null; } diff --git a/DNN Platform/DotNetNuke.Web/Api/StandardTabAndModuleInfoProvider.cs b/DNN Platform/DotNetNuke.Web/Api/StandardTabAndModuleInfoProvider.cs index 8a18fe59453..11bdb012e1a 100644 --- a/DNN Platform/DotNetNuke.Web/Api/StandardTabAndModuleInfoProvider.cs +++ b/DNN Platform/DotNetNuke.Web/Api/StandardTabAndModuleInfoProvider.cs @@ -164,10 +164,7 @@ private static int GetTabModuleInfoFromMoniker(string monikerValue) return ids.First(); } - if (Logger.IsWarnEnabled) - { - Logger.WarnFormat(CultureInfo.InvariantCulture, "The specified moniker ({0}) is not defined in the system", monikerValue); - } + Logger.StandardTabAndModuleInfoProviderMonikerIsNotDefined(monikerValue); } return Null.NullInteger; diff --git a/DNN Platform/DotNetNuke.Web/Api/TraceWriter.cs b/DNN Platform/DotNetNuke.Web/Api/TraceWriter.cs index 018fca3d299..5cdb3484307 100644 --- a/DNN Platform/DotNetNuke.Web/Api/TraceWriter.cs +++ b/DNN Platform/DotNetNuke.Web/Api/TraceWriter.cs @@ -14,7 +14,7 @@ namespace DotNetNuke.Web.Api using Microsoft.Extensions.Logging; /// A implementation. - internal sealed class TraceWriter : ITraceWriter + internal sealed partial class TraceWriter : ITraceWriter { private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly bool enabled; @@ -42,7 +42,6 @@ public void Trace(HttpRequestMessage request, string category, TraceLevel level, private static void Log(TraceRecord rec) { var message = new StringBuilder(); - if (rec.Request != null) { if (rec.Request.Method != null) @@ -66,29 +65,23 @@ private static void Log(TraceRecord rec) message.Append(' ').Append(rec.Message); } - string output = message.ToString(); - - if (!string.IsNullOrEmpty(output)) + var output = message.ToString(); + if (string.IsNullOrEmpty(output)) { - switch (rec.Level) - { - case TraceLevel.Debug: - Logger.Debug(output); - break; - case TraceLevel.Info: - Logger.Info(output); - break; - case TraceLevel.Warn: - Logger.Warn(output); - break; - case TraceLevel.Error: - Logger.Error(output); - break; - case TraceLevel.Fatal: - Logger.Fatal(output); - break; - } + return; } + + var logLevel = rec.Level switch + { + TraceLevel.Debug => LogLevel.Debug, + TraceLevel.Info => LogLevel.Information, + TraceLevel.Warn => LogLevel.Warning, + TraceLevel.Error => LogLevel.Error, + TraceLevel.Fatal => LogLevel.Critical, + _ => LogLevel.None, + }; + + Logger.TraceWriterLogMessage(logLevel, output); } } } diff --git a/DNN Platform/DotNetNuke.Web/Common/DotNetNukeHttpApplication.cs b/DNN Platform/DotNetNuke.Web/Common/DotNetNukeHttpApplication.cs index 576cdf38960..69b7d8249bb 100644 --- a/DNN Platform/DotNetNuke.Web/Common/DotNetNukeHttpApplication.cs +++ b/DNN Platform/DotNetNuke.Web/Common/DotNetNukeHttpApplication.cs @@ -44,7 +44,7 @@ namespace DotNetNuke.Web.Common.Internal using Microsoft.Extensions.Logging; /// DotNetNuke Http Application. It will handle Start, End, BeginRequest, Error event for whole application. - public class DotNetNukeHttpApplication : HttpApplication + public partial class DotNetNukeHttpApplication : HttpApplication { private static readonly ILogger Logger = DnnLoggingController.GetLogger(); @@ -133,7 +133,7 @@ private static bool IsInstallInProgress(HttpApplication app) private void Application_End(object sender, EventArgs eventArgs) { - Logger.Info("Application Ending"); + Logger.ApplicationEnding(); try { @@ -141,7 +141,7 @@ private void Application_End(object sender, EventArgs eventArgs) } catch (Exception e) { - Logger.Error(e); + Logger.ApplicationLogEndException(e); } try @@ -150,44 +150,44 @@ private void Application_End(object sender, EventArgs eventArgs) } catch (Exception e) { - Logger.Error(e); + Logger.ApplicationStopSchedulerException(e); } // Shutdown Lucene, but not when we are installing var appStatus = new ApplicationStatusInfo(new Application()); if (appStatus.Status != UpgradeStatus.Install) { - Logger.Trace("Disposing Lucene"); + Logger.ApplicationDisposingLucene(); if (LuceneController.Instance is IDisposable lucene) { lucene.Dispose(); } } - Logger.Trace("Dumping all Application Errors"); + Logger.ApplicationDumpingAllApplicationErrors(); if (HttpContext.Current != null) { if (HttpContext.Current.AllErrors != null) { foreach (Exception exc in HttpContext.Current.AllErrors) { - Logger.Fatal(exc); + Logger.ApplicationLogApplicationError(exc); } } } - Logger.Trace("End Dumping all Application Errors"); - Logger.Info("Application Ended"); + Logger.ApplicationEndDumpingAllApplicationErrors(); + Logger.ApplicationEnded(); } private void Application_Start(object sender, EventArgs eventArgs) { - Logger.InfoFormat(CultureInfo.InvariantCulture, "Application Starting ({0})", Globals.ElapsedSinceAppStart); // just to start the timer + Logger.ApplicationStarting(Globals.ElapsedSinceAppStart); // just to start the timer var name = Config.GetSetting("ServerName"); Globals.ServerName = string.IsNullOrEmpty(name) ? Dns.GetHostName() : name; - Logger.InfoFormat(CultureInfo.InvariantCulture, "Application Started ({0})", Globals.ElapsedSinceAppStart); // just to start the timer + Logger.ApplicationStarted(Globals.ElapsedSinceAppStart); // just to start the timer DotNetNukeShutdownOverload.InitializeFcnSettings(new ApplicationStatusInfo(new Application())); // register the assembly-lookup to correct the breaking rename in DNN 9.2 @@ -202,13 +202,13 @@ private void Application_Error(object sender, EventArgs eventArgs) if (HttpContext.Current != null) { // Get the exception object. - Logger.Trace("Dumping all Application Errors"); + Logger.ApplicationDumpingAllApplicationErrors(); foreach (Exception exc in HttpContext.Current.AllErrors) { - Logger.Fatal(exc); + Logger.ApplicationLogApplicationError(exc); } - Logger.Trace("End Dumping all Application Errors"); + Logger.ApplicationEndDumpingAllApplicationErrors(); } } diff --git a/DNN Platform/DotNetNuke.Web/Common/DotNetNukeShutdownOverload.cs b/DNN Platform/DotNetNuke.Web/Common/DotNetNukeShutdownOverload.cs index d3a91966e3d..981dd915355 100644 --- a/DNN Platform/DotNetNuke.Web/Common/DotNetNukeShutdownOverload.cs +++ b/DNN Platform/DotNetNuke.Web/Common/DotNetNukeShutdownOverload.cs @@ -18,7 +18,7 @@ namespace DotNetNuke.Web.Common.Internal using Microsoft.Extensions.Logging; /// Watches bin folder and root files and unloads the app domain proactively when they change. - internal static class DotNetNukeShutdownOverload + internal static partial class DotNetNukeShutdownOverload { private static readonly ILogger Logger = DnnLoggingController.GetLogger(typeof(DotNetNukeShutdownOverload)); @@ -42,7 +42,7 @@ internal static void InitializeFcnSettings(IApplicationStatusInfo appStatus) if (fileChangesMonitor == null) { - Logger.Info("fileChangesMonitor is null"); + Logger.ShutdownOverloadFileChangesMonitorIsNull(); ////AddSiteFilesMonitoring(true); } @@ -53,7 +53,7 @@ internal static void InitializeFcnSettings(IApplicationStatusInfo appStatus) .GetField("_FCNMode", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.IgnoreCase) .GetValue(fileChangesMonitor); - Logger.Info("FCNMode = " + fcnVal + " (Modes: NotSet/Default=0, Disabled=1, Single=2)"); + Logger.ShutdownOverloadFileChangeNotificationMode(fcnVal); var dirMonCompletion = typeof(HttpRuntime).Assembly.GetType("System.Web.DirMonCompletion"); var dirMonCount = (int)dirMonCompletion.InvokeMember( @@ -63,7 +63,7 @@ internal static void InitializeFcnSettings(IApplicationStatusInfo appStatus) null, null, CultureInfo.InvariantCulture); - Logger.Trace("DirMonCompletion count: " + dirMonCount); + Logger.ShutdownOverloadDirMonCompletionCount(dirMonCount); // enable our monitor only when fcnMode="Disabled" ////AddSiteFilesMonitoring(fcnVal.ToString() == "1"); @@ -74,7 +74,7 @@ internal static void InitializeFcnSettings(IApplicationStatusInfo appStatus) } catch (Exception e) { - Logger.Info(e); + Logger.ShutdownOverloadInitializeFcnSettingsException(e); } } @@ -111,11 +111,11 @@ private static void AddSiteFilesMonitoring(IApplicationStatusInfo appStatus, boo // begin watching; binOrRootWatcher.EnableRaisingEvents = true; - Logger.Trace("Added watcher for: " + binOrRootWatcher.Path + @"\" + binOrRootWatcher.Filter); + Logger.ShutdownOverloadAddedWatcherFor(binOrRootWatcher.Path, binOrRootWatcher.Filter); } catch (Exception ex) { - Logger.Trace("Error adding our own file monitoring object. " + ex); + Logger.ShutdownOverloadErrorAddingOurOwnFileMonitoringObject(ex); } } } @@ -136,11 +136,11 @@ private static void InitiateShutdown(object state) catch (Exception ex) { shutdownInprogress = false; - Logger.Error(ex); + Logger.ShutdownOverloadUnloadAppDomainException(ex); } } - private static void ShceduleShutdown() + private static void ScheduleShutdown() { // no need for locking; worst case is timer extended a bit more if (handleShutdowns && !shutdownInprogress) @@ -154,61 +154,61 @@ private static void ShceduleShutdown() private static void WatcherOnChanged(object sender, FileSystemEventArgs e) { - if (Logger.IsInfoEnabled && !e.FullPath.EndsWith(".log.resources", StringComparison.OrdinalIgnoreCase)) + if (!e.FullPath.EndsWith(".log.resources", StringComparison.OrdinalIgnoreCase)) { - Logger.Info($"Watcher Activity: {e.ChangeType}. Path: {e.FullPath}"); + Logger.ShutdownOverloadWatcherActivity(e.ChangeType, e.FullPath); } if (handleShutdowns && !shutdownInprogress && (e.FullPath ?? string.Empty).StartsWith(binFolder, StringComparison.OrdinalIgnoreCase)) { - ShceduleShutdown(); + ScheduleShutdown(); } } private static void WatcherOnCreated(object sender, FileSystemEventArgs e) { - if (Logger.IsInfoEnabled && !e.FullPath.EndsWith(".log.resources", StringComparison.OrdinalIgnoreCase)) + if (!e.FullPath.EndsWith(".log.resources", StringComparison.OrdinalIgnoreCase)) { - Logger.Info($"Watcher Activity: {e.ChangeType}. Path: {e.FullPath}"); + Logger.ShutdownOverloadWatcherActivity(e.ChangeType, e.FullPath); } if (handleShutdowns && !shutdownInprogress && (e.FullPath ?? string.Empty).StartsWith(binFolder, StringComparison.OrdinalIgnoreCase)) { - ShceduleShutdown(); + ScheduleShutdown(); } } private static void WatcherOnRenamed(object sender, RenamedEventArgs e) { - if (Logger.IsInfoEnabled && !e.FullPath.EndsWith(".log.resources", StringComparison.OrdinalIgnoreCase)) + if (!e.FullPath.EndsWith(".log.resources", StringComparison.OrdinalIgnoreCase)) { - Logger.Info($"Watcher Activity: {e.ChangeType}. New Path: {e.FullPath}. Old Path: {e.OldFullPath}"); + Logger.ShutdownOverloadWatcherRenamedActivity(e.ChangeType, e.FullPath, e.OldFullPath); } if (handleShutdowns && !shutdownInprogress && (e.FullPath ?? string.Empty).StartsWith(binFolder, StringComparison.OrdinalIgnoreCase)) { - ShceduleShutdown(); + ScheduleShutdown(); } } private static void WatcherOnDeleted(object sender, FileSystemEventArgs e) { - if (Logger.IsInfoEnabled && !e.FullPath.EndsWith(".log.resources", StringComparison.OrdinalIgnoreCase)) + if (!e.FullPath.EndsWith(".log.resources", StringComparison.OrdinalIgnoreCase)) { - Logger.Info($"Watcher Activity: {e.ChangeType}. Path: {e.FullPath}"); + Logger.ShutdownOverloadWatcherActivity(e.ChangeType, e.FullPath); } if (handleShutdowns && !shutdownInprogress && (e.FullPath ?? string.Empty).StartsWith(binFolder, StringComparison.OrdinalIgnoreCase)) { - ShceduleShutdown(); + ScheduleShutdown(); } } private static void WatcherOnError(object sender, ErrorEventArgs e) { - if (Logger.IsInfoEnabled) + if (Logger.IsEnabled(LogLevel.Information)) { - Logger.Info("Watcher Activity: N/A. Error: " + e.GetException()); + Logger.ShutdownOverloadWatcherError(e.GetException()); } } } diff --git a/DNN Platform/DotNetNuke.Web/DependencyInjection/BuildUpExtensions.cs b/DNN Platform/DotNetNuke.Web/DependencyInjection/BuildUpExtensions.cs index 07a0e63025d..8bfcb944efa 100644 --- a/DNN Platform/DotNetNuke.Web/DependencyInjection/BuildUpExtensions.cs +++ b/DNN Platform/DotNetNuke.Web/DependencyInjection/BuildUpExtensions.cs @@ -11,6 +11,7 @@ namespace DotNetNuke.DependencyInjection.Extensions using DotNetNuke.Common.Utilities; using DotNetNuke.Instrumentation; + using DotNetNuke.Web; using Microsoft.Extensions.Logging; @@ -41,7 +42,7 @@ internal static void BuildUp(this IServiceProvider container, IFilter filter) } catch (Exception exception) { - Logger.Error(exception); + Logger.BuildUpExtensionsSetValueException(exception); } } } diff --git a/DNN Platform/DotNetNuke.Web/DependencyInjectionInitialize.cs b/DNN Platform/DotNetNuke.Web/DependencyInjectionInitialize.cs index 71b4602d2e9..6bd6b3d996a 100644 --- a/DNN Platform/DotNetNuke.Web/DependencyInjectionInitialize.cs +++ b/DNN Platform/DotNetNuke.Web/DependencyInjectionInitialize.cs @@ -41,8 +41,7 @@ private static void ConfigureAllStartupServices(IServiceCollection services) if (allTypes.LoadExceptions.Any()) { var messageBuilder = allTypes.LoadExceptions.BuildLoaderExceptionsMessage(); - messageBuilder.Insert(0, "While loading IDnnStartup types, the following assemblies had types that could not be loaded. This is only an issue if these types contain DNN startup logic that could not be loaded:"); - Logger.Warn(messageBuilder.ToString()); + Logger.DependencyInjectionInitializeAssembliesCouldNotBeLoaded(messageBuilder.ToString()); } var startupTypes = allTypes.Types @@ -59,7 +58,7 @@ private static void ConfigureAllStartupServices(IServiceCollection services) } catch (Exception ex) { - Logger.Error($"Unable to configure services for {startup.GetType().FullName}, see exception for details", ex); + Logger.DependencyInjectionInitializeUnableToConfigureServicesFor(ex, startup.GetType().FullName); } } } @@ -72,7 +71,7 @@ private static IDnnStartup CreateInstance(Type startupType) } catch (Exception ex) { - Logger.Error($"Unable to instantiate startup code for {startupType.FullName}", ex); + Logger.DependencyInjectionInitializeUnableToInstantiateStartupCodeFor(ex, startupType.FullName); return null; } } diff --git a/DNN Platform/DotNetNuke.Web/InternalServices/ControlBarController.cs b/DNN Platform/DotNetNuke.Web/InternalServices/ControlBarController.cs index 6fb9b8b9db8..7db6c513887 100644 --- a/DNN Platform/DotNetNuke.Web/InternalServices/ControlBarController.cs +++ b/DNN Platform/DotNetNuke.Web/InternalServices/ControlBarController.cs @@ -266,7 +266,7 @@ public HttpResponseMessage AddModule(AddModuleDTO dto) } catch (Exception exc) { - Logger.Error(exc); + Logger.ControlBarControllerParseVisibilityException(exc); permissionType = 0; } @@ -283,7 +283,7 @@ public HttpResponseMessage AddModule(AddModuleDTO dto) } catch (Exception exc) { - Logger.Error(exc); + Logger.ControlBarControllerParseSortException(exc); } } @@ -309,7 +309,7 @@ public HttpResponseMessage AddModule(AddModuleDTO dto) } catch (Exception exc) { - Logger.Error(exc); + Logger.ControlBarControllerParseModuleIdException(exc); moduleLstId = -1; } @@ -327,7 +327,7 @@ public HttpResponseMessage AddModule(AddModuleDTO dto) } catch (Exception exc) { - Logger.Error(exc); + Logger.ControlBarControllerParsePageIdException(exc); pageId = -1; } @@ -346,7 +346,7 @@ public HttpResponseMessage AddModule(AddModuleDTO dto) } catch (Exception ex) { - Logger.Error(ex); + Logger.ControlBarControllerAddModuleException(ex); } } diff --git a/DNN Platform/DotNetNuke.Web/InternalServices/EventLogServiceController.cs b/DNN Platform/DotNetNuke.Web/InternalServices/EventLogServiceController.cs index 107991a255c..dcb0aea08e4 100644 --- a/DNN Platform/DotNetNuke.Web/InternalServices/EventLogServiceController.cs +++ b/DNN Platform/DotNetNuke.Web/InternalServices/EventLogServiceController.cs @@ -70,7 +70,7 @@ public HttpResponseMessage GetLogDetails(string guid) } catch (Exception ex) { - Logger.Error(ex); + Logger.EventLogServiceControllerGetLogDetailsException(ex); return this.Request.CreateResponse(HttpStatusCode.BadRequest); } } diff --git a/DNN Platform/DotNetNuke.Web/InternalServices/FileUploadController.cs b/DNN Platform/DotNetNuke.Web/InternalServices/FileUploadController.cs index 73ee60d1bca..07cc6a65adb 100644 --- a/DNN Platform/DotNetNuke.Web/InternalServices/FileUploadController.cs +++ b/DNN Platform/DotNetNuke.Web/InternalServices/FileUploadController.cs @@ -509,7 +509,7 @@ private static SavedFileDTO SaveFile( } catch (Exception ex) { - Logger.Error(ex); + Logger.FileUploadControllerSaveFileException(ex); errorMessage = ex.Message; return savedFileDto; } @@ -658,7 +658,7 @@ private static FileUploadDto UploadFile( } catch (ArgumentException exc) { - Logger.Warn("Unable to get image dimensions for image file", exc); + Logger.FileUploadControllerUnableToGetImageDimensions(exc); size = new Size(32, 32); } } @@ -687,7 +687,7 @@ private static FileUploadDto UploadFile( } catch (Exception exe) { - Logger.Error(exe); + Logger.FileUploadControllerUploadFileException(exe); result.Message = exe.Message; return result; } diff --git a/DNN Platform/DotNetNuke.Web/InternalServices/ItemListServiceController.cs b/DNN Platform/DotNetNuke.Web/InternalServices/ItemListServiceController.cs index 2d8bfadfc19..eb09ec8a54f 100644 --- a/DNN Platform/DotNetNuke.Web/InternalServices/ItemListServiceController.cs +++ b/DNN Platform/DotNetNuke.Web/InternalServices/ItemListServiceController.cs @@ -485,7 +485,7 @@ public HttpResponseMessage SearchUser(string q) } catch (Exception exc) { - Logger.Error(exc); + Logger.ItemListServiceControllerSearchUserException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } diff --git a/DNN Platform/DotNetNuke.Web/InternalServices/MessagingServiceController.cs b/DNN Platform/DotNetNuke.Web/InternalServices/MessagingServiceController.cs index 14003ca8383..64ccd7f71b3 100644 --- a/DNN Platform/DotNetNuke.Web/InternalServices/MessagingServiceController.cs +++ b/DNN Platform/DotNetNuke.Web/InternalServices/MessagingServiceController.cs @@ -67,7 +67,7 @@ public HttpResponseMessage WaitTimeForNextMessage() } catch (Exception exc) { - Logger.Error(exc); + Logger.MessagingServiceControllerWaitTimeForNextMessageException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -106,7 +106,7 @@ public HttpResponseMessage Create(CreateDTO postData) } catch (Exception exc) { - Logger.Error(exc); + Logger.MessagingServiceControllerCreateException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -157,7 +157,7 @@ public HttpResponseMessage Search(string q) } catch (Exception exc) { - Logger.Error(exc); + Logger.MessagingServiceControllerSearchException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } diff --git a/DNN Platform/DotNetNuke.Web/InternalServices/ModuleServiceController.cs b/DNN Platform/DotNetNuke.Web/InternalServices/ModuleServiceController.cs index c64701bc78d..68e513e9387 100644 --- a/DNN Platform/DotNetNuke.Web/InternalServices/ModuleServiceController.cs +++ b/DNN Platform/DotNetNuke.Web/InternalServices/ModuleServiceController.cs @@ -84,11 +84,11 @@ public HttpResponseMessage GetModuleShareable(int moduleId, int tabId, int porta if (desktopModule == null) { var message = $"Cannot find module ID {moduleId} (tab ID {tabId}, portal ID {portalId})"; - Logger.Error(message); + Logger.ModuleServiceControllerCannotFindModule(moduleId, tabId, portalId); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, message); } - return this.Request.CreateResponse(HttpStatusCode.OK, new { Shareable = desktopModule.Shareable.ToString(), RequiresWarning = requiresWarning }); + return this.Request.CreateResponse(HttpStatusCode.OK, new { Shareable = desktopModule.Shareable.ToString(), RequiresWarning = requiresWarning, }); } /// Moves a module. diff --git a/DNN Platform/DotNetNuke.Web/InternalServices/NotificationsServiceController.cs b/DNN Platform/DotNetNuke.Web/InternalServices/NotificationsServiceController.cs index 82ab0479dd0..c4153a3db3a 100644 --- a/DNN Platform/DotNetNuke.Web/InternalServices/NotificationsServiceController.cs +++ b/DNN Platform/DotNetNuke.Web/InternalServices/NotificationsServiceController.cs @@ -44,7 +44,7 @@ public HttpResponseMessage Dismiss(NotificationDTO postData) } catch (Exception exc) { - Logger.Error(exc); + Logger.NotificationsServiceControllerDismissException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } diff --git a/DNN Platform/DotNetNuke.Web/InternalServices/RelationshipServiceController.cs b/DNN Platform/DotNetNuke.Web/InternalServices/RelationshipServiceController.cs index b96a8a7beb1..a21bf313ddd 100644 --- a/DNN Platform/DotNetNuke.Web/InternalServices/RelationshipServiceController.cs +++ b/DNN Platform/DotNetNuke.Web/InternalServices/RelationshipServiceController.cs @@ -67,7 +67,7 @@ public HttpResponseMessage AcceptFriend(NotificationDTO postData) } catch (Exception exc) { - Logger.Error(exc); + Logger.RelationshipServiceControllerAcceptFriendException(exc); } if (success) @@ -117,7 +117,7 @@ public HttpResponseMessage FollowBack(NotificationDTO postData) } catch (UserRelationshipExistsException exc) { - Logger.Error(exc); + Logger.RelationshipServiceControllerFollowBackUserRelationshipExistsException(exc); var response = new { Message = Localization.GetExceptionMessage( @@ -128,7 +128,7 @@ public HttpResponseMessage FollowBack(NotificationDTO postData) } catch (Exception exc) { - Logger.Error(exc); + Logger.RelationshipServiceControllerFollowBackGeneralException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc.Message); } diff --git a/DNN Platform/DotNetNuke.Web/InternalServices/UserFileController.cs b/DNN Platform/DotNetNuke.Web/InternalServices/UserFileController.cs index db4cce0adf2..f1f74749879 100644 --- a/DNN Platform/DotNetNuke.Web/InternalServices/UserFileController.cs +++ b/DNN Platform/DotNetNuke.Web/InternalServices/UserFileController.cs @@ -71,7 +71,7 @@ public HttpResponseMessage GetItems(string fileExtensions) } catch (Exception exc) { - Logger.Error(exc); + Logger.UserFileControllerGetItemsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } diff --git a/DNN Platform/DotNetNuke.Web/LoggerMessages.cs b/DNN Platform/DotNetNuke.Web/LoggerMessages.cs new file mode 100644 index 00000000000..f2d7063b7cc --- /dev/null +++ b/DNN Platform/DotNetNuke.Web/LoggerMessages.cs @@ -0,0 +1,224 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace DotNetNuke.Web; + +using System; +using System.IO; + +using DotNetNuke.Entities.Users; + +using Microsoft.Extensions.Logging; + +/// Extension methods for for pre-defined logging messages. +/// The DotNetNuke.Web project has been assigned event IDs from 1,200,000 to 1,499,999. +internal static partial class LoggerMessages +{ + [LoggerMessage(EventId = 1_200_000, Message = "{Message}")] + public static partial void TraceWriterLogMessage(this ILogger logger, LogLevel logLevel, string message); + + [LoggerMessage(EventId = 1_200_100, Level = LogLevel.Information, Message = "Watcher Activity: {ChangeType}. Path: {FullPath}")] + public static partial void ShutdownOverloadWatcherActivity(this ILogger logger, WatcherChangeTypes changeType, string fullPath); + + [LoggerMessage(EventId = 1_200_101, Level = LogLevel.Information, Message = "Watcher Activity: {ChangeType}. New Path: {NewPath}. Old Path: {OldPath}")] + public static partial void ShutdownOverloadWatcherRenamedActivity(this ILogger logger, WatcherChangeTypes changeType, string newPath, string oldPath); + + [LoggerMessage(EventId = 1_200_102, Level = LogLevel.Information, Message = "Watcher Activity: N/A. Error:")] + public static partial void ShutdownOverloadWatcherError(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_200_103, Level = LogLevel.Information)] + public static partial void ShutdownOverloadInitializeFcnSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_200_104, Level = LogLevel.Information, Message = "fileChangesMonitor is null")] + public static partial void ShutdownOverloadFileChangesMonitorIsNull(this ILogger logger); + + [LoggerMessage(EventId = 1_200_105, Level = LogLevel.Information, Message = "FCNMode = {fcnMode} (Modes: NotSet/Default=0, Disabled=1, Single=2)")] + public static partial void ShutdownOverloadFileChangeNotificationMode(this ILogger logger, object fcnMode); + + [LoggerMessage(EventId = 1_200_106, Level = LogLevel.Trace, Message = "DirMonCompletion count: {Count}")] + public static partial void ShutdownOverloadDirMonCompletionCount(this ILogger logger, int count); + + [LoggerMessage(EventId = 1_200_107, Level = LogLevel.Trace, Message = @"Added watcher for: {WatcherPath}/{WatcherFilter}")] + public static partial void ShutdownOverloadAddedWatcherFor(this ILogger logger, string watcherPath, string watcherFilter); + + [LoggerMessage(EventId = 1_200_108, Level = LogLevel.Trace, Message = "Error adding our own file monitoring object.")] + public static partial void ShutdownOverloadErrorAddingOurOwnFileMonitoringObject(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_200_109, Level = LogLevel.Error)] + public static partial void ShutdownOverloadUnloadAppDomainException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_200_200, Level = LogLevel.Information, Message = "Application Starting ({ElapsedSinceAppStart})")] + public static partial void ApplicationStarting(this ILogger logger, TimeSpan elapsedSinceAppStart); + + [LoggerMessage(EventId = 1_200_201, Level = LogLevel.Information, Message = "Application Started ({ElapsedSinceAppStart})")] + public static partial void ApplicationStarted(this ILogger logger, TimeSpan elapsedSinceAppStart); + + [LoggerMessage(EventId = 1_200_202, Level = LogLevel.Information, Message = "Application Ending")] + public static partial void ApplicationEnding(this ILogger logger); + + [LoggerMessage(EventId = 1_200_203, Level = LogLevel.Information, Message = "Application Ended")] + public static partial void ApplicationEnded(this ILogger logger); + + [LoggerMessage(EventId = 1_200_204, Level = LogLevel.Trace, Message = "Disposing Lucene")] + public static partial void ApplicationDisposingLucene(this ILogger logger); + + [LoggerMessage(EventId = 1_200_205, Level = LogLevel.Trace, Message = "Dumping all Application Errors")] + public static partial void ApplicationDumpingAllApplicationErrors(this ILogger logger); + + [LoggerMessage(EventId = 1_200_206, Level = LogLevel.Trace, Message = "End Dumping all Application Errors")] + public static partial void ApplicationEndDumpingAllApplicationErrors(this ILogger logger); + + [LoggerMessage(EventId = 1_200_207, Level = LogLevel.Error)] + public static partial void ApplicationLogEndException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_200_208, Level = LogLevel.Error)] + public static partial void ApplicationStopSchedulerException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_200_209, Level = LogLevel.Critical)] + public static partial void ApplicationLogApplicationError(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_200_300, Level = LogLevel.Trace, Message = "Authorization header scheme in the request is not equal to {AuthScheme}")] + public static partial void ApiTokenControllerAuthorizationHeaderSchemeDoesNotMatchAuthScheme(this ILogger logger, string authScheme); + + [LoggerMessage(EventId = 1_200_301, Level = LogLevel.Trace, Message = "Missing authorization header value in the request")] + public static partial void ApiTokenControllerMissingAuthorizationHeaderValue(this ILogger logger); + + [LoggerMessage(EventId = 1_200_302, Level = LogLevel.Trace, Message = "Token expired")] + public static partial void ApiTokenControllerTokenExpired(this ILogger logger); + + [LoggerMessage(EventId = 1_200_303, Level = LogLevel.Trace, Message = "Invalid user")] + public static partial void ApiTokenControllerInvalidUser(this ILogger logger); + + [LoggerMessage(EventId = 1_200_304, Level = LogLevel.Trace, Message = "{SchemeType} is not registered/enabled in web.config file")] + public static partial void ApiTokenControllerSchemeIsNotEnabledInWebConfig(this ILogger logger, string schemeType); + + [LoggerMessage(EventId = 1_200_400, Level = LogLevel.Trace, Message = "Authenticated using API token {ApiTokenId}")] + public static partial void ApiTokenAuthMessageHandlerAuthenticatedUsingApiToken(this ILogger logger, int apiTokenId); + + [LoggerMessage(EventId = 1_200_401, Level = LogLevel.Error, Message = "Unexpected error authenticating API Token.")] + public static partial void ApiTokenAuthMessageHandlerUnexpectedErrorAuthenticatingApiToken(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_200_500, Level = LogLevel.Trace, Message = "{AuthScheme}: Validating request vs. SSL mode ({ForceSsl}) failed. ")] + public static partial void AuthMessageHandlerBaseValidatingRequestVsSslModeFailed(this ILogger logger, string authScheme, bool forceSsl); + + [LoggerMessage(EventId = 1_200_600, Level = LogLevel.Trace, Message = "Mapping route: {FullRouteName} @ {RouteUrl}")] + public static partial void ServicesRoutingManagerMappingRoute(this ILogger logger, string fullRouteName, string routeUrl); + + [LoggerMessage(EventId = 1_200_601, Level = LogLevel.Trace, Message = "Mapping route: {OldRouteName} @ {OldRouteUrl}")] + public static partial void ServicesRoutingManagerMappingOldRoute(this ILogger logger, string oldRouteName, string oldRouteUrl); + + [LoggerMessage(EventId = 1_200_602, Level = LogLevel.Trace, Message = "Registered a total of {Count} routes")] + public static partial void ServicesRoutingManagerRegisteredRoutes(this ILogger logger, int count); + + [LoggerMessage(EventId = 1_200_603, Level = LogLevel.Trace, Message = "The following handler is disabled {ClassName}")] + public static partial void ServicesRoutingManagerHandlerIsDisabled(this ILogger logger, string className); + + [LoggerMessage(EventId = 1_200_604, Level = LogLevel.Trace, Message = "The following handler scheme '{ClassName}' is already added and will be skipped")] + public static partial void ServicesRoutingManagerHandlerIsAlreadyAdded(this ILogger logger, string className); + + [LoggerMessage(EventId = 1_200_605, Level = LogLevel.Trace, Message = "Instantiated/Activated instance of {AuthScheme}, class: {ClassFullName}")] + public static partial void ServicesRoutingManagerHandlerIsActivated(this ILogger logger, string authScheme, string classFullName); + + [LoggerMessage(EventId = 1_200_606, Level = LogLevel.Error, Message = "{FullTypeName}.RegisterRoutes threw an exception.")] + public static partial void ServicesRoutingManagerRegisterRoutesThrewAnException(this ILogger logger, Exception exception, string fullTypeName); + + [LoggerMessage(EventId = 1_200_607, Level = LogLevel.Error, Message = "Unable to create {fullTypeName} while registering service routes.")] + public static partial void ServicesRoutingManagerUnableToCreateRouteMapper(this ILogger logger, Exception exception, string fullTypeName); + + [LoggerMessage(EventId = 1_200_608, Level = LogLevel.Error, Message = "Cannot instantiate/activate instance of {ClassName}")] + public static partial void ServicesRoutingManagerCannotInstantiateInstanceOf(this ILogger logger, Exception exception, string className); + + [LoggerMessage(EventId = 1_200_700, Level = LogLevel.Warning, Message = "The specified moniker ({Moniker}) is not defined in the system")] + public static partial void StandardTabAndModuleInfoProviderMonikerIsNotDefined(this ILogger logger, string moniker); + + [LoggerMessage(EventId = 1_200_800, Level = LogLevel.Warning, Message = "Unable to create thumbnail for {PhysicalPath}")] + public static partial void DnnFilePickerUnableToCreateThumbnail(this ILogger logger, string physicalPath); + + [LoggerMessage(EventId = 1_200_801, Level = LogLevel.Error)] + public static partial void DnnFilePickerAddFileException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_200_900, Level = LogLevel.Warning, Message = "Unable to get image dimensions for image file")] + public static partial void FileUploadControllerUnableToGetImageDimensions(this ILogger logger, ArgumentException exception); + + [LoggerMessage(EventId = 1_200_901, Level = LogLevel.Error)] + public static partial void FileUploadControllerSaveFileException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_200_902, Level = LogLevel.Error)] + public static partial void FileUploadControllerUploadFileException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_201_000, Level = LogLevel.Warning, Message = "While loading IDnnStartup types, the following assemblies had types that could not be loaded. This is only an issue if these types contain DNN startup logic that could not be loaded:\n{Message}")] + public static partial void DependencyInjectionInitializeAssembliesCouldNotBeLoaded(this ILogger logger, string message); + + [LoggerMessage(EventId = 1_201_001, Level = LogLevel.Error, Message = "Unable to configure services for {FullTypeName}, see exception for details")] + public static partial void DependencyInjectionInitializeUnableToConfigureServicesFor(this ILogger logger, Exception exception, string fullTypeName); + + [LoggerMessage(EventId = 1_201_001, Level = LogLevel.Error, Message = "Unable to instantiate startup code for {FullTypeName}")] + public static partial void DependencyInjectionInitializeUnableToInstantiateStartupCodeFor(this ILogger logger, Exception exception, string fullTypeName); + + [LoggerMessage(EventId = 1_201_100, Level = LogLevel.Error)] + public static partial void BuildUpExtensionsSetValueException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_201_200, Level = LogLevel.Error)] + public static partial void UserFileControllerGetItemsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_201_300, Level = LogLevel.Error)] + public static partial void ControlBarControllerParseVisibilityException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_201_301, Level = LogLevel.Error)] + public static partial void ControlBarControllerParseSortException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_201_302, Level = LogLevel.Error)] + public static partial void ControlBarControllerParseModuleIdException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_201_303, Level = LogLevel.Error)] + public static partial void ControlBarControllerParsePageIdException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_201_304, Level = LogLevel.Error)] + public static partial void ControlBarControllerAddModuleException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_201_400, Level = LogLevel.Error)] + public static partial void EventLogServiceControllerGetLogDetailsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_201_500, Level = LogLevel.Error)] + public static partial void MessagingServiceControllerWaitTimeForNextMessageException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_201_501, Level = LogLevel.Error)] + public static partial void MessagingServiceControllerCreateException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_201_502, Level = LogLevel.Error)] + public static partial void MessagingServiceControllerSearchException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_201_600, Level = LogLevel.Error)] + public static partial void NotificationsServiceControllerDismissException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_201_700, Level = LogLevel.Error)] + public static partial void RelationshipServiceControllerAcceptFriendException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_201_701, Level = LogLevel.Error)] + public static partial void RelationshipServiceControllerFollowBackUserRelationshipExistsException(this ILogger logger, UserRelationshipExistsException exception); + + [LoggerMessage(EventId = 1_201_702, Level = LogLevel.Error)] + public static partial void RelationshipServiceControllerFollowBackGeneralException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_201_800, Level = LogLevel.Error)] + public static partial void ItemListServiceControllerSearchUserException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_201_900, Level = LogLevel.Error)] + public static partial void RibbonBarManagerAddOrUpdateTabException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_202_000, Level = LogLevel.Error)] + public static partial void DateTimeEditControlDateValueException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_202_001, Level = LogLevel.Error)] + public static partial void DateTimeEditControlOldDateValueException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_203_000, Level = LogLevel.Error)] + public static partial void DateEditControlDateValueException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_203_001, Level = LogLevel.Error)] + public static partial void DateEditControlOldDateValueException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_203_100, Level = LogLevel.Error, Message = "Cannot find module ID {ModuleId} (tab ID {TabId}, portal ID {PortalId})")] + public static partial void ModuleServiceControllerCannotFindModule(this ILogger logger, int moduleId, int tabId, int portalId); +} diff --git a/DNN Platform/DotNetNuke.Web/UI/RibbonBarManager.cs b/DNN Platform/DotNetNuke.Web/UI/RibbonBarManager.cs index fffdb2505bd..0e6c05b9fe1 100644 --- a/DNN Platform/DotNetNuke.Web/UI/RibbonBarManager.cs +++ b/DNN Platform/DotNetNuke.Web/UI/RibbonBarManager.cs @@ -509,7 +509,7 @@ public static int SaveTabInfoObject(IBusinessControllerProvider businessControll } catch (Exception ex) { - Logger.Error(ex); + Logger.RibbonBarManagerAddOrUpdateTabException(ex); if (ex.Message.StartsWith("Page Exists", StringComparison.OrdinalIgnoreCase)) { diff --git a/DNN Platform/DotNetNuke.Web/UI/WebControls/DnnFilePicker.cs b/DNN Platform/DotNetNuke.Web/UI/WebControls/DnnFilePicker.cs index 23113a9934e..e62afecbc86 100644 --- a/DNN Platform/DotNetNuke.Web/UI/WebControls/DnnFilePicker.cs +++ b/DNN Platform/DotNetNuke.Web/UI/WebControls/DnnFilePicker.cs @@ -648,7 +648,7 @@ private void ShowImage() } catch (Exception) { - Logger.WarnFormat(CultureInfo.InvariantCulture, "Unable to create thumbnail for {0}", image.PhysicalPath); + Logger.DnnFilePickerUnableToCreateThumbnail(image.PhysicalPath); this.pnlRightDiv.Visible = false; } } @@ -743,7 +743,7 @@ private void SaveFile(object sender, EventArgs e) } catch (Exception ex) { - Logger.Error(ex); + Logger.DnnFilePickerAddFileException(ex); this.lblMessage.Text += "
" + string.Format(CultureInfo.CurrentCulture, Localization.GetString("SaveFileError"), fileName); } diff --git a/DNN Platform/DotNetNuke.Web/UI/WebControls/Internal/PropertyEditorControls/DateEditControl.cs b/DNN Platform/DotNetNuke.Web/UI/WebControls/Internal/PropertyEditorControls/DateEditControl.cs index 26bf0c3a868..e4712757186 100644 --- a/DNN Platform/DotNetNuke.Web/UI/WebControls/Internal/PropertyEditorControls/DateEditControl.cs +++ b/DNN Platform/DotNetNuke.Web/UI/WebControls/Internal/PropertyEditorControls/DateEditControl.cs @@ -56,7 +56,7 @@ protected DateTime DateValue } catch (Exception exc) { - Logger.Error(exc); + Logger.DateEditControlDateValueException(exc); } return dteValue; @@ -114,7 +114,7 @@ protected DateTime OldDateValue } catch (Exception exc) { - Logger.Error(exc); + Logger.DateEditControlOldDateValueException(exc); } return dteValue; diff --git a/DNN Platform/DotNetNuke.Web/UI/WebControls/Internal/PropertyEditorControls/DateTimeEditControl.cs b/DNN Platform/DotNetNuke.Web/UI/WebControls/Internal/PropertyEditorControls/DateTimeEditControl.cs index 9c5d916fa92..eff32e6e3ad 100644 --- a/DNN Platform/DotNetNuke.Web/UI/WebControls/Internal/PropertyEditorControls/DateTimeEditControl.cs +++ b/DNN Platform/DotNetNuke.Web/UI/WebControls/Internal/PropertyEditorControls/DateTimeEditControl.cs @@ -47,7 +47,7 @@ protected DateTime DateValue } catch (Exception exc) { - Logger.Error(exc); + Logger.DateTimeEditControlDateValueException(exc); } return dteValue; @@ -101,7 +101,7 @@ protected DateTime OldDateValue } catch (Exception exc) { - Logger.Error(exc); + Logger.DateTimeEditControlOldDateValueException(exc); } return dteValue; diff --git a/DNN Platform/HttpModules/Analytics/AnalyticsModule.cs b/DNN Platform/HttpModules/Analytics/AnalyticsModule.cs index fb3ad4aafc3..955aacdb0dd 100644 --- a/DNN Platform/HttpModules/Analytics/AnalyticsModule.cs +++ b/DNN Platform/HttpModules/Analytics/AnalyticsModule.cs @@ -98,7 +98,7 @@ private void OnPreRequestHandlerExecute(object sender, EventArgs e) log.AddProperty("Analytics.AnalyticsModule", "OnPreRequestHandlerExecute"); log.AddProperty("ExceptionMessage", ex.Message); this.eventLogger.AddLog(log); - Logger.Error(log); + Logger.AnalyticsModuleOnPreRequestHandlerExecuteException(ex, log); } } @@ -192,7 +192,7 @@ private void InitializeAnalyticsControls(Page page, bool injectTop) log.AddProperty("Analytics.AnalyticsModule", "OnPagePreRender"); log.AddProperty("ExceptionMessage", ex.Message); this.eventLogger.AddLog(log); - Logger.Error(ex); + Logger.AnalyticsModuleOnPagePreRenderException(ex); } } } diff --git a/DNN Platform/HttpModules/Analytics/Config/AnalyticsEngineConfiguration.cs b/DNN Platform/HttpModules/Analytics/Config/AnalyticsEngineConfiguration.cs index 1ca576a5afa..6619615387c 100644 --- a/DNN Platform/HttpModules/Analytics/Config/AnalyticsEngineConfiguration.cs +++ b/DNN Platform/HttpModules/Analytics/Config/AnalyticsEngineConfiguration.cs @@ -95,7 +95,7 @@ public static AnalyticsEngineConfiguration GetConfig(IApplicationStatusInfo appS log.AddProperty("ExceptionMessage", ex.Message); eventLogger.AddLog(log); - Logger.Error(log); + Logger.AnalyticsEngineConfigurationGetConfigException(ex, log); } return config; diff --git a/DNN Platform/HttpModules/Exception/ExceptionModule.cs b/DNN Platform/HttpModules/Exception/ExceptionModule.cs index 1762958298a..89c6f9dc4dc 100644 --- a/DNN Platform/HttpModules/Exception/ExceptionModule.cs +++ b/DNN Platform/HttpModules/Exception/ExceptionModule.cs @@ -71,14 +71,14 @@ public void OnErrorRequest(object s, EventArgs e) } catch (Exception ex) { - Logger.Error(ex); + Logger.ExceptionModuleAddLogException(ex); } } catch (Exception exc) { // it is possible when terminating the request for the context not to exist // in this case we just want to exit since there is nothing else we can do - Logger.Error(exc); + Logger.ExceptionModuleOnErrorRequestException(exc); } } } diff --git a/DNN Platform/HttpModules/LoggerMessages.cs b/DNN Platform/HttpModules/LoggerMessages.cs new file mode 100644 index 00000000000..78dbe440d17 --- /dev/null +++ b/DNN Platform/HttpModules/LoggerMessages.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace DotNetNuke.HttpModules; + +using System; + +using DotNetNuke.Services.Log.EventLog; + +using Microsoft.Extensions.Logging; + +/// Extension methods for for pre-defined logging messages. +/// The DotNetNuke.HttpModules project has been assigned event IDs from 2,000,000 to 2,099,999. +internal static partial class LoggerMessages +{ + [LoggerMessage(EventId = 2_000_000, Level = LogLevel.Error, Message = "{LogInfo}")] + public static partial void AnalyticsModuleOnPreRequestHandlerExecuteException(this ILogger logger, Exception exception, LogInfo logInfo); + + [LoggerMessage(EventId = 2_000_001, Level = LogLevel.Error)] + public static partial void AnalyticsModuleOnPagePreRenderException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 2_000_100, Level = LogLevel.Error, Message = "{LogInfo}")] + public static partial void AnalyticsEngineConfigurationGetConfigException(this ILogger logger, Exception exception, LogInfo logInfo); + + [LoggerMessage(EventId = 2_000_200, Level = LogLevel.Error)] + public static partial void ExceptionModuleAddLogException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 2_000_201, Level = LogLevel.Error)] + public static partial void ExceptionModuleOnErrorRequestException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 2_000_300, Level = LogLevel.Error)] + public static partial void BasicUrlRewriterPhysicalPathTooLong(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 2_000_301, Level = LogLevel.Error)] + public static partial void BasicUrlRewriterRewriteUrlException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 2_000_400, Level = LogLevel.Error)] + public static partial void MembershipModuleRequireLogoutException(this ILogger logger, Exception exception); +} diff --git a/DNN Platform/HttpModules/Membership/MembershipModule.cs b/DNN Platform/HttpModules/Membership/MembershipModule.cs index e20ccd63f2a..3cab631bb51 100644 --- a/DNN Platform/HttpModules/Membership/MembershipModule.cs +++ b/DNN Platform/HttpModules/Membership/MembershipModule.cs @@ -265,7 +265,7 @@ private static bool RequireLogout(IHostSettingsService hostSettingsService, Http } catch (Exception ex) { - Logger.Error(ex); + Logger.MembershipModuleRequireLogoutException(ex); return true; } } diff --git a/DNN Platform/HttpModules/UrlRewrite/BasicUrlRewriter.cs b/DNN Platform/HttpModules/UrlRewrite/BasicUrlRewriter.cs index f18c264f2d6..ba336756578 100644 --- a/DNN Platform/HttpModules/UrlRewrite/BasicUrlRewriter.cs +++ b/DNN Platform/HttpModules/UrlRewrite/BasicUrlRewriter.cs @@ -74,9 +74,9 @@ internal override void RewriteUrl(object sender, EventArgs e) // URL validation // check for ".." escape characters commonly used by hackers to traverse the folder tree on the server // the application should always use the exact relative location of the resource it is requesting - var strURL = request.Url.AbsolutePath; - var strDoubleDecodeURL = server.UrlDecode(server.UrlDecode(request.RawUrl)) ?? string.Empty; - if (Globals.FileEscapingRegex.IsMatch(strURL) || Globals.FileEscapingRegex.IsMatch(strDoubleDecodeURL)) + var strUrl = request.Url.AbsolutePath; + var strDoubleDecodeUrl = server.UrlDecode(server.UrlDecode(request.RawUrl)) ?? string.Empty; + if (Globals.FileEscapingRegex.IsMatch(strUrl) || Globals.FileEscapingRegex.IsMatch(strDoubleDecodeUrl)) { DotNetNuke.Services.Exceptions.Exceptions.ProcessHttpException(request); } @@ -94,11 +94,10 @@ internal override void RewriteUrl(object sender, EventArgs e) // DNN 5479 // request.physicalPath throws an exception when the path of the request exceeds 248 chars. // example to test: http://localhost/dotnetnuke_2/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/default.aspx - Logger.Error(exc); + Logger.BasicUrlRewriterPhysicalPathTooLong(exc); } - string domainName; - this.RewriteUrl(app, out domainName); + this.RewriteUrl(app, out var domainName); // blank DomainName indicates RewriteUrl couldn't locate a current portal // reprocess url for portal alias if auto add is an option @@ -194,19 +193,19 @@ internal override void RewriteUrl(object sender, EventArgs e) { if (app.Request.Url.AbsoluteUri.StartsWith("https://", StringComparison.OrdinalIgnoreCase)) { - strURL = "https://" + portalAliasInfo.HttpAlias.Replace("*.", string.Empty); + strUrl = "https://" + portalAliasInfo.HttpAlias.Replace("*.", string.Empty); } else { - strURL = "http://" + portalAliasInfo.HttpAlias.Replace("*.", string.Empty); + strUrl = "http://" + portalAliasInfo.HttpAlias.Replace("*.", string.Empty); } - if (!strURL.Contains(domainName, StringComparison.OrdinalIgnoreCase)) + if (!strUrl.Contains(domainName, StringComparison.OrdinalIgnoreCase)) { - strURL += app.Request.Url.PathAndQuery; + strUrl += app.Request.Url.PathAndQuery; } - response.Redirect(strURL, true); + response.Redirect(strUrl, true); } } } @@ -250,11 +249,11 @@ internal override void RewriteUrl(object sender, EventArgs e) catch (Exception ex) { // 500 Error - Redirect to ErrorPage - Logger.Error(ex); + Logger.BasicUrlRewriterRewriteUrlException(ex); - strURL = "~/ErrorPage.aspx?status=500&error=" + server.UrlEncode(ex.Message); + strUrl = "~/ErrorPage.aspx?status=500&error=" + server.UrlEncode(ex.Message); HttpContext.Current.Response.Clear(); - HttpContext.Current.Server.Transfer(strURL); + HttpContext.Current.Server.Transfer(strUrl); } if (portalId != -1) @@ -311,7 +310,7 @@ internal override void RewriteUrl(object sender, EventArgs e) if (request.Url.AbsolutePath.EndsWith(".aspx", StringComparison.InvariantCultureIgnoreCase)) { // request is for a standard page - strURL = string.Empty; + strUrl = string.Empty; switch (portalSettings.SSLSetup) { @@ -319,7 +318,7 @@ internal override void RewriteUrl(object sender, EventArgs e) if (!request.IsSecureConnection) { // switch to secure connection - strURL = requestedPath.Replace("http://", "https://"); + strUrl = requestedPath.Replace("http://", "https://"); } break; @@ -330,8 +329,8 @@ internal override void RewriteUrl(object sender, EventArgs e) !UrlUtils.IsSslOffloadEnabled(this.HostSettingsService, request)) { // switch to secure connection - strURL = requestedPath.Replace("http://", "https://"); - strURL = FormatDomain(strURL, portalSettings.STDURL, portalSettings.SSLURL); + strUrl = requestedPath.Replace("http://", "https://"); + strUrl = FormatDomain(strUrl, portalSettings.STDURL, portalSettings.SSLURL); } if (portalSettings.SSLEnforced) @@ -342,8 +341,8 @@ internal override void RewriteUrl(object sender, EventArgs e) // check if connection has already been forced to secure or else SSL offload is disabled if (request.QueryString["ssl"] == null) { - strURL = requestedPath.Replace("https://", "http://"); - strURL = FormatDomain(strURL, portalSettings.SSLURL, portalSettings.STDURL); + strUrl = requestedPath.Replace("https://", "http://"); + strUrl = FormatDomain(strUrl, portalSettings.SSLURL, portalSettings.STDURL); } } } @@ -352,12 +351,12 @@ internal override void RewriteUrl(object sender, EventArgs e) } // if a protocol switch is necessary - if (!string.IsNullOrEmpty(strURL)) + if (!string.IsNullOrEmpty(strUrl)) { - if (strURL.StartsWith("https://", StringComparison.InvariantCultureIgnoreCase)) + if (strUrl.StartsWith("https://", StringComparison.InvariantCultureIgnoreCase)) { // redirect to secure connection - response.RedirectPermanent(strURL); + response.RedirectPermanent(strUrl); } else { @@ -365,11 +364,11 @@ internal override void RewriteUrl(object sender, EventArgs e) response.Clear(); // add a refresh header to the response - response.AddHeader("Refresh", "0;URL=" + strURL); + response.AddHeader("Refresh", "0;URL=" + strUrl); // add the clientside javascript redirection script response.Write(""); - response.Write(""); response.Write(""); @@ -385,9 +384,9 @@ internal override void RewriteUrl(object sender, EventArgs e) // and all attempts to find another have failed // this should only happen if the HostPortal does not have any aliases // 404 Error - Redirect to ErrorPage - strURL = "~/ErrorPage.aspx?status=404&error=" + domainName; + strUrl = "~/ErrorPage.aspx?status=404&error=" + domainName; HttpContext.Current.Response.Clear(); - HttpContext.Current.Server.Transfer(strURL); + HttpContext.Current.Server.Transfer(strUrl); } if (app.Context.Items["FirstRequest"] != null) diff --git a/DNN Platform/Library/Application/ApplicationStatusInfo.cs b/DNN Platform/Library/Application/ApplicationStatusInfo.cs index ca70e220991..dc437d1ba99 100644 --- a/DNN Platform/Library/Application/ApplicationStatusInfo.cs +++ b/DNN Platform/Library/Application/ApplicationStatusInfo.cs @@ -17,7 +17,7 @@ namespace DotNetNuke.Application using Microsoft.Extensions.Logging; /// - public class ApplicationStatusInfo : IApplicationStatusInfo + public partial class ApplicationStatusInfo : IApplicationStatusInfo { private static readonly ILogger Logger = DnnLoggingController.GetLogger(); @@ -28,9 +28,7 @@ public class ApplicationStatusInfo : IApplicationStatusInfo /// Initializes a new instance of the class. /// The application info. - /// - /// This constructor is designed to be used with Dependency Injection. - /// + /// This constructor is designed to be used with Dependency Injection. public ApplicationStatusInfo(IApplicationInfo applicationInfo) { this.applicationInfo = applicationInfo; @@ -46,7 +44,7 @@ public UpgradeStatus Status return this.status; } - Logger.Trace("Getting application status"); + Logger.ApplicationStatusInfoGettingStatus(); var tempStatus = UpgradeStatus.None; // first call GetProviderPath - this insures that the Database is Initialised correctly @@ -62,7 +60,7 @@ public UpgradeStatus Status } catch (Exception ex) { - Logger.Error(ex); + Logger.ApplicationStatusInfoDatabaseVersionException(ex); strMessage = "ERROR:" + ex.Message; } } @@ -114,8 +112,8 @@ public UpgradeStatus Status this.status = tempStatus; - Logger.Trace($"result of getting providerpath: {strMessage}"); - Logger.Trace("Application status is " + this.status); + Logger.ApplicationStatusInfoResultOfGettingProviderPath(strMessage); + Logger.ApplicationStatusInfoStatusIs(this.status); return this.status; } diff --git a/DNN Platform/Library/Collections/CollectionExtensions.cs b/DNN Platform/Library/Collections/CollectionExtensions.cs index 2fda5baae44..1155791436e 100644 --- a/DNN Platform/Library/Collections/CollectionExtensions.cs +++ b/DNN Platform/Library/Collections/CollectionExtensions.cs @@ -758,7 +758,7 @@ public static T GetValueOrDefault(this IDictionary dictionary, string key, T } catch (Exception) { - Logger.Error($"Error loading portal setting: {key}:{dictionary[key]} Default value {defaultValue} was used instead"); + Logger.CollectionExtensionsErrorLoadingPortalSettingDefaultUsedInstead(key, dictionary[key], defaultValue); } return value; diff --git a/DNN Platform/Library/Common/Globals.cs b/DNN Platform/Library/Common/Globals.cs index 83fbab1f8e6..ccb381860d4 100644 --- a/DNN Platform/Library/Common/Globals.cs +++ b/DNN Platform/Library/Common/Globals.cs @@ -508,7 +508,7 @@ public static void Redirect(string url, bool endResponse) } catch (Exception ex) { - Logger.Error(ex); + Logger.GlobalsRedirectException(ex); } } @@ -1205,7 +1205,7 @@ public static int GetTotalRecords(ref IDataReader dr) } catch (Exception exc) { - Logger.Error(exc); + Logger.GlobalsGetTotalRecordsException(exc); total = -1; } } @@ -2914,7 +2914,7 @@ public static partial string DateToString(DateTime dateValue) } catch (Exception exc) { - Logger.Error(exc); + Logger.GlobalsDateToStringException(exc); return Null.NullString; } @@ -3260,7 +3260,7 @@ public static bool ValidateModuleInTab(int tabId, string moduleName) /// DeserializeHashTableBase64 deserializes a Hashtable using Binary Formatting. /// /// While this method of serializing is no longer supported (due to Medium Trust - /// issue, it is still required for upgrade purposes. + /// issue), it is still required for upgrade purposes. /// /// The String Source to deserialize. /// The deserialized Hashtable. @@ -3280,7 +3280,7 @@ public static partial Hashtable DeserializeHashTableBase64(string source) } catch (Exception exc) { - Logger.Error(exc); + Logger.GlobalsDeserializeHashTableBase64Exception(exc); objHashTable = new Hashtable(); } @@ -3296,7 +3296,7 @@ public static partial Hashtable DeserializeHashTableBase64(string source) return objHashTable; } - /// DeserializeHashTableXml deserializes a Hashtable using Xml Serialization. + /// DeserializeHashTableXml deserializes a Hashtable using XML Serialization. /// /// This is the preferred method of serialization under Medium Trust. /// @@ -3311,7 +3311,7 @@ public static partial Hashtable DeserializeHashTableXml(string source) /// SerializeHashTableBase64 serializes a Hashtable using Binary Formatting. /// /// While this method of serializing is no longer supported (due to Medium Trust - /// issue, it is still required for upgrade purposes. + /// issue), it is still required for upgrade purposes. /// /// The Hashtable to serialize. /// The serialized String. @@ -3330,7 +3330,7 @@ public static partial string SerializeHashTableBase64(Hashtable source) } catch (Exception exc) { - Logger.Error(exc); + Logger.GlobalsSerializeHashTableBase64Exception(exc); strString = string.Empty; } @@ -3347,7 +3347,7 @@ public static partial string SerializeHashTableBase64(Hashtable source) return strString; } - /// SerializeHashTableXml serializes a Hashtable using Xml Serialization. + /// SerializeHashTableXml serializes a Hashtable using XML Serialization. /// /// This is the preferred method of serialization under Medium Trust. /// @@ -3496,7 +3496,7 @@ public static partial ArrayList GetFileList( arrFileList.Add(new FileItem(string.Empty, "<" + Localization.GetString("None_Specified") + ">")); } - string file = null; + string file; string[] files = Directory.GetFiles(currentDirectory.FullName); foreach (string fileLoopVariable in files) { diff --git a/DNN Platform/Library/Common/Initialize.cs b/DNN Platform/Library/Common/Initialize.cs index 0d981db530a..f8fd4547009 100644 --- a/DNN Platform/Library/Common/Initialize.cs +++ b/DNN Platform/Library/Common/Initialize.cs @@ -32,7 +32,7 @@ namespace DotNetNuke.Common using SchedulerMode = DotNetNuke.Abstractions.Application.SchedulerMode; /// The Object to initialize application. - public class Initialize + public partial class Initialize { private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly object InitializeLock = new object(); @@ -153,7 +153,7 @@ public static void LogEnd() null, CultureInfo.InvariantCulture) is not HttpRuntime runtime) { - Logger.InfoFormat(CultureInfo.InvariantCulture, "Application shutting down. Reason: {0}", shutdownDetail); + Logger.InitializeApplicationShuttingDown(shutdownDetail); } else { @@ -173,9 +173,7 @@ public static void LogEnd() null, CultureInfo.InvariantCulture) as string; - Logger.Info("Application shutting down. Reason: " + shutdownDetail - + Environment.NewLine + "ASP.NET Shutdown Info: " + shutDownMessage - + Environment.NewLine + shutDownStack); + Logger.InitializeApplicationShuttingDownWithInfo(shutdownDetail, shutDownMessage, shutDownStack); } } catch (Exception exc) @@ -234,7 +232,7 @@ public static void RunSchedule(HttpRequest request) if (hostSettings.SchedulerMode == SchedulerMode.RequestMethod && SchedulingProvider.ReadyForPoll) { - Logger.Trace("Running Schedule " + hostSettings.SchedulerMode); + Logger.InitializeRunningSchedule(hostSettings.SchedulerMode); var scheduler = SchedulingProvider.Instance(); var requestScheduleThread = new Thread(scheduler.ExecuteTasks) { IsBackground = true }; requestScheduleThread.Start(); @@ -266,7 +264,7 @@ public static void StartScheduler(bool resetAppStartElapseTime = false) // instantiate APPLICATION_START scheduled jobs if (hostSettings.SchedulerMode == SchedulerMode.TimerMethod) { - Logger.Trace("Running Schedule " + hostSettings.SchedulerMode); + Logger.InitializeRunningSchedule(hostSettings.SchedulerMode); var newThread = new Thread(scheduler.Start) { IsBackground = true, @@ -304,7 +302,7 @@ private static string CheckVersion(HttpApplication app) { CreateUnderConstructionPage(server); retValue = "~/Install/UnderConstruction.htm"; - Logger.Info("UnderConstruction page was shown because application needs to be installed, and both the AutoUpgrade and UseWizard AppSettings in web.config are false. Use /install/install.aspx?mode=install to install application. "); + LoggerMessages.InitializeUnderConstructionPageShownBecauseInstallationNeeded(Logger); } break; @@ -317,7 +315,7 @@ private static string CheckVersion(HttpApplication app) { CreateUnderConstructionPage(server); retValue = "~/Install/UnderConstruction.htm"; - Logger.Info("UnderConstruction page was shown because application needs to be upgraded, and both the AutoUpgrade and UseInstallWizard AppSettings in web.config are false. Use /install/install.aspx?mode=upgrade to upgrade application. "); + LoggerMessages.InitializeUnderConstructionPageShownBecauseUpgradeNeeded(Logger); } break; @@ -332,7 +330,7 @@ private static string CheckVersion(HttpApplication app) // app has never been installed, and either Wizard or Autoupgrade is configured CreateUnderConstructionPage(server); retValue = "~/Install/UnderConstruction.htm"; - Logger.Error("UnderConstruction page was shown because we cannot ascertain the application was ever installed, and there is no working database connection. Check database connectivity before continuing. "); + Logger.InitializeUnderConstructionPageShownBecauseNoWorkingDatabaseConnection(); } else { @@ -341,11 +339,11 @@ private static string CheckVersion(HttpApplication app) { if (!isInstalled) { - Logger.Error("The connection to the database has failed, the application is not installed yet, and both AutoUpgrade and UseInstallWizard are not set in web.config, a 500 error page will be shown to visitors"); + Logger.InitializeConnectionToTheDatabaseHasFailedTheApplicationIsNotInstalledYetA500ErrorPageWillBeShown(); } else { - Logger.Error("The connection to the database has failed, however, the application is already completely installed, a 500 error page will be shown to visitors"); + Logger.InitializeConnectionToTheDatabaseHasFailedHoweverTheApplicationIsAlreadyCompletelyInstalledA500ErrorPageWillBeShown(); } string url = "~/ErrorPage.aspx?status=500&error=Site Unavailable&error2=Connection To The Database Failed"; @@ -434,7 +432,7 @@ private static string InitializeApp(HttpApplication app, ref bool initialized) { var request = app.Request; - Logger.Trace("Request " + request.Url.LocalPath); + Logger.InitializeRequest(request.Url.LocalPath); // Don't process some of the AppStart methods if we are installing if (IsUpgradeOrInstallRequest(app.Request)) @@ -454,7 +452,7 @@ private static string InitializeApp(HttpApplication app, ref bool initialized) return redirect; } - Logger.Info("Application Initializing"); + LoggerMessages.InitializeApplicationInitializing(Logger); // Set globals Globals.IISAppName = request.ServerVariables["APPL_MD_PATH"]; @@ -484,7 +482,7 @@ private static string InitializeApp(HttpApplication app, ref bool initialized) // Set Flag so we can determine the first Page Request after Application Start app.Context.Items.Add("FirstRequest", true); - Logger.Info("Application Initialized"); + LoggerMessages.InitializeApplicationInitialized(Logger); initialized = true; diff --git a/DNN Platform/Library/Common/Internal/EventHandlersContainer.cs b/DNN Platform/Library/Common/Internal/EventHandlersContainer.cs index a1deac919e9..b84d7f58ee6 100644 --- a/DNN Platform/Library/Common/Internal/EventHandlersContainer.cs +++ b/DNN Platform/Library/Common/Internal/EventHandlersContainer.cs @@ -39,7 +39,7 @@ public EventHandlersContainer() } catch (Exception ex) { - Logger.Error(ex.Message, ex); + Logger.EventHandlersContainerConstructorException(ex, ex.Message); } } diff --git a/DNN Platform/Library/Common/Internal/ServicesRoutingManager.cs b/DNN Platform/Library/Common/Internal/ServicesRoutingManager.cs index 51c41f60f23..f76dadca5bc 100644 --- a/DNN Platform/Library/Common/Internal/ServicesRoutingManager.cs +++ b/DNN Platform/Library/Common/Internal/ServicesRoutingManager.cs @@ -28,7 +28,7 @@ public static void RegisterServiceRoutes() } catch (Exception e) { - Logger.Error("Unable to register service routes", e); + Logger.ServicesRoutingManagerUnableToRegisterServiceRoutes(e); } } diff --git a/DNN Platform/Library/Common/Lists/ListInfoCollection.cs b/DNN Platform/Library/Common/Lists/ListInfoCollection.cs index 363ff7122aa..06de1463bd8 100644 --- a/DNN Platform/Library/Common/Lists/ListInfoCollection.cs +++ b/DNN Platform/Library/Common/Lists/ListInfoCollection.cs @@ -49,7 +49,7 @@ public void Add(string key, object value) } catch (Exception exc) { - Logger.Error(exc); + Logger.ListInfoCollectionAddException(exc); } } @@ -64,7 +64,7 @@ public object Item(int index) } catch (Exception exc) { - Logger.Error(exc); + Logger.ListInfoCollectionItemIndexException(exc); return null; } } @@ -86,7 +86,7 @@ public object Item(string key) } catch (Exception exc) { - Logger.Error(exc); + Logger.ListInfoCollectionItemKeyException(exc); return null; } } @@ -111,7 +111,7 @@ public object Item(string key, bool cache) } catch (Exception exc) { - Logger.Error(exc); + Logger.ListInfoCollectionItemKeyCacheException(exc); } // key will be in format Country.US:Region diff --git a/DNN Platform/Library/Common/Utilities/Config.cs b/DNN Platform/Library/Common/Utilities/Config.cs index e19d55f2f7e..20c19008b30 100644 --- a/DNN Platform/Library/Common/Utilities/Config.cs +++ b/DNN Platform/Library/Common/Utilities/Config.cs @@ -755,7 +755,7 @@ public static string Save(IApplicationStatusInfo appStatus, XmlDocument xmlDoc, { if (retry == 0) { - Logger.Error(exc); + Logger.ConfigSaveFileIOException(exc); retMsg = exc.Message; } @@ -770,7 +770,7 @@ public static string Save(IApplicationStatusInfo appStatus, XmlDocument xmlDoc, catch (Exception exc) { // the file permissions may not be set properly - Logger.Error(exc); + Logger.ConfigSaveFileException(exc); retMsg = exc.Message; } @@ -800,7 +800,7 @@ public static bool Touch(IApplicationStatusInfo appStatus) } catch (Exception exc) { - Logger.Error(exc); + Logger.ConfigTouchException(exc); return false; } } @@ -924,7 +924,7 @@ public static string UpdateMachineKey(IApplicationStatusInfo appStatus) } catch (Exception ex) { - Logger.Error(ex); + Logger.ConfigUpdateMachineKeyException(ex); strError += ex.Message; } @@ -982,7 +982,7 @@ public static string UpdateValidationKey(IApplicationStatusInfo appStatus) } catch (Exception ex) { - Logger.Error(ex); + Logger.ConfigUpdateValidationKeyException(ex); strError += ex.Message; } @@ -1105,7 +1105,7 @@ public static string UpdateInstallVersion(IApplicationStatusInfo appStatus, Vers } catch (Exception ex) { - Logger.Error(ex); + Logger.ConfigUpdateInstallVersionException(ex); strError += ex.Message; } @@ -1163,7 +1163,7 @@ public static string AddFCNMode(IApplicationStatusInfo appStatus, FcnMode fcnMod catch (Exception ex) { // in case of error installation shouldn't be stopped, log into log4net - Logger.Error(ex); + Logger.ConfigAddFcnModeException(ex); } return string.Empty; diff --git a/DNN Platform/Library/Common/Utilities/DataCache.cs b/DNN Platform/Library/Common/Utilities/DataCache.cs index ab3a495e3f2..d9d998f5089 100644 --- a/DNN Platform/Library/Common/Utilities/DataCache.cs +++ b/DNN Platform/Library/Common/Utilities/DataCache.cs @@ -596,7 +596,7 @@ internal static void ItemRemovedCallback(string key, object value, CacheItemRemo catch (Exception exc) { // Swallow exception - Logger.Error(exc); + Logger.DataCacheItemRemovedCallbackException(exc); } } diff --git a/DNN Platform/Library/Common/Utilities/FileSystemPermissionVerifier.cs b/DNN Platform/Library/Common/Utilities/FileSystemPermissionVerifier.cs index d8c64df531f..b690ecd3410 100644 --- a/DNN Platform/Library/Common/Utilities/FileSystemPermissionVerifier.cs +++ b/DNN Platform/Library/Common/Utilities/FileSystemPermissionVerifier.cs @@ -93,7 +93,7 @@ private bool VerifyFileCreate() } catch (Exception exc) { - Logger.Error(exc); + Logger.FileSystemPermissionVerifierFileCreateException(exc); verified = false; } @@ -113,7 +113,7 @@ private bool VerifyFileDelete() } catch (Exception exc) { - Logger.Error(exc); + Logger.FileSystemPermissionVerifierFileDeleteException(exc); verified = false; } @@ -133,7 +133,7 @@ private bool VerifyFolderCreate() } catch (Exception exc) { - Logger.Error(exc); + Logger.FileSystemPermissionVerifierFolderCreateException(exc); verified = false; } @@ -153,7 +153,7 @@ private bool VerifyFolderDelete() } catch (Exception exc) { - Logger.Error(exc); + Logger.FileSystemPermissionVerifierFolderDeleteException(exc); verified = false; } diff --git a/DNN Platform/Library/Common/Utilities/FileSystemUtils.cs b/DNN Platform/Library/Common/Utilities/FileSystemUtils.cs index 895bf66c02a..a382d0cb1ec 100644 --- a/DNN Platform/Library/Common/Utilities/FileSystemUtils.cs +++ b/DNN Platform/Library/Common/Utilities/FileSystemUtils.cs @@ -42,12 +42,7 @@ public static void AddToZip(ref ZipArchive zipFile, string filePath, string file var len = fs.Read(buffer, 0, buffer.Length); if (len != fs.Length) { - Logger.ErrorFormat( - CultureInfo.InvariantCulture, - "Reading from {0} didn't read all data in buffer. Requested to read {1} bytes, but was read {2} bytes", - filePath, - fs.Length, - len); + Logger.FileSystemUtilsAddToZipDidNotReadAllDataInBuffer(filePath, fs.Length, len); } // Create Zip Entry @@ -71,12 +66,7 @@ public static async Task AddToZipAsync(ZipArchive zipFile, string filePath, stri var len = await fs.ReadAsync(buffer, 0, buffer.Length, cancellationToken); if (len != fs.Length) { - Logger.ErrorFormat( - CultureInfo.InvariantCulture, - "Reading from {0} didn't read all data in buffer. Requested to read {1} bytes, but was read {2} bytes", - filePath, - fs.Length, - len); + Logger.FileSystemUtilsAddToZipDidNotReadAllDataInBuffer(filePath, fs.Length, len); } // Create Zip Entry @@ -147,11 +137,11 @@ public static bool DeleteFileWithWait(string fileName, short waitInMilliseconds, } catch (Exception exc) { - Logger.Error(exc); + Logger.FileSystemUtilsDeleteFileWithWaitException(exc); fileDeleted = false; } - if (fileDeleted == false) + if (!fileDeleted) { Thread.Sleep(waitInMilliseconds); } @@ -198,11 +188,11 @@ public static async Task DeleteFileWithWaitAsync(string fileName, short wa } catch (Exception exc) { - Logger.Error(exc); + Logger.FileSystemUtilsDeleteFileWithWaitException(exc); fileDeleted = false; } - if (fileDeleted == false) + if (!fileDeleted) { await Task.Delay(waitInMilliseconds, cancellationToken); } @@ -308,7 +298,7 @@ public static void UnzipResources(IEnumerable zipArchiveEntries } catch (Exception ex) { - Logger.Error(ex); + Logger.FileSystemUtilsUnzipResourcesException(ex); } } } @@ -372,7 +362,7 @@ public static async Task UnzipResourcesAsync(IEnumerable zipArc } catch (Exception ex) { - Logger.Error(ex); + Logger.FileSystemUtilsUnzipResourcesException(ex); } } } @@ -424,7 +414,7 @@ public static string DeleteFiles(IApplicationStatusInfo appStatus, Array arrPath } catch (Exception ex) { - Logger.Error(ex); + Logger.FileSystemUtilsDeleteFilesFolderException(ex); strExceptions += $"Processing folder ({strPath}) Error: {ex.Message}{Environment.NewLine}"; } } @@ -442,7 +432,7 @@ public static string DeleteFiles(IApplicationStatusInfo appStatus, Array arrPath } catch (Exception ex) { - Logger.Error(ex); + Logger.FileSystemUtilsDeleteFilesFileException(ex); strExceptions += $"Processing file ({strPath}) Error: {ex.Message}{Environment.NewLine}"; } } @@ -492,7 +482,7 @@ public static async Task DeleteFilesAsync(IApplicationStatusInfo appStat } catch (Exception ex) { - Logger.Error(ex); + Logger.FileSystemUtilsDeleteFilesFolderException(ex); strExceptions += $"Processing folder ({strPath}) Error: {ex.Message}{Environment.NewLine}"; } } @@ -510,7 +500,7 @@ public static async Task DeleteFilesAsync(IApplicationStatusInfo appStat } catch (Exception ex) { - Logger.Error(ex); + Logger.FileSystemUtilsDeleteFilesFileException(ex); strExceptions += $"Processing file ({strPath}) Error: {ex.Message}{Environment.NewLine}"; } } @@ -552,7 +542,7 @@ public static void DeleteFilesRecursive(string strRoot, string filter) } catch (Exception ex) { - Logger.Error(ex); + Logger.FileSystemUtilsDeleteFileException(ex); } } } @@ -595,7 +585,7 @@ public static async Task DeleteFilesRecursiveAsync(string strRoot, string filter } catch (Exception ex) { - Logger.Error(ex); + Logger.FileSystemUtilsDeleteFileException(ex); } } } @@ -607,7 +597,7 @@ public static void DeleteFolderRecursive(string strRoot) strRoot = FixPath(strRoot); if (string.IsNullOrEmpty(strRoot) || !Directory.Exists(strRoot)) { - Logger.Info($"{strRoot} does not exist. "); + Logger.FileSystemUtilsFolderDoesNotExist(strRoot); return; } @@ -624,8 +614,8 @@ public static void DeleteFolderRecursive(string strRoot) } catch (Exception ex) { - Logger.Info($"{strRoot} does not exist."); - Logger.Error(ex); + Logger.FileSystemUtilsFolderDoesNotExist(strRoot); + Logger.FileSystemUtilsDeleteFileException(ex); } } @@ -636,8 +626,8 @@ public static void DeleteFolderRecursive(string strRoot) } catch (Exception ex) { - Logger.Info($"{strRoot} does not exist."); - Logger.Error(ex); + Logger.FileSystemUtilsFolderDoesNotExist(strRoot); + Logger.FileSystemUtilsDeleteFolderException(ex); } } @@ -650,7 +640,7 @@ public static async Task DeleteFolderRecursiveAsync(string strRoot, Cancellation strRoot = FixPath(strRoot); if (string.IsNullOrEmpty(strRoot) || !await Directory.ExistsAsync(strRoot)) { - Logger.Info($"{strRoot} does not exist. "); + Logger.FileSystemUtilsFolderDoesNotExist(strRoot); return; } @@ -669,8 +659,8 @@ public static async Task DeleteFolderRecursiveAsync(string strRoot, Cancellation } catch (Exception ex) { - Logger.Info($"{strRoot} does not exist."); - Logger.Error(ex); + Logger.FileSystemUtilsFolderDoesNotExist(strRoot); + Logger.FileSystemUtilsDeleteFileException(ex); } } @@ -681,8 +671,8 @@ public static async Task DeleteFolderRecursiveAsync(string strRoot, Cancellation } catch (Exception ex) { - Logger.Info($"{strRoot} does not exist."); - Logger.Error(ex); + Logger.FileSystemUtilsFolderDoesNotExist(strRoot); + Logger.FileSystemUtilsDeleteFolderException(ex); } } @@ -692,7 +682,7 @@ public static void DeleteEmptyFoldersRecursive(string path) { if (string.IsNullOrWhiteSpace(path) || !Directory.Exists(path)) { - Logger.Info($"{path} does not exist."); + Logger.FileSystemUtilsFolderDoesNotExist(path); return; } @@ -716,7 +706,7 @@ public static void DeleteEmptyFoldersRecursive(string path) } catch (Exception ex) { - Logger.Error(ex); + Logger.FileSystemUtilsDeleteFolderException(ex); } } @@ -728,7 +718,7 @@ public static async Task DeleteEmptyFoldersRecursiveAsync(string path, Cancellat { if (string.IsNullOrWhiteSpace(path) || !await Directory.ExistsAsync(path)) { - Logger.Info($"{path} does not exist."); + Logger.FileSystemUtilsFolderDoesNotExist(path); return; } @@ -753,7 +743,7 @@ public static async Task DeleteEmptyFoldersRecursiveAsync(string path, Cancellat } catch (Exception ex) { - Logger.Error(ex); + Logger.FileSystemUtilsDeleteFolderException(ex); } } @@ -787,12 +777,7 @@ public static partial void AddToZip(ref ZipOutputStream zipFile, string filePath var len = fs.Read(buffer, 0, buffer.Length); if (len != fs.Length) { - Logger.ErrorFormat( - CultureInfo.InvariantCulture, - "Reading from {0} didn't read all data in buffer. Requested to read {1} bytes, but was read {2} bytes", - filePath, - fs.Length, - len); + Logger.FileSystemUtilsAddToZipDidNotReadAllDataInBuffer(filePath, fs.Length, len); } // Create Zip Entry @@ -872,7 +857,7 @@ public static partial void UnzipResources(ZipInputStream zipStream, string destP } catch (Exception ex) { - Logger.Error(ex); + Logger.FileSystemUtilsUnzipException(ex); } } diff --git a/DNN Platform/Library/Common/Utilities/RetryableAction.cs b/DNN Platform/Library/Common/Utilities/RetryableAction.cs index f43809659d9..a687d09a35e 100644 --- a/DNN Platform/Library/Common/Utilities/RetryableAction.cs +++ b/DNN Platform/Library/Common/Utilities/RetryableAction.cs @@ -16,7 +16,7 @@ namespace DotNetNuke.Common.Utilities.Internal /// Allows an action to be run and retried after a delay when an exception is thrown. /// If the action never succeeds the final exception will be re-thrown for the caller to catch. ///
- public class RetryableAction + public partial class RetryableAction { private static readonly ILogger Logger = DnnLoggingController.GetLogger(); @@ -100,10 +100,7 @@ public void TryIt() try { this.Action(); - if (Logger.IsTraceEnabled) - { - Logger.TraceFormat(CultureInfo.InvariantCulture, "Action succeeded - {0}", this.Description); - } + Logger.RetryableActionSucceeded(this.Description); return; } @@ -111,14 +108,11 @@ public void TryIt() { if (retriesRemaining <= 0) { - Logger.WarnFormat(CultureInfo.InvariantCulture, "All retries of action failed - {0}", this.Description); + Logger.RetryableActionAllRetriesFailed(this.Description); throw; } - if (Logger.IsTraceEnabled) - { - Logger.TraceFormat(CultureInfo.InvariantCulture, "Retrying action {0} - {1}", retriesRemaining, this.Description); - } + Logger.RetryableActionRetrying(retriesRemaining, this.Description); SleepAction.Invoke(currentDelay); diff --git a/DNN Platform/Library/ComponentModel/ComponentFactory.cs b/DNN Platform/Library/ComponentModel/ComponentFactory.cs index 1c6764115a3..033f6b53a84 100644 --- a/DNN Platform/Library/ComponentModel/ComponentFactory.cs +++ b/DNN Platform/Library/ComponentModel/ComponentFactory.cs @@ -206,7 +206,7 @@ private static void VerifyContainer() { if (Container == null) { - Logger.Warn("Container was null, instantiating SimpleContainer"); + Logger.ComponentFactoryInstantiatingSimpleContainer(); Container = new SimpleContainer(); } } diff --git a/DNN Platform/Library/ComponentModel/ContainerWithServiceProviderFallback.cs b/DNN Platform/Library/ComponentModel/ContainerWithServiceProviderFallback.cs index 0d376dd419e..c3475ee874d 100644 --- a/DNN Platform/Library/ComponentModel/ContainerWithServiceProviderFallback.cs +++ b/DNN Platform/Library/ComponentModel/ContainerWithServiceProviderFallback.cs @@ -120,15 +120,15 @@ public object GetComponent(string name) /// public TContract GetComponent() { - Logger.Trace($"Getting component for {typeof(TContract).FullName}"); + Logger.ContainerWithServiceProviderFallbackGettingComponent(typeof(TContract).FullName); var service = this.container.GetComponent(); if (service is not null) { - Logger.Trace($"Got component for {typeof(TContract).FullName} from container"); + Logger.ContainerWithServiceProviderFallbackGotComponentFromContainer(typeof(TContract).FullName); return service; } - Logger.Trace($"Getting component for {typeof(TContract).FullName} from service provider"); + Logger.ContainerWithServiceProviderFallbackGettingComponentFromServiceProvider(typeof(TContract).FullName); return this.serviceProvider.GetService(); } diff --git a/DNN Platform/Library/ComponentModel/ProviderInstaller.cs b/DNN Platform/Library/ComponentModel/ProviderInstaller.cs index eccb3fbddd8..3239f083575 100644 --- a/DNN Platform/Library/ComponentModel/ProviderInstaller.cs +++ b/DNN Platform/Library/ComponentModel/ProviderInstaller.cs @@ -97,7 +97,7 @@ private void InstallProvider(IContainer container, Provider provider) if (type == null) { - Logger.Error(new ConfigurationErrorsException($"Could not load provider {provider.Type}")); + Logger.ProviderInstallerCouldNotLoadProvider(new ConfigurationErrorsException($"Could not load provider {provider.Type}")); } else { diff --git a/DNN Platform/Library/Data/DataProvider.cs b/DNN Platform/Library/Data/DataProvider.cs index 1a66bc47a88..994309f19c6 100644 --- a/DNN Platform/Library/Data/DataProvider.cs +++ b/DNN Platform/Library/Data/DataProvider.cs @@ -2386,7 +2386,7 @@ public virtual int AddPropertyDefinition(int portalId, int moduleDefId, int data } catch (SqlException ex) { - Logger.Debug(ex); + Logger.DataProviderSqlExceptionFromAddPropertyDefinition(ex); // If not a duplicate (throw an Exception) retValue = -ex.Number; @@ -4079,7 +4079,7 @@ public void AddSearchDeletedItems(SearchDocumentToDelete deletedIDocument) } catch (SqlException ex) { - Logger.Error(ex); + Logger.DataProviderSqlExceptionFromAddSearchDeletedItems(ex); } } @@ -4091,7 +4091,7 @@ public void DeleteProcessedSearchDeletedItems(DateTime cutoffTime) } catch (SqlException ex) { - Logger.Error(ex); + Logger.DataProviderSqlExceptionFromDeleteProcessedSearchDeletedItems(ex); } } diff --git a/DNN Platform/Library/Data/PetaPoco/PetaPocoHelper.cs b/DNN Platform/Library/Data/PetaPoco/PetaPocoHelper.cs index 2c7ad961532..9a0975c0522 100644 --- a/DNN Platform/Library/Data/PetaPoco/PetaPocoHelper.cs +++ b/DNN Platform/Library/Data/PetaPoco/PetaPocoHelper.cs @@ -46,7 +46,7 @@ public static void ExecuteNonQuery(string connectionString, CommandType type, in } catch (Exception ex) { - Logger.Error("[1] Error executing SQL: " + sql + Environment.NewLine + ex.Message); + Logger.PetaPocoHelper1ErrorExecutingSql(ex, sql); throw; } } @@ -82,7 +82,7 @@ public static void BulkInsert(string connectionString, int timeoutSec, string pr } catch (Exception ex) { - Logger.Error("[2] Error executing SQL: " + cmd.CommandText + Environment.NewLine + ex.Message); + Logger.PetaPocoHelper2ErrorExecutingSql(ex, cmd.CommandText); throw; } @@ -124,9 +124,9 @@ public static void BulkInsert(string connectionString, string procedureName, str { cmd.ExecuteNonQuery(); } - catch (Exception) + catch (Exception ex) { - Logger.Error("[2] Error executing SQL: " + cmd.CommandText); + Logger.PetaPocoHelper2ErrorExecutingSql(ex, cmd.CommandText); throw; } @@ -163,7 +163,7 @@ public static IDataReader ExecuteReader(string connectionString, CommandType typ // very special case for installation if (!sql.EndsWith("GetDatabaseVersion", StringComparison.Ordinal)) { - Logger.Error("[3] Error executing SQL: " + sql + Environment.NewLine + ex.Message); + Logger.PetaPocoHelper3ErrorExecutingSql(ex, sql); } throw; @@ -195,7 +195,7 @@ public static T ExecuteScalar(string connectionString, CommandType type, int } catch (Exception ex) { - Logger.Error("[4] Error executing SQL: " + sql + Environment.NewLine + ex.Message); + Logger.PetaPocoHelper4ErrorExecutingSql(ex, sql); throw; } } @@ -223,7 +223,7 @@ public static void ExecuteSQL(string connectionString, string sql, int timeoutSe } catch (Exception ex) { - Logger.Error("[5] Error executing SQL: " + sql + Environment.NewLine + ex.Message); + Logger.PetaPocoHelper5ErrorExecutingSql(ex, sql); throw; } } diff --git a/DNN Platform/Library/Data/SqlDataProvider.cs b/DNN Platform/Library/Data/SqlDataProvider.cs index 1c6d0114c86..477ae007443 100644 --- a/DNN Platform/Library/Data/SqlDataProvider.cs +++ b/DNN Platform/Library/Data/SqlDataProvider.cs @@ -20,7 +20,8 @@ namespace DotNetNuke.Data using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; - public sealed class SqlDataProvider : DataProvider + /// A implementation for SQL Server. + public sealed partial class SqlDataProvider : DataProvider { private const string ScriptDelimiter = @"(?<=(?:[^\w]+|^))GO(?=(?: |\t)*?(?:\r?\n|$))"; private static readonly ILogger Logger = DnnLoggingController.GetLogger(); @@ -117,20 +118,20 @@ public override string ExecuteScript(string script, int timeoutSec) { string exceptions = ExecuteScriptInternal(this.UpgradeConnectionString, script, timeoutSec); - // if the upgrade connection string is specified or or db_owner setting is not set to dbo + // if the upgrade connection string is specified or db_owner setting is not set to dbo if (this.UpgradeConnectionString != this.ConnectionString || !this.DatabaseOwner.Trim().Equals("dbo.", StringComparison.OrdinalIgnoreCase)) { try { // grant execute rights to the public role or userid for all stored procedures. This is - // necesary because the UpgradeConnectionString will create stored procedures + // necessary because the UpgradeConnectionString will create stored procedures // which restrict execute permissions for the ConnectionString user account. This is also // necessary when db_owner is not set to "dbo" exceptions += this.GrantStoredProceduresPermission("EXECUTE", this.GetConnectionStringUserId()); } catch (SqlException objException) { - Logger.Error(objException); + Logger.SqlDataProviderGrantProcedureExecutePermissionException(objException); exceptions += objException + Environment.NewLine + Environment.NewLine + script + Environment.NewLine + Environment.NewLine; } @@ -139,14 +140,14 @@ public override string ExecuteScript(string script, int timeoutSec) { // grant execute or select rights to the public role or userid for all user defined functions based // on what type of function it is (scalar function or table function). This is - // necesary because the UpgradeConnectionString will create user defined functions + // necessary because the UpgradeConnectionString will create user defined functions // which restrict execute permissions for the ConnectionString user account. This is also // necessary when db_owner is not set to "dbo" exceptions += this.GrantUserDefinedFunctionsPermission("EXECUTE", "SELECT", this.GetConnectionStringUserId()); } catch (SqlException objException) { - Logger.Error(objException); + Logger.SqlDataProviderGrantFunctionExecutePermissionException(objException); exceptions += objException + Environment.NewLine + Environment.NewLine + script + Environment.NewLine + Environment.NewLine; } @@ -223,13 +224,13 @@ private static string ExecuteScriptInternal(string connectionString, string scri try { - Logger.Trace("Executing SQL Script " + sql); + Logger.SqlDataProviderExecutingSqlScript(sql); dbConnectionProvider.ExecuteNonQuery(connectionString, CommandType.Text, timeoutSec, sql); } catch (SqlException objException) { - Logger.Error(objException); + Logger.SqlDataProviderExecuteScriptException(objException); exceptions += objException + Environment.NewLine + Environment.NewLine + sql + Environment.NewLine + Environment.NewLine; } } @@ -261,12 +262,12 @@ private static IDataReader ExecuteSQLInternal(string connectionString, string sq catch (SqlException sqlException) { // error in SQL query - Logger.Error(sqlException); + Logger.SqlDataProviderExecuteSqlException(sqlException); errorMessage = sqlException.Message; } catch (Exception ex) { - Logger.Error(ex); + Logger.SqlDataProviderExecuteSqlGeneralException(ex); errorMessage = ex.ToString(); } @@ -395,7 +396,7 @@ private string ExecuteUpgradedConnectionQuery(string sql) } catch (SqlException objException) { - Logger.Error(objException); + Logger.SqlDataProviderExecuteUpgradedConnectionQueryException(objException); exceptions += objException + Environment.NewLine + Environment.NewLine + sql + Environment.NewLine + Environment.NewLine; } diff --git a/DNN Platform/Library/Entities/Content/AttachmentController.cs b/DNN Platform/Library/Entities/Content/AttachmentController.cs index ff6c9d614d1..a472f0ba082 100644 --- a/DNN Platform/Library/Entities/Content/AttachmentController.cs +++ b/DNN Platform/Library/Entities/Content/AttachmentController.cs @@ -130,7 +130,7 @@ internal static IEnumerable DeserializeFileInfo(string content) // On second thought, I don't know how much sense it makes to be throwing an exception here. If the file // has been deleted or is otherwise unavailable, there's really no reason we can't continue on handling the // ContentItem without its attachment. Better than the yellow screen of death? --cbond - Logger.WarnFormat(CultureInfo.InvariantCulture, "Unable to load file properties for File ID {0}", fileId); + Logger.AttachmentControllerUnableToLoadFileProperties(fileId); } if (fileInfo != null) diff --git a/DNN Platform/Library/Entities/Controllers/HostController.cs b/DNN Platform/Library/Entities/Controllers/HostController.cs index 5efaaff1bbb..cf88b92030b 100644 --- a/DNN Platform/Library/Entities/Controllers/HostController.cs +++ b/DNN Platform/Library/Entities/Controllers/HostController.cs @@ -83,7 +83,7 @@ public bool GetBoolean(string key, bool defaultValue) } catch (Exception exc) { - Logger.Error(exc); + Logger.HostControllerGetBooleanException(exc); // we just want to trap the error as we may not be installed so there will be no Settings } diff --git a/DNN Platform/Library/Entities/Host/ServerController.cs b/DNN Platform/Library/Entities/Host/ServerController.cs index 6a783dcd380..56e5b04c87f 100644 --- a/DNN Platform/Library/Entities/Host/ServerController.cs +++ b/DNN Platform/Library/Entities/Host/ServerController.cs @@ -77,9 +77,7 @@ public static List GetEnabledServersWithActivity(int lastMinutes = 1 .ToList(); } - /// - /// Gets the servers, that have no activtiy in the specified time frame. - /// + /// Gets the servers, that have no activity in the specified time frame. /// The number of recent minutes activity had to occur. /// A list of servers with no activity for the specified minutes. Defaults to 24 hours. public static List GetInActiveServers(int lastMinutes = 1440) @@ -98,7 +96,7 @@ public static string GetExecutingServerName() executingServerName += "-" + Globals.IISAppName; } - Logger.Debug("GetExecutingServerName:" + executingServerName); + Logger.ServerControllerGetExecutingServerName(executingServerName); return executingServerName; } @@ -110,7 +108,7 @@ public static string GetServerName(ServerInfo webServer) serverName += "-" + webServer.IISAppName; } - Logger.Debug("GetServerName:" + serverName); + Logger.ServerControllerGetServerName(serverName); return serverName; } @@ -196,17 +194,17 @@ private static string GetServerUrl() { try { - var adpapter = GetServerWebRequestAdapter(); - if (adpapter == null) + var adapter = GetServerWebRequestAdapter(); + if (adapter == null) { return string.Empty; } - return adpapter.GetServerUrl(); + return adapter.GetServerUrl(); } catch (Exception ex) { - Logger.Error(ex); + Logger.ServerControllerGetServerUrlException(ex); return string.Empty; } } @@ -215,17 +213,17 @@ private static string GetServerUniqueId() { try { - var adpapter = GetServerWebRequestAdapter(); - if (adpapter == null) + var adapter = GetServerWebRequestAdapter(); + if (adapter == null) { return string.Empty; } - return adpapter.GetServerUniqueId(); + return adapter.GetServerUniqueId(); } catch (Exception ex) { - Logger.Error(ex); + Logger.ServerControllerGetServerUniqueIdException(ex); return string.Empty; } } diff --git a/DNN Platform/Library/Entities/Icons/IconController.cs b/DNN Platform/Library/Entities/Icons/IconController.cs index 783f1b7fb2b..f6d8bf24094 100644 --- a/DNN Platform/Library/Entities/Icons/IconController.cs +++ b/DNN Platform/Library/Entities/Icons/IconController.cs @@ -140,7 +140,7 @@ private static void CheckIconOnDisk(IApplicationStatusInfo appStatus, string pat var iconPhysicalPath = Path.Combine(appStatus.ApplicationMapPath, path.Replace('/', '\\')); if (!File.Exists(iconPhysicalPath)) { - Logger.Warn($"Icon Not Present on Disk {iconPhysicalPath}"); + Logger.IconControllerIconNotPresentOnDisk(iconPhysicalPath); } } } diff --git a/DNN Platform/Library/Entities/Modules/DesktopModuleController.cs b/DNN Platform/Library/Entities/Modules/DesktopModuleController.cs index 89b4fa3caa8..c33ebd84069 100644 --- a/DNN Platform/Library/Entities/Modules/DesktopModuleController.cs +++ b/DNN Platform/Library/Entities/Modules/DesktopModuleController.cs @@ -126,7 +126,7 @@ public static DesktopModuleInfo GetDesktopModule(IHostSettings hostSettings, int if (module == null) { - Logger.WarnFormat(CultureInfo.InvariantCulture, "Unable to find module by module ID. ID:{0} PortalID:{1}", desktopModuleId, portalId); + Logger.DesktopModuleControllerUnableToFindModuleByModuleId(desktopModuleId, portalId); } return module; @@ -153,7 +153,7 @@ from kvp in GetDesktopModulesInternal(hostSettings, Null.NullInteger) if (desktopModuleByPackageId == null) { - Logger.WarnFormat(CultureInfo.InvariantCulture, "Unable to find module by package ID. ID:{0}", packageId); + Logger.DesktopModuleControllerUnableToFindModuleByPackageId(packageId); } return desktopModuleByPackageId; @@ -187,7 +187,7 @@ public static DesktopModuleInfo GetDesktopModuleByModuleName(IHostSettings hostS if (desktopModuleByModuleName == null) { - Logger.WarnFormat(CultureInfo.InvariantCulture, "Unable to find module by name. Name:{0} portalId:{1}", moduleName, portalId); + Logger.DesktopModuleControllerUnableToFindModuleByName(moduleName, portalId); } return desktopModuleByModuleName; @@ -229,7 +229,7 @@ public static DesktopModuleInfo GetDesktopModuleByFriendlyName(IHostSettings hos if (module == null) { - Logger.WarnFormat(CultureInfo.InvariantCulture, "Unable to find module by friendly name. Name:{0}", friendlyName); + Logger.DesktopModuleControllerUnableToFindModuleByFriendlyName(friendlyName); } return module; diff --git a/DNN Platform/Library/Entities/Modules/EventMessageProcessor.cs b/DNN Platform/Library/Entities/Modules/EventMessageProcessor.cs index c01ba23f452..0547c90b05a 100644 --- a/DNN Platform/Library/Entities/Modules/EventMessageProcessor.cs +++ b/DNN Platform/Library/Entities/Modules/EventMessageProcessor.cs @@ -96,7 +96,7 @@ public override bool ProcessMessage(EventMessage message) } catch (Exception ex) { - Logger.Error(ex); + Logger.EventMessageProcessorProcessMessageException(ex); message.ExceptionMessage = ex.Message; return false; } diff --git a/DNN Platform/Library/Entities/Modules/ModuleController.cs b/DNN Platform/Library/Entities/Modules/ModuleController.cs index 9a558d9ea4a..57d188ceaee 100644 --- a/DNN Platform/Library/Entities/Modules/ModuleController.cs +++ b/DNN Platform/Library/Entities/Modules/ModuleController.cs @@ -628,7 +628,7 @@ public void CopyModule(ModuleInfo sourceModule, TabInfo destinationTab, string t catch (Exception exc) { // module already in the page, ignore error - Logger.Error(exc); + Logger.ModuleControllerModuleAlreadyOnThePageException(exc); } this.ClearCache(sourceModule.TabID); @@ -1245,14 +1245,11 @@ public void LocalizeModule(ModuleInfo sourceModule, Locale locale) } catch (Exception ex) { - Logger.ErrorFormat(CultureInfo.InvariantCulture, "Error localizing module, moduleId: {0}, full exception: {1}", sourceModule.ModuleID, ex); + Logger.ModuleControllerErrorLocalizingModule(ex, sourceModule.ModuleID); } } - /// - /// MoveModule moves a Module from one Tab to another including all the - /// TabModule settings. - /// + /// MoveModule moves a Module from one Tab to another including all the TabModule settings. /// The ID of the module to move. /// The ID of the source tab. /// The ID of the destination tab. @@ -1786,7 +1783,7 @@ private static void AddContent(IBusinessControllerProvider businessControllerPro } catch (Exception exc) { - Logger.Error(exc); + Logger.ModuleControllerAddContentException(exc); } } diff --git a/DNN Platform/Library/Entities/Modules/ModuleInfo.cs b/DNN Platform/Library/Entities/Modules/ModuleInfo.cs index 7a24166e67b..b43dadd1783 100644 --- a/DNN Platform/Library/Entities/Modules/ModuleInfo.cs +++ b/DNN Platform/Library/Entities/Modules/ModuleInfo.cs @@ -616,7 +616,7 @@ public override void Fill(IDataReader dr) } catch (Exception exc) { - Logger.Error(exc); + Logger.ModuleInfoFillException(exc); } } diff --git a/DNN Platform/Library/Entities/Modules/PortalModuleBase.cs b/DNN Platform/Library/Entities/Modules/PortalModuleBase.cs index e023738f507..77dac02187b 100644 --- a/DNN Platform/Library/Entities/Modules/PortalModuleBase.cs +++ b/DNN Platform/Library/Entities/Modules/PortalModuleBase.cs @@ -324,31 +324,17 @@ protected virtual void Dispose(bool disposing) /// protected override void OnInit(EventArgs e) { - if (this.tracelLogger.IsDebugEnabled) - { - this.tracelLogger.Debug($"PortalModuleBase.OnInit Start (TabId:{this.PortalSettings.ActiveTab.TabID},ModuleId:{this.ModuleId}): {this.GetType()}"); - } - + this.tracelLogger.PortalModuleBaseOnInitStart(this.PortalSettings.ActiveTab.TabID, this.ModuleId, this.GetType()); base.OnInit(e); - if (this.tracelLogger.IsDebugEnabled) - { - this.tracelLogger.Debug($"PortalModuleBase.OnInit End (TabId:{this.PortalSettings.ActiveTab.TabID},ModuleId:{this.ModuleId}): {this.GetType()}"); - } + this.tracelLogger.PortalModuleBaseOnInitEnd(this.PortalSettings.ActiveTab.TabID, this.ModuleId, this.GetType()); } /// protected override void OnLoad(EventArgs e) { - if (this.tracelLogger.IsDebugEnabled) - { - this.tracelLogger.Debug($"PortalModuleBase.OnLoad Start (TabId:{this.PortalSettings.ActiveTab.TabID},ModuleId:{this.ModuleId}): {this.GetType()}"); - } - + this.tracelLogger.PortalModuleBaseOnLoadStart(this.PortalSettings.ActiveTab.TabID, this.ModuleId, this.GetType()); base.OnLoad(e); - if (this.tracelLogger.IsDebugEnabled) - { - this.tracelLogger.Debug($"PortalModuleBase.OnLoad End (TabId:{this.PortalSettings.ActiveTab.TabID},ModuleId:{this.ModuleId}): {this.GetType()}"); - } + this.tracelLogger.PortalModuleBaseOnLoadEnd(this.PortalSettings.ActiveTab.TabID, this.ModuleId, this.GetType()); } /// Helper method that can be used to add an ActionEventHandler to the Skin for this Module Control. @@ -356,10 +342,7 @@ protected override void OnLoad(EventArgs e) protected void AddActionHandler(ActionEventHandler e) { UI.Skins.Skin parentSkin = UI.Skins.Skin.GetParentSkin(this); - if (parentSkin != null) - { - parentSkin.RegisterModuleActionEvent(this.ModuleId, e); - } + parentSkin?.RegisterModuleActionEvent(this.ModuleId, e); } /// diff --git a/DNN Platform/Library/Entities/Modules/Prompt/AddModule.cs b/DNN Platform/Library/Entities/Modules/Prompt/AddModule.cs index c0d0271beee..2949b85c5c4 100644 --- a/DNN Platform/Library/Entities/Modules/Prompt/AddModule.cs +++ b/DNN Platform/Library/Entities/Modules/Prompt/AddModule.cs @@ -150,7 +150,7 @@ public override IConsoleResultModel Run() } catch (Exception ex) { - Logger.Error(ex); + Logger.AddModuleRunException(ex); return new ConsoleErrorResultModel(this.LocalizeString("Prompt_AddModuleError")); } } diff --git a/DNN Platform/Library/Entities/Portals/PortalController.cs b/DNN Platform/Library/Entities/Portals/PortalController.cs index f5a7a5ae8c7..ada8321cbf1 100644 --- a/DNN Platform/Library/Entities/Portals/PortalController.cs +++ b/DNN Platform/Library/Entities/Portals/PortalController.cs @@ -176,7 +176,7 @@ public static string CreateChildPortalFolder(string childPath) } catch (Exception exc) { - Logger.Error(exc); + Logger.PortalControllerCreateChildPortalFolderException(exc); message += Localization.GetString("ChildPortal.Error") + exc.Message + exc.StackTrace; } @@ -662,7 +662,7 @@ public static string GetPortalSetting(IPortalController portalController, string } catch (Exception exc) { - Logger.Error(exc); + Logger.PortalControllerGetPortalSettingException(exc); } return retValue; @@ -699,7 +699,7 @@ public static string GetPortalSetting(IPortalController portalController, string } catch (Exception exc) { - Logger.Error(exc); + Logger.PortalControllerGetPortalSettingException(exc); } return Null.NullString; @@ -741,7 +741,7 @@ public static bool GetPortalSettingAsBoolean(IPortalController portalController, } catch (Exception exc) { - Logger.Error(exc); + Logger.PortalControllerGetPortalSettingAsBooleanException(exc); } return retValue; @@ -792,7 +792,7 @@ public static bool GetPortalSettingAsBoolean(IHostSettings hostSettings, IApplic } catch (Exception exc) { - Logger.Error(exc); + Logger.PortalControllerGetPortalSettingAsBooleanException(exc); } return retValue; @@ -834,7 +834,7 @@ public static int GetPortalSettingAsInteger(IPortalController portalController, } catch (Exception exc) { - Logger.Error(exc); + Logger.PortalControllerGetPortalSettingAsIntegerException(exc); } return retValue; @@ -876,7 +876,7 @@ public static double GetPortalSettingAsDouble(IPortalController portalController } catch (Exception exc) { - Logger.Error(exc); + Logger.PortalControllerGetPortalSettingAsDoubleException(exc); } return retValue; @@ -923,7 +923,7 @@ public static int GetPortalSettingAsInteger(IHostSettings hostSettings, IApplica } catch (Exception exc) { - Logger.Error(exc); + Logger.PortalControllerGetPortalSettingAsIntegerException(exc); } return retValue; @@ -1393,7 +1393,7 @@ public int CreatePortal(string portalName, int adminUserId, string description, } catch (Exception exc) { - Logger.Error(exc); + Logger.PortalControllerGetAdminUserException(exc); } if (administratorId > 0) @@ -1473,7 +1473,7 @@ public int CreatePortal(string portalName, UserInfo adminUser, string descriptio } catch (Exception exc) { - Logger.Error(exc); + Logger.PortalControllerCreateAdminUserException(exc); message += Localization.GetString("CreateAdminUser.Error") + exc.Message + exc.StackTrace; } @@ -1883,7 +1883,7 @@ public void ProcessResourceFileExplicit(string portalPath, string resoureceFile) } catch (Exception exc) { - Logger.Error(exc); + Logger.PortalControllerProcessResourceFileExplicitException(exc); } } @@ -2182,7 +2182,7 @@ private static void DeletePortalInternal(int portalId) } catch (Exception exc) { - Logger.Error(exc); + Logger.PortalControllerLogDeletePortalException(exc); } DataCache.ClearHostCache(true); @@ -2355,7 +2355,7 @@ private static bool EnableBrowserLanguageInDefault(IHostSettings hostSettings, I } catch (Exception exc) { - Logger.Error(exc); + Logger.PortalControllerEnableBrowserLanguageInDefaultException(exc); } return retValue; @@ -2528,7 +2528,7 @@ private void CreatePortalInternal(int portalId, string portalName, UserInfo admi } catch (Exception exc1) { - Logger.Error(exc1); + Logger.PortalControllerDeleteHomeDirectoryException(exc1); message += Localization.GetString("DeleteUploadFolder.Error") + exc1.Message + exc1.StackTrace; } @@ -2577,7 +2577,7 @@ private void CreatePortalInternal(int portalId, string portalName, UserInfo admi } catch (Exception exc1) { - Logger.Error(exc1); + Logger.PortalControllerCreateChildPortalFilesException(exc1); message += Localization.GetString("ChildPortal.Error") + exc1.Message + exc1.StackTrace; } } @@ -2594,7 +2594,7 @@ private void CreatePortalInternal(int portalId, string portalName, UserInfo admi } catch (Exception exc1) { - Logger.Error(exc1); + Logger.PortalControllerAddDefaultFolderTypesException(exc1); message += Localization.GetString("DefaultFolderMappings.Error") + exc1.Message + exc1.StackTrace; } } @@ -2613,7 +2613,7 @@ private void CreatePortalInternal(int portalId, string portalName, UserInfo admi } catch (Exception exc1) { - Logger.Error(exc1); + Logger.PortalControllerApplyPortalTemplateException(exc1); message += Localization.GetString("PortalTemplate.Error") + exc1.Message + exc1.StackTrace; } } @@ -2668,7 +2668,7 @@ private void CreatePortalInternal(int portalId, string portalName, UserInfo admi } catch (Exception exc1) { - Logger.Error(exc1); + Logger.PortalControllerCreateDefaultRelationshipsException(exc1); } // add profanity list to new portal @@ -2686,7 +2686,7 @@ private void CreatePortalInternal(int portalId, string portalName, UserInfo admi } catch (Exception exc1) { - Logger.Error(exc1); + Logger.PortalControllerCreateProfanityListException(exc1); } // add banned password list to new portal @@ -2704,7 +2704,7 @@ private void CreatePortalInternal(int portalId, string portalName, UserInfo admi } catch (Exception exc1) { - Logger.Error(exc1); + Logger.PortalControllerCreateBannedPasswordsListException(exc1); } ServicesRoutingManager.ReRegisterServiceRoutesWhileSiteIsRunning(); @@ -2734,7 +2734,7 @@ private void CreatePortalInternal(int portalId, string portalName, UserInfo admi } catch (Exception exc) { - Logger.Error(exc); + Logger.PortalControllerLogCreatePortalException(exc); } EventManager.Instance.OnPortalCreated(new PortalCreatedEventArgs { PortalId = portalId }); @@ -2759,7 +2759,7 @@ private void CreatePredefinedFolderTypes(int portalId) } catch (Exception ex) { - Logger.Error(Localization.GetString("CreatingConfiguredFolderMapping.Error"), ex); + Logger.PortalControllerEnsureRequiredProvidersForFolderTypesException(ex, Localization.GetString("CreatingConfiguredFolderMapping.Error")); } var webConfig = Config.Load(); @@ -2774,7 +2774,7 @@ private void CreatePredefinedFolderTypes(int portalId) } catch (Exception ex) { - Logger.Error(Localization.GetString("CreatingConfiguredFolderMapping.Error") + ": " + folderTypeConfig.Name, ex); + Logger.PortalControllerAddFolderMappingException(ex, Localization.GetString("CreatingConfiguredFolderMapping.Error"), folderTypeConfig.Name); } } } @@ -2976,7 +2976,7 @@ private void LoadDescriptionFromTemplateFile() } catch (Exception e) { - Logger.Error("Error while parsing: " + this.TemplateFilePath, e); + Logger.PortalControllerErrorWhileParsing(e, this.TemplateFilePath); } } @@ -2994,7 +2994,7 @@ private void LoadNameAndDescriptionFromLanguageFile() } catch (Exception e) { - Logger.Error("Error while parsing: " + this.TemplateFilePath, e); + Logger.PortalControllerErrorWhileParsing(e, this.TemplateFilePath); } } diff --git a/DNN Platform/Library/Entities/Portals/PortalGroupController.cs b/DNN Platform/Library/Entities/Portals/PortalGroupController.cs index 94f1bab1577..092932b7758 100644 --- a/DNN Platform/Library/Entities/Portals/PortalGroupController.cs +++ b/DNN Platform/Library/Entities/Portals/PortalGroupController.cs @@ -393,7 +393,7 @@ private static void LogEvent(string eventType, PortalGroupInfo portalGroup, IPor } catch (Exception exc) { - Logger.Error(exc); + Logger.PortalGroupControllerLogEventException(exc); } } diff --git a/DNN Platform/Library/Entities/Portals/Templates/PortalTemplateImporter.cs b/DNN Platform/Library/Entities/Portals/Templates/PortalTemplateImporter.cs index 99f4ccebb9e..fb361d9fe0b 100644 --- a/DNN Platform/Library/Entities/Portals/Templates/PortalTemplateImporter.cs +++ b/DNN Platform/Library/Entities/Portals/Templates/PortalTemplateImporter.cs @@ -284,7 +284,7 @@ internal void ParseTemplateInternal(int portalId, int administratorId, PortalTem } catch (Exception ex) { - Logger.Error(ex); + Logger.PortalTemplateImporterParseTemplateException(ex); } } @@ -612,7 +612,7 @@ private void ParseFiles(XmlNodeList nodeFiles, int portalId, FolderInfo folder) catch (InvalidFileExtensionException ex) { // when the file is not allowed, we should not break parse process, but just log the error. - Logger.Error(ex.Message); + Logger.PortalTemplateImporterParseFilesInvalidFileExtensionException(ex, ex.Message); } } } @@ -750,7 +750,7 @@ private void ParseFolders(XmlNode nodeFolders, int portalId) } catch (Exception ex) { - Logger.Error(ex); + Logger.PortalTemplateImporterGetFolderMappingException(ex); folderMapping = folderMappingController.GetDefaultFolderMapping(portalId); } @@ -763,7 +763,7 @@ private void ParseFolders(XmlNode nodeFolders, int portalId) } catch (Exception ex) { - Logger.Error(ex); + Logger.PortalTemplateImporterAddFolderException(ex); // Retry with default folderMapping var defaultFolderMapping = folderMappingController.GetDefaultFolderMapping(portalId); diff --git a/DNN Platform/Library/Entities/Portals/Templates/PortalTemplateInfo.cs b/DNN Platform/Library/Entities/Portals/Templates/PortalTemplateInfo.cs index 8d118bff790..f1673210312 100644 --- a/DNN Platform/Library/Entities/Portals/Templates/PortalTemplateInfo.cs +++ b/DNN Platform/Library/Entities/Portals/Templates/PortalTemplateInfo.cs @@ -97,7 +97,7 @@ private void LoadDescriptionFromTemplateFile() } catch (Exception e) { - Logger.Error("Error while parsing: " + this.TemplateFilePath, e); + Logger.PortalTemplateInfoErrorWhileParsing(e, this.TemplateFilePath); } } @@ -105,17 +105,15 @@ private void LoadNameAndDescriptionFromLanguageFile() { try { - using (var reader = PortalTemplateIO.Instance.OpenTextReader(this.LanguageFilePath)) - { - var xmlDoc = XDocument.Load(reader); + using var reader = PortalTemplateIO.Instance.OpenTextReader(this.LanguageFilePath); + var xmlDoc = XDocument.Load(reader); - this.Name = ReadLanguageFileValue(xmlDoc, "LocalizedTemplateName.Text"); - this.Description = ReadLanguageFileValue(xmlDoc, "PortalDescription.Text"); - } + this.Name = ReadLanguageFileValue(xmlDoc, "LocalizedTemplateName.Text"); + this.Description = ReadLanguageFileValue(xmlDoc, "PortalDescription.Text"); } catch (Exception e) { - Logger.Error("Error while parsing: " + this.TemplateFilePath, e); + Logger.PortalTemplateInfoErrorWhileParsing(e, this.TemplateFilePath); } } diff --git a/DNN Platform/Library/Entities/Profile/ProfileController.cs b/DNN Platform/Library/Entities/Profile/ProfileController.cs index f0a844aeae2..e6b9d836bf8 100644 --- a/DNN Platform/Library/Entities/Profile/ProfileController.cs +++ b/DNN Platform/Library/Entities/Profile/ProfileController.cs @@ -631,7 +631,7 @@ public static UserInfo UpdateUserProfile(IPortalController portalController, IAp } catch (Exception ex) { - Logger.Error(ex); + Logger.ProfileControllerCreateThumbnailsException(ex); } } @@ -756,7 +756,7 @@ private static ProfilePropertyDefinition FillPropertyDefinitionInfo(IDataReader } catch (Exception ex) { - Logger.Error(ex); + Logger.ProfileControllerFillPropertyDefinitionInfoException(ex); } finally { @@ -768,8 +768,6 @@ private static ProfilePropertyDefinition FillPropertyDefinitionInfo(IDataReader private static ProfilePropertyDefinition FillPropertyDefinitionInfo(IDataReader dr, bool checkForOpenDataReader) { - ProfilePropertyDefinition definition; - // read datareader var canContinue = true; if (checkForOpenDataReader) @@ -784,7 +782,7 @@ private static ProfilePropertyDefinition FillPropertyDefinitionInfo(IDataReader var portalId = 0; portalId = Convert.ToInt32(Null.SetNull(dr["PortalId"], portalId), CultureInfo.InvariantCulture); - definition = new ProfilePropertyDefinition(portalId); + var definition = new ProfilePropertyDefinition(portalId); definition.PropertyDefinitionId = Convert.ToInt32(Null.SetNull(dr["PropertyDefinitionId"], definition.PropertyDefinitionId), CultureInfo.InvariantCulture); definition.ModuleDefId = Convert.ToInt32(Null.SetNull(dr["ModuleDefId"], definition.ModuleDefId), CultureInfo.InvariantCulture); definition.DataType = Convert.ToInt32(Null.SetNull(dr["DataType"], definition.DataType), CultureInfo.InvariantCulture); diff --git a/DNN Platform/Library/Entities/Tabs/TabController.cs b/DNN Platform/Library/Entities/Tabs/TabController.cs index 0c78c553eb5..14536ecc8f7 100644 --- a/DNN Platform/Library/Entities/Tabs/TabController.cs +++ b/DNN Platform/Library/Entities/Tabs/TabController.cs @@ -1480,7 +1480,7 @@ public TabInfo GetTab(int tabId, int portalId, bool ignoreCache) if (tabId <= 0) { - Logger.WarnFormat(CultureInfo.InvariantCulture, "Invalid tabId {0} of portal {1}", tabId, portalId); + Logger.TabControllerInvalidTabId(tabId, portalId); } else if (ignoreCache || Host.Host.PerformanceSetting == Globals.PerformanceSettings.NoCaching) { @@ -1510,7 +1510,7 @@ public TabInfo GetTab(int tabId, int portalId, bool ignoreCache) } else { - Logger.WarnFormat(CultureInfo.InvariantCulture, "Unable to find tabId {0} of portal {1}", tabId, portalId); + Logger.TabControllerUnableToFindTabId(tabId, portalId); } } } @@ -1519,8 +1519,8 @@ public TabInfo GetTab(int tabId, int portalId, bool ignoreCache) } /// Gets the tab by culture. - /// The tab id. - /// The portal id. + /// The tab ID. + /// The portal ID. /// The locale. /// tab info. public TabInfo GetTabByCulture(int tabId, int portalId, Locale locale) @@ -2560,7 +2560,7 @@ private void CreateLocalizedCopyInternal(TabInfo originalTab, Locale locale, boo { try { - Logger.TraceFormat(CultureInfo.InvariantCulture, "Localizing TabId: {0}, TabPath: {1}, Locale: {2}", originalTab.TabID, originalTab.TabPath, locale.Code); + Logger.TabControllerLocalizingTab(originalTab.TabID, originalTab.TabPath, locale.Code); var defaultLocale = LocaleController.Instance.GetDefaultLocale(originalTab.PortalID); // First Clone the Tab diff --git a/DNN Platform/Library/Entities/Tabs/TabPublishingController.cs b/DNN Platform/Library/Entities/Tabs/TabPublishingController.cs index d584885603f..09ae273bd22 100644 --- a/DNN Platform/Library/Entities/Tabs/TabPublishingController.cs +++ b/DNN Platform/Library/Entities/Tabs/TabPublishingController.cs @@ -59,7 +59,7 @@ public void SetTabPublishing(int tabID, int portalID, bool publish) { var errorMessage = Localization.GetExceptionMessage("PublishPagePermissionsNotMet", "Permissions are not met. The page has not been published."); var permissionsNotMetExc = new PermissionsNotMetException(tabID, errorMessage); - Logger.Error(errorMessage, permissionsNotMetExc); + Logger.TabPublishingControllerPermissionsAreNotMetThePageHasNotBeenPublished(permissionsNotMetExc, errorMessage); throw permissionsNotMetExc; } diff --git a/DNN Platform/Library/Entities/Tabs/TabVersions/TabVersionBuilder.cs b/DNN Platform/Library/Entities/Tabs/TabVersions/TabVersionBuilder.cs index b3248d87263..41d4147bf1b 100644 --- a/DNN Platform/Library/Entities/Tabs/TabVersions/TabVersionBuilder.cs +++ b/DNN Platform/Library/Entities/Tabs/TabVersions/TabVersionBuilder.cs @@ -166,7 +166,7 @@ public TabVersion RollBackVesion(int tabId, int createdByUserId, int version) } catch (DnnTabVersionException e) { - Logger.Error($"There was a problem making rollback of the module {rollbackDetail.ModuleId}. Message: {e.Message}."); + Logger.TabVersionBuilderProblemMakingRollbackOfTheModule(e, rollbackDetail.ModuleId); continue; } @@ -783,7 +783,7 @@ private List ConvertToModuleInfo(IEnumerable detai } catch (Exception ex) { - Logger.Error(ex); + Logger.TabVersionBuilderConvertToModuleInfoException(ex); } return modules; diff --git a/DNN Platform/Library/Entities/Tabs/TabWorkflowTracker.cs b/DNN Platform/Library/Entities/Tabs/TabWorkflowTracker.cs index 2818bf53367..5318c9b9706 100644 --- a/DNN Platform/Library/Entities/Tabs/TabWorkflowTracker.cs +++ b/DNN Platform/Library/Entities/Tabs/TabWorkflowTracker.cs @@ -92,12 +92,12 @@ private void NotifyWorkflowAboutChanges(int portalId, int tabId, int userId) try { var tabInfo = this.tabController.GetTab(tabId, portalId); - if (tabInfo != null && !tabInfo.IsDeleted && this.workflowEngine.IsWorkflowCompleted(tabInfo)) + if (tabInfo is { IsDeleted: false, } && this.workflowEngine.IsWorkflowCompleted(tabInfo)) { var workflow = this.GetCurrentOrDefaultWorkflow(tabInfo, portalId); if (workflow == null) { - Logger.Warn("Current Workflow and Default workflow are not found on NotifyWorkflowAboutChanges"); + Logger.TabWorkflowTrackerCurrentWorkflowAndDefaultWorkflowAreNotFoundOnNotifyWorkflowAboutChanges(); return; } diff --git a/DNN Platform/Library/Entities/Urls/Config/RewriterConfiguration.cs b/DNN Platform/Library/Entities/Urls/Config/RewriterConfiguration.cs index 515dc14a15b..e3ec0b80ecb 100644 --- a/DNN Platform/Library/Entities/Urls/Config/RewriterConfiguration.cs +++ b/DNN Platform/Library/Entities/Urls/Config/RewriterConfiguration.cs @@ -90,7 +90,7 @@ public static RewriterConfiguration GetConfig() log.AddProperty("FilePath", filePath); log.AddProperty("ExceptionMessage", ex.Message); LogController.Instance.AddLog(log); - Logger.Error(log); + Logger.RewriterConfigurationGetConfigFailed(log); } return config; diff --git a/DNN Platform/Library/Entities/Urls/UrlRewriterUtils.cs b/DNN Platform/Library/Entities/Urls/UrlRewriterUtils.cs index 58b5bbbaed8..725d3a00ce1 100644 --- a/DNN Platform/Library/Entities/Urls/UrlRewriterUtils.cs +++ b/DNN Platform/Library/Entities/Urls/UrlRewriterUtils.cs @@ -175,8 +175,8 @@ public static void LogExceptionInRequest(Exception ex, string status, UrlAction log.BypassBuffering = true; LogController.Instance.AddLog(log); - // Log this error in lig4net - Logger.Error(ex); + // Log this error in log4net + Logger.UrlRewriterUtilsLogExceptionInRequest(ex); } } } diff --git a/DNN Platform/Library/Entities/Users/Profile/UserProfile.cs b/DNN Platform/Library/Entities/Users/Profile/UserProfile.cs index fdf506c03dc..47b0f663582 100644 --- a/DNN Platform/Library/Entities/Users/Profile/UserProfile.cs +++ b/DNN Platform/Library/Entities/Users/Profile/UserProfile.cs @@ -388,7 +388,7 @@ public string GetPropertyValue(string propName) var dataType = listController.GetListEntryInfo("DataType", profileProp.DataType); if (dataType == null) { - DnnLoggingController.GetLogger().ErrorFormat(CultureInfo.InvariantCulture, "Invalid data type {0} for profile property {1}", profileProp.DataType, profileProp.PropertyName); + DnnLoggingController.GetLogger().UserProfileInvalidDataType(profileProp.DataType, profileProp.PropertyName); return propValue; } diff --git a/DNN Platform/Library/Entities/Users/Users Online/UserOnlineController.cs b/DNN Platform/Library/Entities/Users/Users Online/UserOnlineController.cs index 0eb4e6848be..210504d9608 100644 --- a/DNN Platform/Library/Entities/Users/Users Online/UserOnlineController.cs +++ b/DNN Platform/Library/Entities/Users/Users Online/UserOnlineController.cs @@ -134,7 +134,7 @@ public void UpdateUsersOnline() } catch (Exception exc) { - Logger.Error(exc); + Logger.UserOnlineControllerUpdateUsersOnlineException(exc); } // Remove users that have expired diff --git a/DNN Platform/Library/Framework/PageBase.cs b/DNN Platform/Library/Framework/PageBase.cs index e89b9679ebb..53a1575993b 100644 --- a/DNN Platform/Library/Framework/PageBase.cs +++ b/DNN Platform/Library/Framework/PageBase.cs @@ -30,7 +30,7 @@ namespace DotNetNuke.Framework using Microsoft.Extensions.Logging; /// PageBase provides a custom DotNetNuke base class for pages. - public abstract class PageBase : Page + public abstract partial class PageBase : Page { private const string LinkItemPattern = "<(a|link|img|script|input|form|object).[^>]*(href|src|action)=(\\\"|'|)(.[^\\\"']*)(\\\"|'|)[^>]*>"; @@ -384,7 +384,7 @@ protected override void OnError(EventArgs e) { base.OnError(e); Exception exc = this.Server.GetLastError(); - Logger.Fatal("An error has occurred while loading page.", exc); + Logger.PageBaseAnErrorHasOccurredWhileLoadingPage(exc); string strURL = Globals.ApplicationURL(); if (exc is HttpException exception && !this.IsViewStateFailure(exception)) @@ -530,10 +530,7 @@ private void LogDnnTrace(string origin, string action, string message) tabId = this.PortalSettings.ActiveTab.TabID; } - if (this.traceLogger.IsDebugEnabled) - { - this.traceLogger.Debug($"{origin} {action} (TabId:{tabId},{message})"); - } + this.traceLogger.PageBaseTrace(origin, action, tabId, message); } private void LocalizeControl(Control control, string value) diff --git a/DNN Platform/Library/Framework/Reflection.cs b/DNN Platform/Library/Framework/Reflection.cs index ab03f792bd4..f80404133bd 100644 --- a/DNN Platform/Library/Framework/Reflection.cs +++ b/DNN Platform/Library/Framework/Reflection.cs @@ -323,7 +323,7 @@ public static T CreateObject(IServiceProvider serviceProvider) } catch (InvalidOperationException exception) { - Logger.Warn($"Unable to create type via service provider: {typeof(T)}", exception); + Logger.ReflectionUnableToCreateTypeViaServiceProvider(exception, typeof(T)); return Activator.CreateInstance(); } } @@ -349,7 +349,7 @@ public static object CreateObject(IServiceProvider serviceProvider, Type type) } catch (InvalidOperationException exception) { - Logger.Warn($"Unable to create type via service provider: {type}", exception); + Logger.ReflectionUnableToCreateTypeViaServiceProvider(exception, type); return Activator.CreateInstance(type); } } @@ -419,7 +419,7 @@ public static Type CreateType(string typeName, string cacheKey, bool useCache, b { if (!ignoreErrors) { - Logger.Error(typeName, exc); + Logger.ReflectionCreateTypeException(exc, typeName); } } } diff --git a/DNN Platform/Library/LoggerMessages.cs b/DNN Platform/Library/LoggerMessages.cs new file mode 100644 index 00000000000..07687f710eb --- /dev/null +++ b/DNN Platform/Library/LoggerMessages.cs @@ -0,0 +1,1602 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace DotNetNuke; + +using System; +using System.Configuration; +using System.Data.SqlClient; +using System.Globalization; +using System.IO; +using System.Net; +using System.Threading; +using System.Web.UI; + +using DotNetNuke.Abstractions.Application; +using DotNetNuke.Entities.Tabs.TabVersions.Exceptions; +using DotNetNuke.Services.Exceptions; +using DotNetNuke.Services.FileSystem; +using DotNetNuke.Services.Log.EventLog; +using DotNetNuke.Services.Search.Entities; +using DotNetNuke.Services.Upgrade.Internals.Steps; + +using Lucene.Net.Search; + +using Microsoft.Extensions.Logging; + +/// Extension methods for for pre-defined logging messages. +/// The DotNetNuke.Library project has been assigned event IDs from 1 to 999,999. +internal static partial class LoggerMessages +{ + /* + # Event IDs + - 1 to 999,999 + - DotNetNuke.Library project + - 1 to 999 + - DotNetNuke namespace + - 1,000 to 1,999 + - DotNetNuke.Application namespace + - 2,000 to 2,999 + - DotNetNuke.Collections namespace + - DotNetNuke.Collections.Internal namespace + - 3,000 to 3,999 + - DotNetNuke.Common namespace + - DotNetNuke.Common.Internal namespace + - DotNetNuke.Common.Controls namespace + - DotNetNuke.Common.Extensions namespace + - DotNetNuke.Common.Lists namespace + - 4,000 to 4,999 + - DotNetNuke.Common.Utilities namespace + - DotNetNuke.Common.Utilities.Internal namespace + - DotNetNuke.Common.Utils namespace + - 5,000 to 5,999 + - DotNetNuke.ComponentModel namespace + - DotNetNuke.ComponentModel.DataAnnotations namespace + - 6,000 to 6,999 + - DotNetNuke.Data namespace + - DotNetNuke.Data.PetaPoco namespace + - 7,000 to 7,999 + - DotNetNuke.ExtensionPoints namespace + - DotNetNuke.ExtensionPoints.Filters namespace + - 8,000 to 8,999 + - DotNetNuke.Framework namespace + - DotNetNuke.Framework.Internal.Reflection namespace + - DotNetNuke.Framework.JavaScriptLibraries namespace + - DotNetNuke.Framework.Providers namespace + - DotNetNuke.Framework.Reflection namespace + - 9,000 to 9,999 + - DotNetNuke.Prompt namespace + - 10,000 to 10,999 + - DotNetNuke.Security namespace + - DotNetNuke.Security.Cookies namespace + - DotNetNuke.Security.Membership namespace + - DotNetNuke.Security.Permissions namespace + - DotNetNuke.Security.Permissions.Controls namespace + - DotNetNuke.Security.Profile namespace + - DotNetNuke.Security.Roles namespace + - 100,000 to 109,999 + - DotNetNuke.Entities namespace + - DotNetNuke.Entities.Controllers namespace + - DotNetNuke.Entities.DataStructures namespace + - DotNetNuke.Entities.Host namespace + - DotNetNuke.Entities.Icons namespace + - 110,000 to 119,999 + - DotNetNuke.Entities.Content namespace + - DotNetNuke.Entities.Content.Common namespace + - DotNetNuke.Entities.Content.Data namespace + - DotNetNuke.Entities.Content.Taxonomy namespace + - DotNetNuke.Entities.Content.Workflow namespace + - DotNetNuke.Entities.Content.Workflow.Actions namespace + - DotNetNuke.Entities.Content.Workflow.Dto namespace + - DotNetNuke.Entities.Content.Workflow.Entities namespace + - DotNetNuke.Entities.Content.Workflow.Exceptions namespace + - 120,000 to 129,999 + - DotNetNuke.Entities.Friends namespace + - DotNetNuke.Entities.Profile namespace + - DotNetNuke.Entities.Users namespace + - DotNetNuke.Entities.Users.Membership namespace + - DotNetNuke.Entities.Users.Social namespace + - DotNetNuke.Entities.Users.Social.Data namespace + - 130,000 to 139,999 + - DotNetNuke.Entities.Modules namespace + - DotNetNuke.Entities.Modules.Actions namespace + - DotNetNuke.Entities.Modules.Communications namespace + - DotNetNuke.Entities.Modules.Definitions namespace + - DotNetNuke.Entities.Modules.Prompt namespace + - DotNetNuke.Entities.Modules.Settings namespace + - 140,000 to 149,999 + - DotNetNuke.Entities.Portals namespace + - DotNetNuke.Entities.Portals.Data namespace + - DotNetNuke.Entities.Portals.Extensions namespace + - DotNetNuke.Entities.Portals.Internal namespace + - DotNetNuke.Entities.Portals.Templates namespace + - 150,000 to 159,999 + - DotNetNuke.Entities.Tabs namespace + - DotNetNuke.Entities.Tabs.Actions namespace + - DotNetNuke.Entities.Tabs.Dto namespace + - DotNetNuke.Entities.Tabs.TabVersions namespace + - DotNetNuke.Entities.Tabs.TabVersions.Exceptions namespace + - 160,000 to 169,999 + - DotNetNuke.Entities.Urls namespace + - DotNetNuke.Entities.Urls.Config namespace + - 200,000 to 200,999 + - DotNetNuke.Services.Analytics namespace + - DotNetNuke.Services.Analytics.Config namespace + - 201,000 to 201,999 + - DotNetNuke.Services.Assets namespace + - 202,000 to 202,999 + - DotNetNuke.Services.Authentication namespace + - DotNetNuke.Services.Authentication.OAuth namespace + - 204,000 to 204,999 + - DotNetNuke.Services.ClientCapability namespace + - 205,000 to 205,999 + - DotNetNuke.Services.ClientDependency namespace + - 206,000 to 206,999 + - DotNetNuke.Services.Connections namespace + - 207,000 to 207,999 + - DotNetNuke.Services.Cryptography namespace + - 208,000 to 208,999 + - DotNetNuke.Services.DependencyInjection namespace + - 209,000 to 209,999 + - DotNetNuke.Services.EventQueue namespace + - DotNetNuke.Services.EventQueue.Config namespace + - 210,000 to 210,999 + - DotNetNuke.Services.GeneratedImage namespace + - DotNetNuke.Services.GeneratedImage.FilterTransform namespace + - DotNetNuke.Services.GeneratedImage.ImageQuantization namespace + - DotNetNuke.Services.GeneratedImage.StartTransform namespace + - 211,000 to 211,999 + - DotNetNuke.Services.Journal namespace + - DotNetNuke.Services.Journal.Internal namespace + - 212,000 to 212,999 + - DotNetNuke.Services.Mobile namespace + - 213,000 to 213,999 + - DotNetNuke.Services.Pages namespace + - 214,000 to 214,999 + - DotNetNuke.Services.Personalization namespace + - 215,000 to 215,999 + - DotNetNuke.Services.Registration namespace + - 216,000 to 216,999 + - DotNetNuke.Services.Scheduling namespace + - 217,000 to 217,999 + - DotNetNuke.Services.Sitemap namespace + - 218,000 to 218,999 + - DotNetNuke.Services.Syndication namespace + - 219,000 to 219,999 + - DotNetNuke.Services.SystemHealth namespace + - 220,000 to 220,999 + - DotNetNuke.Services.Tokens namespace + - 221,000 to 221,999 + - DotNetNuke.Services.UserProfile namespace + - 222,000 to 222,999 + - DotNetNuke.Services.UserRequest namespace + - 223,000 to 223,999 + - DotNetNuke.Services.Users namespace + - 224,000 to 224,999 + - DotNetNuke.Services.Zip namespace + - 225,000 to 229,999 + - DotNetNuke.Services.Exceptions namespace + - 230,000 to 239,999 + - DotNetNuke.Services.FileSystem namespace + - DotNetNuke.Services.FileSystem.EventArgs namespace + - DotNetNuke.Services.FileSystem.FolderMappings namespace + - DotNetNuke.Services.FileSystem.Internal namespace + - DotNetNuke.Services.FileSystem.Internal.SecurityCheckers namespace + - 240,000 to 249,999 + - DotNetNuke.Services.Installer namespace + - DotNetNuke.Services.Installer.Blocker namespace + - DotNetNuke.Services.Installer.Dependencies namespace + - DotNetNuke.Services.Installer.Installers namespace + - DotNetNuke.Services.Installer.Log namespace + - DotNetNuke.Services.Installer.Packages namespace + - DotNetNuke.Services.Installer.Packages.WebControls namespace + - DotNetNuke.Services.Installer.Writers namespace + - 250,000 to 259,999 + - DotNetNuke.Services.Localization namespace + - DotNetNuke.Services.Localization.Internal namespace + - DotNetNuke.Services.Localization.Persian namespace + - 260,000 to 269,999 + - DotNetNuke.Services.Log.EventLog namespace + - 270,000 to 279,999 + - DotNetNuke.Services.Mail namespace + - DotNetNuke.Services.Mail.OAuth namespace + - 280,000 to 289,999 + - DotNetNuke.Services.Messaging namespace + - DotNetNuke.Services.Messaging.Data namespace + - 290,000 to 299,999 + - DotNetNuke.Services.Cache namespace + - DotNetNuke.Services.ModuleCache namespace + - DotNetNuke.Services.OutputCache namespace + - DotNetNuke.Services.OutputCache.Providers namespace + - 300,000 to 309,999 + - DotNetNuke.Services.Search namespace + - DotNetNuke.Services.Search.Controllers namespace + - DotNetNuke.Services.Search.Entities namespace + - DotNetNuke.Services.Search.Internals namespace + - 310,000 to 319,999 + - DotNetNuke.Services.Upgrade namespace + - DotNetNuke.Services.Upgrade.InternalController.Steps namespace + - DotNetNuke.Services.Upgrade.Internals namespace + - DotNetNuke.Services.Upgrade.Internals.InstallConfiguration namespace + - DotNetNuke.Services.Upgrade.Internals.Steps namespace + - 400,000 to 449,999 + - DotNetNuke.Services.Social.Messaging namespace + - DotNetNuke.Services.Social.Messaging.Data namespace + - DotNetNuke.Services.Social.Messaging.Exceptions namespace + - DotNetNuke.Services.Social.Messaging.Internal namespace + - DotNetNuke.Services.Social.Messaging.Internal.Views namespace + - DotNetNuke.Services.Social.Messaging.Scheduler namespace + - 450,000 to 459,999 + - DotNetNuke.Services.Social.Notifications namespace + - DotNetNuke.Services.Social.Notifications.Data namespace + - 460,000 to 469,999 + - DotNetNuke.Services.Social.Subscriptions namespace + - DotNetNuke.Services.Social.Subscriptions.Data namespace + - DotNetNuke.Services.Social.Subscriptions.Entities namespace + - 500,000 to 599,999 + - DotNetNuke.Services.Url.FriendlyUrl namespace + - 600,000 to 600,999 + - DotNetNuke.UI namespace + - DotNetNuke.UI.Internals namespace + - 601,000 to 601,999 + - DotNetNuke.UI.Containers namespace + - DotNetNuke.UI.Containers.EventListeners namespace + - 602,000 to 602,999 + - DotNetNuke.UI.ControlPanels namespace + - 603,000 to 603,999 + - DotNetNuke.UI.Modules namespace + - DotNetNuke.UI.Modules.Html5 namespace + - 604,000 to 604,999 + - DotNetNuke.UI.Skins namespace + - DotNetNuke.UI.Skins.Controls namespace + - DotNetNuke.UI.Skins.Controls.EventListeners namespace + - 605,000 to 605,999 + - DotNetNuke.UI.UserControls namespace + - 606,000 to 606,999 + - DotNetNuke.UI.Utilities namespace + - 607,000 to 607,999 + - DotNetNuke.UI.WebControls namespace + - DotNetNuke.UI.WebControls.Internal namespace + - 1,000,000 to 1,199,999 + - DotNetNuke.Website project + - 1,200,000 to 1,499,999 + - DotNetNuke.Web project + - 1,500,000 to 1,599,999 + - DotNetNuke.Web.Mvc project + - 1,600,000 to 1,649,999 + - DotNetNuke.Web.Client project + - 1,650,000 to 1,699,999 + - DotNetNuke.Web.Client.ResourceManager project + - 2,000,000 to 2,099,999 + - DotNetNuke.HttpModules project + - 2,100,000 to 2,199,999 + - DotNetNuke.DependencyInjection project + - 2,200,000 to 2,299,999 + - DotNetNuke.Maintenance project + - 2,300,000 to 2,399,999 + - DotNetNuke.Syndication project + - 2,400,000 to 2,499,999 + - DotNetNuke.Providers.AspNetCCP project + - 2,500,000 to 2,999,999 + - DotNetNuke.Providers.FolderProviders project + - 3,000,000 to 3,099,999 + - DotNetNuke.Modules.CoreMessaging project + - 3,100,000 to 3,199,999 + - DotNetNuke.Modules.Groups project + - 3,200,000 to 3,299,999 + - DotNetNuke.Modules.Journal project + - 3,300,000 to 3,399,999 + - DotNetNuke.Modules.MemberDirectory project + - 3,400,000 to 3,499,999 + - DotNetNuke.Modules.RazorHost project + - 3,500,000 to 3,599,999 + - Dnn.Modules.Console project + - 3,600,000 to 3,699,999 + - Dnn.Modules.ResourceManager project + - 4,000,000 to 4,999,999 + - DnnExportImport project + - 5,000,000 to 5,499,999 + - Dnn.PersonaBar.Library project + - 5,500,000 to 5,999,999 + - Dnn.PersonaBar.UI + - 6,000,000 to 6,099,999 + - Dnn.EditBar.UI project + - 7,000,000 to 7,999,999 + - Dnn.PersonaBar.Extensions project + */ + + /* + * 1,000 to 1,999 + * DotNetNuke.Application namespace + */ + + // DotNetNuke.Application.ApplicationStatusInfo (1,000 to 1,099) + [LoggerMessage(EventId = 1_000, Level = LogLevel.Trace, Message = "Getting application status")] + public static partial void ApplicationStatusInfoGettingStatus(this ILogger logger); + + [LoggerMessage(EventId = 1_001, Level = LogLevel.Trace, Message = "result of getting providerpath: {Message}")] + public static partial void ApplicationStatusInfoResultOfGettingProviderPath(this ILogger logger, string message); + + [LoggerMessage(EventId = 1_002, Level = LogLevel.Trace, Message = "Application status is {Status}")] + public static partial void ApplicationStatusInfoStatusIs(this ILogger logger, UpgradeStatus status); + + [LoggerMessage(EventId = 1_003, Level = LogLevel.Error)] + public static partial void ApplicationStatusInfoDatabaseVersionException(this ILogger logger, Exception exception); + + /* + * 2,000 to 2,999 + * DotNetNuke.Collections namespace + * DotNetNuke.Collections.Internal namespace + */ + + // DotNetNuke.Collections.CollectionExtensions (2,000 to 2,099) + [LoggerMessage(EventId = 2_000, Level = LogLevel.Error, Message = "Error loading portal setting: {Key}:{Value} Default value {DefaultValue} was used instead")] + public static partial void CollectionExtensionsErrorLoadingPortalSettingDefaultUsedInstead(this ILogger logger, string key, object value, object defaultValue); + + /* + * 3,000 to 3,999 + * DotNetNuke.Common namespace + * DotNetNuke.Common.Internal namespace + * DotNetNuke.Common.Controls namespace + * DotNetNuke.Common.Extensions namespace + * DotNetNuke.Common.Lists namespace + */ + + // DotNetNuke.Common.Initialize (3,000 to 3,099) + [LoggerMessage(EventId = 3_000, Level = LogLevel.Information, Message = "Application shutting down. Reason: {Reason}")] + public static partial void InitializeApplicationShuttingDown(this ILogger logger, string reason); + + [LoggerMessage(EventId = 3_001, Level = LogLevel.Information, Message = "Application shutting down. Reason: {Reason}\nASP.NET Shutdown Info: {ShutdownMessage}\n{ShutdownStack}")] + public static partial void InitializeApplicationShuttingDownWithInfo(this ILogger logger, string reason, string shutdownMessage, string shutdownStack); + + [LoggerMessage(EventId = 3_002, Level = LogLevel.Information, Message = "UnderConstruction page was shown because application needs to be installed, and both the AutoUpgrade and UseWizard AppSettings in web.config are false. Use /install/install.aspx?mode=install to install application. ")] + public static partial void InitializeUnderConstructionPageShownBecauseInstallationNeeded(this ILogger logger); + + [LoggerMessage(EventId = 3_003, Level = LogLevel.Information, Message = "UnderConstruction page was shown because application needs to be upgraded, and both the AutoUpgrade and UseInstallWizard AppSettings in web.config are false. Use /install/install.aspx?mode=upgrade to upgrade application. ")] + public static partial void InitializeUnderConstructionPageShownBecauseUpgradeNeeded(this ILogger logger); + + [LoggerMessage(EventId = 3_004, Level = LogLevel.Information, Message = "Application Initializing")] + public static partial void InitializeApplicationInitializing(this ILogger logger); + + [LoggerMessage(EventId = 3_005, Level = LogLevel.Information, Message = "Application Initialized")] + public static partial void InitializeApplicationInitialized(this ILogger logger); + + [LoggerMessage(EventId = 3_006, Level = LogLevel.Trace, Message = "Running Schedule {SchedulerMode}")] + public static partial void InitializeRunningSchedule(this ILogger logger, SchedulerMode schedulerMode); + + [LoggerMessage(EventId = 3_007, Level = LogLevel.Trace, Message = "Request {LocalPath}")] + public static partial void InitializeRequest(this ILogger logger, string localPath); + + [LoggerMessage(EventId = 3_008, Level = LogLevel.Error, Message = "UnderConstruction page was shown because we cannot ascertain the application was ever installed, and there is no working database connection. Check database connectivity before continuing. ")] + public static partial void InitializeUnderConstructionPageShownBecauseNoWorkingDatabaseConnection(this ILogger logger); + + [LoggerMessage(EventId = 3_009, Level = LogLevel.Error, Message = "The connection to the database has failed, the application is not installed yet, and both AutoUpgrade and UseInstallWizard are not set in web.config, a 500 error page will be shown to visitors")] + public static partial void InitializeConnectionToTheDatabaseHasFailedTheApplicationIsNotInstalledYetA500ErrorPageWillBeShown(this ILogger logger); + + [LoggerMessage(EventId = 3_010, Level = LogLevel.Error, Message = "The connection to the database has failed, however, the application is already completely installed, a 500 error page will be shown to visitors")] + public static partial void InitializeConnectionToTheDatabaseHasFailedHoweverTheApplicationIsAlreadyCompletelyInstalledA500ErrorPageWillBeShown(this ILogger logger); + + // DotNetNuke.Common.Globals (3,100 to 3,199) + [LoggerMessage(EventId = 3_100, Level = LogLevel.Error)] + public static partial void GlobalsRedirectException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_101, Level = LogLevel.Error)] + public static partial void GlobalsGetTotalRecordsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_102, Level = LogLevel.Error)] + public static partial void GlobalsDateToStringException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_103, Level = LogLevel.Error)] + public static partial void GlobalsDeserializeHashTableBase64Exception(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_104, Level = LogLevel.Error)] + public static partial void GlobalsSerializeHashTableBase64Exception(this ILogger logger, Exception exception); + + // DotNetNuke.Common.Lists.ListInfoCollection (3,200 to 3,299) + [LoggerMessage(EventId = 3_200, Level = LogLevel.Error)] + public static partial void ListInfoCollectionAddException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_201, Level = LogLevel.Error)] + public static partial void ListInfoCollectionItemIndexException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_202, Level = LogLevel.Error)] + public static partial void ListInfoCollectionItemKeyException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_203, Level = LogLevel.Error)] + public static partial void ListInfoCollectionItemKeyCacheException(this ILogger logger, Exception exception); + + // DotNetNuke.Common.Internal.ServicesRoutingManager (3,300 to 3,399) + [LoggerMessage(EventId = 3_300, Level = LogLevel.Error, Message = "Unable to register service routes")] + public static partial void ServicesRoutingManagerUnableToRegisterServiceRoutes(this ILogger logger, Exception exception); + + // DotNetNuke.Common.Internal.EventHandlersContainer (3,400 to 3,499) + [LoggerMessage(EventId = 3_400, Level = LogLevel.Error, Message = "{Message}")] + public static partial void EventHandlersContainerConstructorException(this ILogger logger, Exception exception, string message); + + /* + * 4,000 to 4,999 + * DotNetNuke.Common.Utilities namespace + * DotNetNuke.Common.Utilities.Internal namespace + * DotNetNuke.Common.Utils namespace + */ + + // DotNetNuke.Common.Utilities.FileSystemUtils (4,000 to 4,099) + [LoggerMessage(EventId = 4_000, Level = LogLevel.Information, Message = "{RootPath} does not exist. ")] + public static partial void FileSystemUtilsFolderDoesNotExist(this ILogger logger, string rootPath); + + [LoggerMessage(EventId = 4_001, Level = LogLevel.Error, Message = "Reading from {FilePath} didn't read all data in buffer. Requested to read {BufferLength} bytes, but was read {ReadCount} bytes")] + public static partial void FileSystemUtilsAddToZipDidNotReadAllDataInBuffer(this ILogger logger, string filePath, long bufferLength, int readCount); + + [LoggerMessage(EventId = 4_002, Level = LogLevel.Error)] + public static partial void FileSystemUtilsDeleteFileWithWaitException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 4_003, Level = LogLevel.Error)] + public static partial void FileSystemUtilsUnzipResourcesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 4_004, Level = LogLevel.Error)] + public static partial void FileSystemUtilsDeleteFilesFolderException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 4_005, Level = LogLevel.Error)] + public static partial void FileSystemUtilsDeleteFilesFileException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 4_005, Level = LogLevel.Error)] + public static partial void FileSystemUtilsDeleteFileException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 4_005, Level = LogLevel.Error)] + public static partial void FileSystemUtilsDeleteFolderException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 4_005, Level = LogLevel.Error)] + public static partial void FileSystemUtilsUnzipException(this ILogger logger, Exception exception); + + // DotNetNuke.Common.Utilities.Internal.RetryableAction (4,100 to 4,199) + [LoggerMessage(EventId = 4_100, Level = LogLevel.Trace, Message = "Action succeeded - {Description}")] + public static partial void RetryableActionSucceeded(this ILogger logger, string description); + + [LoggerMessage(EventId = 4_101, Level = LogLevel.Trace, Message = "Retrying action {RetriesRemaining} - {Description}")] + public static partial void RetryableActionRetrying(this ILogger logger, int retriesRemaining, string description); + + [LoggerMessage(EventId = 4_102, Level = LogLevel.Warning, Message = "All retries of action failed - {Description}")] + public static partial void RetryableActionAllRetriesFailed(this ILogger logger, string description); + + // DotNetNuke.Common.Utilities.Config (4,200 to 4,299) + [LoggerMessage(EventId = 4_200, Level = LogLevel.Error)] + public static partial void ConfigSaveFileIOException(this ILogger logger, IOException exception); + + [LoggerMessage(EventId = 4_201, Level = LogLevel.Error)] + public static partial void ConfigSaveFileException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 4_202, Level = LogLevel.Error)] + public static partial void ConfigTouchException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 4_203, Level = LogLevel.Error)] + public static partial void ConfigUpdateMachineKeyException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 4_204, Level = LogLevel.Error)] + public static partial void ConfigUpdateValidationKeyException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 4_205, Level = LogLevel.Error)] + public static partial void ConfigUpdateInstallVersionException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 4_206, Level = LogLevel.Error)] + public static partial void ConfigAddFcnModeException(this ILogger logger, Exception exception); + + // DotNetNuke.Common.Utilities.DataCache (4,300 to 4,399) + [LoggerMessage(EventId = 4_300, Level = LogLevel.Error)] + public static partial void DataCacheItemRemovedCallbackException(this ILogger logger, Exception exception); + + // DotNetNuke.Common.Utilities.FileSystemPermissionVerifier (4,400 to 4,499) + [LoggerMessage(EventId = 4_400, Level = LogLevel.Error)] + public static partial void FileSystemPermissionVerifierFileCreateException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 4_401, Level = LogLevel.Error)] + public static partial void FileSystemPermissionVerifierFileDeleteException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 4_402, Level = LogLevel.Error)] + public static partial void FileSystemPermissionVerifierFolderCreateException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 4_403, Level = LogLevel.Error)] + public static partial void FileSystemPermissionVerifierFolderDeleteException(this ILogger logger, Exception exception); + + /* + * 5,000 to 5,999 + * DotNetNuke.ComponentModel namespace + * DotNetNuke.ComponentModel.DataAnnotations namespace + */ + + // DotNetNuke.ComponentModel.ContainerWithServiceProviderFallback (5,000 to 5,099) + [LoggerMessage(EventId = 5_000, Level = LogLevel.Trace, Message = "Getting component for {FullName}")] + public static partial void ContainerWithServiceProviderFallbackGettingComponent(this ILogger logger, string fullName); + + [LoggerMessage(EventId = 5_001, Level = LogLevel.Trace, Message = "Got component for {FullName} from container")] + public static partial void ContainerWithServiceProviderFallbackGotComponentFromContainer(this ILogger logger, string fullName); + + [LoggerMessage(EventId = 5_002, Level = LogLevel.Trace, Message = "Getting component for {FullName} from service provider")] + public static partial void ContainerWithServiceProviderFallbackGettingComponentFromServiceProvider(this ILogger logger, string fullName); + + // DotNetNuke.ComponentModel.ComponentFactory (5,100 to 5,199) + [LoggerMessage(EventId = 5_100, Level = LogLevel.Warning, Message = "Container was null, instantiating SimpleContainer")] + public static partial void ComponentFactoryInstantiatingSimpleContainer(this ILogger logger); + + // DotNetNuke.ComponentModel.ProviderInstaller (5,200 to 5,299) + [LoggerMessage(EventId = 5_200, Level = LogLevel.Error)] + public static partial void ProviderInstallerCouldNotLoadProvider(this ILogger logger, ConfigurationErrorsException exception); + + /* + * 6,000 to 6,999 + * DotNetNuke.Data namespace + * DotNetNuke.Data.PetaPoco namespace + */ + + // DotNetNuke.Data.DataProvider (6,000 to 6,099) + [LoggerMessage(EventId = 6_000, Level = LogLevel.Debug)] + public static partial void DataProviderSqlExceptionFromAddPropertyDefinition(this ILogger logger, SqlException exception); + + [LoggerMessage(EventId = 6_001, Level = LogLevel.Error)] + public static partial void DataProviderSqlExceptionFromAddSearchDeletedItems(this ILogger logger, SqlException exception); + + [LoggerMessage(EventId = 6_002, Level = LogLevel.Error)] + public static partial void DataProviderSqlExceptionFromDeleteProcessedSearchDeletedItems(this ILogger logger, SqlException exception); + + // DotNetNuke.Data.SqlDataProvider (6,100 to 6,199) + [LoggerMessage(EventId = 6_100, Level = LogLevel.Trace, Message = "Executing SQL Script {SQL}")] + public static partial void SqlDataProviderExecutingSqlScript(this ILogger logger, string sql); + + [LoggerMessage(EventId = 6_101, Level = LogLevel.Error)] + public static partial void SqlDataProviderGrantProcedureExecutePermissionException(this ILogger logger, SqlException exception); + + [LoggerMessage(EventId = 6_102, Level = LogLevel.Error)] + public static partial void SqlDataProviderGrantFunctionExecutePermissionException(this ILogger logger, SqlException exception); + + [LoggerMessage(EventId = 6_103, Level = LogLevel.Error)] + public static partial void SqlDataProviderExecuteScriptException(this ILogger logger, SqlException exception); + + [LoggerMessage(EventId = 6_104, Level = LogLevel.Error)] + public static partial void SqlDataProviderExecuteSqlException(this ILogger logger, SqlException exception); + + [LoggerMessage(EventId = 6_105, Level = LogLevel.Error)] + public static partial void SqlDataProviderExecuteSqlGeneralException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 6_106, Level = LogLevel.Error)] + public static partial void SqlDataProviderExecuteUpgradedConnectionQueryException(this ILogger logger, SqlException exception); + + // DotNetNuke.Data.PetaPoco.PetaPocoHelper (6,200 to 6,299) + [LoggerMessage(EventId = 6_200, Level = LogLevel.Error, Message = "[1] Error executing SQL: {SQL}")] + public static partial void PetaPocoHelper1ErrorExecutingSql(this ILogger logger, Exception exception, string sql); + + [LoggerMessage(EventId = 6_201, Level = LogLevel.Error, Message = "[2] Error executing SQL: {CommandText}")] + public static partial void PetaPocoHelper2ErrorExecutingSql(this ILogger logger, Exception exception, string commandText); + + [LoggerMessage(EventId = 6_202, Level = LogLevel.Error, Message = "[3] Error executing SQL: {SQL}")] + public static partial void PetaPocoHelper3ErrorExecutingSql(this ILogger logger, Exception exception, string sql); + + [LoggerMessage(EventId = 6_203, Level = LogLevel.Error, Message = "[4] Error executing SQL: {SQL}")] + public static partial void PetaPocoHelper4ErrorExecutingSql(this ILogger logger, Exception exception, string sql); + + [LoggerMessage(EventId = 6_204, Level = LogLevel.Error, Message = "[5] Error executing SQL: {SQL}")] + public static partial void PetaPocoHelper5ErrorExecutingSql(this ILogger logger, Exception exception, string sql); + + /* + * 8,000 to 8,999 + * DotNetNuke.Framework namespace + * DotNetNuke.Framework.Internal.Reflection namespace + * DotNetNuke.Framework.JavaScriptLibraries namespace + * DotNetNuke.Framework.Providers namespace + * DotNetNuke.Framework.Reflection namespace + */ + + // DotNetNuke.Framework.PageBase (8,000 to 8,099) + [LoggerMessage(EventId = 8_000, Level = LogLevel.Debug, Message = "{Origin} {Action} (TabId:{TabId},{Message})")] + public static partial void PageBaseTrace(this ILogger logger, string origin, string action, int tabId, string message); + + [LoggerMessage(EventId = 8_001, Level = LogLevel.Critical, Message = "An error has occurred while loading page.")] + public static partial void PageBaseAnErrorHasOccurredWhileLoadingPage(this ILogger logger, Exception exception); + + // DotNetNuke.Framework.Reflection (8,100 to 8,199) + [LoggerMessage(EventId = 8_100, Level = LogLevel.Warning, Message = "Unable to create type via service provider: {Type}")] + public static partial void ReflectionUnableToCreateTypeViaServiceProvider(this ILogger logger, InvalidOperationException exception, Type type); + + [LoggerMessage(EventId = 8_101, Level = LogLevel.Error, Message = "{TypeName}")] + public static partial void ReflectionCreateTypeException(this ILogger logger, Exception exception, string typeName); + + /* + * 10,000 to 10,999 + * DotNetNuke.Security namespace + * DotNetNuke.Security.Cookies namespace + * DotNetNuke.Security.Membership namespace + * DotNetNuke.Security.Permissions namespace + * DotNetNuke.Security.Permissions.Controls namespace + * DotNetNuke.Security.Profile namespace + * DotNetNuke.Security.Roles namespace + */ + + // DotNetNuke.Security.Roles.RoleController (10,000 to 10,099) + [LoggerMessage(EventId = 10_000, Level = LogLevel.Error)] + public static partial void RoleControllerUserAlreadyBelongsToRoleException(this ILogger logger, Exception exception); + + // DotNetNuke.Security.Roles.DNNRoleProvider (10,100 to 10,199) + [LoggerMessage(EventId = 10_100, Level = LogLevel.Error)] + public static partial void DnnRoleProviderAddUserToRoleException(this ILogger logger, Exception exception); + + // DotNetNuke.Security.Membership.AspNetMembershipProvider (10,200 to 10,299) + [LoggerMessage(EventId = 10_200, Level = LogLevel.Error)] + public static partial void AspNetMembershipProviderDeleteUserException(this ILogger logger, Exception exception); + + /* + * 100,000 to 109,999 + * DotNetNuke.Entities namespace + * DotNetNuke.Entities.Controllers namespace + * DotNetNuke.Entities.DataStructures namespace + * DotNetNuke.Entities.Host namespace + * DotNetNuke.Entities.Icons namespace + */ + + // DotNetNuke.Entities.Host.ServerController (100,000 to 100,099) + [LoggerMessage(EventId = 100_000, Level = LogLevel.Debug, Message = "GetExecutingServerName: {ExecutingServerName}")] + public static partial void ServerControllerGetExecutingServerName(this ILogger logger, string executingServerName); + + [LoggerMessage(EventId = 100_001, Level = LogLevel.Debug, Message = "GetServerName: {ServerName}")] + public static partial void ServerControllerGetServerName(this ILogger logger, string serverName); + + [LoggerMessage(EventId = 100_002, Level = LogLevel.Error)] + public static partial void ServerControllerGetServerUrlException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 100_003, Level = LogLevel.Error)] + public static partial void ServerControllerGetServerUniqueIdException(this ILogger logger, Exception exception); + + // DotNetNuke.Entities.Icons.IconController (100,100 to 100,199) + [LoggerMessage(EventId = 100_100, Level = LogLevel.Warning, Message = "Icon Not Present on Disk {PhysicalPath}")] + public static partial void IconControllerIconNotPresentOnDisk(this ILogger logger, string physicalPath); + + // DotNetNuke.Entities.Controllers.HostController (100,200 to 100,299) + [LoggerMessage(EventId = 100_200, Level = LogLevel.Error)] + public static partial void HostControllerGetBooleanException(this ILogger logger, Exception exception); + + /* + * 110,000 to 119,999 + * DotNetNuke.Entities.Content namespace + * DotNetNuke.Entities.Content.Common namespace + * DotNetNuke.Entities.Content.Data namespace + * DotNetNuke.Entities.Content.Taxonomy namespace + * DotNetNuke.Entities.Content.Workflow namespace + * DotNetNuke.Entities.Content.Workflow.Actions namespace + * DotNetNuke.Entities.Content.Workflow.Dto namespace + * DotNetNuke.Entities.Content.Workflow.Entities namespace + * DotNetNuke.Entities.Content.Workflow.Exceptions namespace + */ + + // DotNetNuke.Entities.Content.AttachmentController (110,000 to 110,099) + [LoggerMessage(EventId = 110_000, Level = LogLevel.Warning, Message = "Unable to load file properties for File ID {FileId}")] + public static partial void AttachmentControllerUnableToLoadFileProperties(this ILogger logger, int fileId); + + /* + * 120,000 to 129,999 + * DotNetNuke.Entities.Friends namespace + * DotNetNuke.Entities.Profile namespace + * DotNetNuke.Entities.Users namespace + * DotNetNuke.Entities.Users.Membership namespace + * DotNetNuke.Entities.Users.Social namespace + * DotNetNuke.Entities.Users.Social.Data namespace + */ + + // DotNetNuke.Entities.Users.UserProfile (120,000 to 120,099) + [LoggerMessage(EventId = 120_000, Level = LogLevel.Error, Message = "Invalid data type {DataTypeId} for profile property {PropertyName}")] + public static partial void UserProfileInvalidDataType(this ILogger logger, int dataTypeId, string propertyName); + + // DotNetNuke.Entities.Users.UserOnlineController (120,100 to 120,199) + [LoggerMessage(EventId = 120_100, Level = LogLevel.Error)] + public static partial void UserOnlineControllerUpdateUsersOnlineException(this ILogger logger, Exception exception); + + // DotNetNuke.Entities.Profile.ProfileController (120,200 to 120,299) + [LoggerMessage(EventId = 120_200, Level = LogLevel.Error)] + public static partial void ProfileControllerCreateThumbnailsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 120_201, Level = LogLevel.Error)] + public static partial void ProfileControllerFillPropertyDefinitionInfoException(this ILogger logger, Exception exception); + + /* + * 130,000 to 139,999 + * DotNetNuke.Entities.Modules namespace + * DotNetNuke.Entities.Modules.Actions namespace + * DotNetNuke.Entities.Modules.Communications namespace + * DotNetNuke.Entities.Modules.Definitions namespace + * DotNetNuke.Entities.Modules.Prompt namespace + * DotNetNuke.Entities.Modules.Settings namespace + */ + + // DotNetNuke.Entities.Modules.PortalModuleBase (130,000 to 130,099) + [LoggerMessage(EventId = 130_000, Level = LogLevel.Debug, Message = "PortalModuleBase.OnInit Start (TabId:{TabId},ModuleId:{ModuleId}): {Type}")] + public static partial void PortalModuleBaseOnInitStart(this ILogger logger, int tabId, int moduleId, Type type); + + [LoggerMessage(EventId = 130_001, Level = LogLevel.Debug, Message = "PortalModuleBase.OnInit End (TabId:{TabId},ModuleId:{ModuleId}): {Type}")] + public static partial void PortalModuleBaseOnInitEnd(this ILogger logger, int tabId, int moduleId, Type type); + + [LoggerMessage(EventId = 130_002, Level = LogLevel.Debug, Message = "PortalModuleBase.OnLoad Start (TabId:{TabId},ModuleId:{ModuleId}): {Type}")] + public static partial void PortalModuleBaseOnLoadStart(this ILogger logger, int tabId, int moduleId, Type type); + + [LoggerMessage(EventId = 130_003, Level = LogLevel.Debug, Message = "PortalModuleBase.OnLoad End (TabId:{TabId},ModuleId:{ModuleId}): {Type}")] + public static partial void PortalModuleBaseOnLoadEnd(this ILogger logger, int tabId, int moduleId, Type type); + + // DotNetNuke.Entities.Modules.DesktopModuleController (130,100 to 130,199) + [LoggerMessage(EventId = 130_100, Level = LogLevel.Warning, Message = "Unable to find module by module ID. ID:{DesktopModuleId} PortalID:{PortalId}")] + public static partial void DesktopModuleControllerUnableToFindModuleByModuleId(this ILogger logger, int desktopModuleId, int portalId); + + [LoggerMessage(EventId = 130_101, Level = LogLevel.Warning, Message = "Unable to find module by package ID. ID:{PackageId}")] + public static partial void DesktopModuleControllerUnableToFindModuleByPackageId(this ILogger logger, int packageId); + + [LoggerMessage(EventId = 130_102, Level = LogLevel.Warning, Message = "Unable to find module by name. Name:{DesktopModuleName} portalId:{PortalId}")] + public static partial void DesktopModuleControllerUnableToFindModuleByName(this ILogger logger, string desktopModuleName, int portalId); + + [LoggerMessage(EventId = 130_103, Level = LogLevel.Warning, Message = "Unable to find module by friendly name. Name:{FriendlyName}")] + public static partial void DesktopModuleControllerUnableToFindModuleByFriendlyName(this ILogger logger, string friendlyName); + + // DotNetNuke.Entities.Modules.ModuleController (130,200 to 130,299) + [LoggerMessage(EventId = 130_200, Level = LogLevel.Error, Message = "Error localizing module, moduleId: {ModuleId}")] + public static partial void ModuleControllerErrorLocalizingModule(this ILogger logger, Exception exception, int moduleId); + + [LoggerMessage(EventId = 130_201, Level = LogLevel.Error)] + public static partial void ModuleControllerModuleAlreadyOnThePageException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 130_202, Level = LogLevel.Error)] + public static partial void ModuleControllerAddContentException(this ILogger logger, Exception exception); + + // DotNetNuke.Entities.Modules.Prompt.AddModule (130,300 to 130,399) + [LoggerMessage(EventId = 130_300, Level = LogLevel.Error)] + public static partial void AddModuleRunException(this ILogger logger, Exception exception); + + // DotNetNuke.Entities.Modules.ModuleInfo (130,400 to 130,499) + [LoggerMessage(EventId = 130_400, Level = LogLevel.Error)] + public static partial void ModuleInfoFillException(this ILogger logger, Exception exception); + + // DotNetNuke.Entities.Modules.EventMessageProcessor (130,500 to 130,599) + [LoggerMessage(EventId = 130_500, Level = LogLevel.Error)] + public static partial void EventMessageProcessorProcessMessageException(this ILogger logger, Exception exception); + + /* + * 140,000 to 149,999 + * DotNetNuke.Entities.Portals namespace + * DotNetNuke.Entities.Portals.Data namespace + * DotNetNuke.Entities.Portals.Extensions namespace + * DotNetNuke.Entities.Portals.Internal namespace + * DotNetNuke.Entities.Portals.Templates namespace + */ + + // DotNetNuke.Entities.Portals.Templates.PortalTemplateImporter (140,000 to 140,099) + [LoggerMessage(EventId = 140_000, Level = LogLevel.Error)] + public static partial void PortalTemplateImporterParseTemplateException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 140_001, Level = LogLevel.Error)] + public static partial void PortalTemplateImporterGetFolderMappingException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 140_002, Level = LogLevel.Error)] + public static partial void PortalTemplateImporterAddFolderException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 140_003, Level = LogLevel.Error, Message = "{Message}")] + public static partial void PortalTemplateImporterParseFilesInvalidFileExtensionException(this ILogger logger, InvalidFileExtensionException exception, string message); + + // DotNetNuke.Entities.Portals.PortalGroupController (140,100 to 140,199) + [LoggerMessage(EventId = 140_100, Level = LogLevel.Error)] + public static partial void PortalGroupControllerLogEventException(this ILogger logger, Exception exception); + + // DotNetNuke.Entities.Portals.PortalController (140,200 to 140,299) + [LoggerMessage(EventId = 140_200, Level = LogLevel.Error)] + public static partial void PortalControllerCreateChildPortalFolderException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 140_201, Level = LogLevel.Error)] + public static partial void PortalControllerGetPortalSettingException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 140_202, Level = LogLevel.Error)] + public static partial void PortalControllerGetPortalSettingAsBooleanException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 140_203, Level = LogLevel.Error)] + public static partial void PortalControllerGetPortalSettingAsIntegerException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 140_204, Level = LogLevel.Error)] + public static partial void PortalControllerGetPortalSettingAsDoubleException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 140_205, Level = LogLevel.Error)] + public static partial void PortalControllerGetAdminUserException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 140_206, Level = LogLevel.Error)] + public static partial void PortalControllerCreateAdminUserException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 140_207, Level = LogLevel.Error)] + public static partial void PortalControllerProcessResourceFileExplicitException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 140_208, Level = LogLevel.Error)] + public static partial void PortalControllerLogDeletePortalException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 140_209, Level = LogLevel.Error)] + public static partial void PortalControllerEnableBrowserLanguageInDefaultException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 140_210, Level = LogLevel.Error)] + public static partial void PortalControllerDeleteHomeDirectoryException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 140_211, Level = LogLevel.Error)] + public static partial void PortalControllerCreateChildPortalFilesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 140_212, Level = LogLevel.Error)] + public static partial void PortalControllerAddDefaultFolderTypesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 140_213, Level = LogLevel.Error)] + public static partial void PortalControllerApplyPortalTemplateException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 140_214, Level = LogLevel.Error)] + public static partial void PortalControllerCreateDefaultRelationshipsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 140_215, Level = LogLevel.Error)] + public static partial void PortalControllerCreateProfanityListException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 140_216, Level = LogLevel.Error)] + public static partial void PortalControllerCreateBannedPasswordsListException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 140_217, Level = LogLevel.Error)] + public static partial void PortalControllerLogCreatePortalException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 140_218, Level = LogLevel.Error, Message = "{Message}")] + public static partial void PortalControllerEnsureRequiredProvidersForFolderTypesException(this ILogger logger, Exception exception, string message); + + [LoggerMessage(EventId = 140_219, Level = LogLevel.Error, Message = "{Message}: {FolderTypeName}")] + public static partial void PortalControllerAddFolderMappingException(this ILogger logger, Exception exception, string message, string folderTypeName); + + [LoggerMessage(EventId = 140_220, Level = LogLevel.Error, Message = "Error while parsing: {TemplateFilePath}")] + public static partial void PortalControllerErrorWhileParsing(this ILogger logger, Exception exception, string templateFilePath); + + // DotNetNuke.Entities.Portals.Templates.PortalTemplateInfo (140,300 to 140,399) + [LoggerMessage(EventId = 140_300, Level = LogLevel.Error, Message = "Error while parsing: {TemplateFilePath}")] + public static partial void PortalTemplateInfoErrorWhileParsing(this ILogger logger, Exception exception, string templateFilePath); + + /* + * 150,000 to 159,999 + * DotNetNuke.Entities.Tabs namespace + * DotNetNuke.Entities.Tabs.Actions namespace + * DotNetNuke.Entities.Tabs.Dto namespace + * DotNetNuke.Entities.Tabs.TabVersions namespace + * DotNetNuke.Entities.Tabs.TabVersions.Exceptions namespace + */ + + // DotNetNuke.Entities.Tabs.TabController (150,000 to 150,099) + [LoggerMessage(EventId = 150_000, Level = LogLevel.Trace, Message = "Localizing TabId: {TabId}, TabPath: {TabPath}, Locale: {Locale}")] + public static partial void TabControllerLocalizingTab(this ILogger logger, int tabId, string tabPath, string locale); + + [LoggerMessage(EventId = 150_001, Level = LogLevel.Warning, Message = "Invalid tabId {TabId} of portal {PortalId}")] + public static partial void TabControllerInvalidTabId(this ILogger logger, int tabId, int portalId); + + [LoggerMessage(EventId = 150_002, Level = LogLevel.Warning, Message = "Unable to find tabId {TabId} of portal {PortalId}")] + public static partial void TabControllerUnableToFindTabId(this ILogger logger, int tabId, int portalId); + + // DotNetNuke.Entities.Tabs.TabWorkflowTracker (150,100 to 150,199) + [LoggerMessage(EventId = 150_100, Level = LogLevel.Warning, Message = "Current Workflow and Default workflow are not found on NotifyWorkflowAboutChanges")] + public static partial void TabWorkflowTrackerCurrentWorkflowAndDefaultWorkflowAreNotFoundOnNotifyWorkflowAboutChanges(this ILogger logger); + + // DotNetNuke.Entities.Tabs.TabVersions.TabVersionBuilder (150,200 to 150,299) + [LoggerMessage(EventId = 150_200, Level = LogLevel.Error)] + public static partial void TabVersionBuilderConvertToModuleInfoException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 150_201, Level = LogLevel.Error, Message = "There was a problem making rollback of the module {ModuleId}.")] + public static partial void TabVersionBuilderProblemMakingRollbackOfTheModule(this ILogger logger, DnnTabVersionException exception, int moduleId); + + // DotNetNuke.Entities.Tabs.TabPublishingController (150,300 to 150,399) + [LoggerMessage(EventId = 150_300, Level = LogLevel.Error, Message = "{ErrorMessage}")] + public static partial void TabPublishingControllerPermissionsAreNotMetThePageHasNotBeenPublished(this ILogger logger, Entities.Tabs.PermissionsNotMetException exception, string errorMessage); + + /* + * 160,000 to 169,999 + * DotNetNuke.Entities.Urls namespace + * DotNetNuke.Entities.Urls.Config namespace + */ + + // DotNetNuke.Entities.Urls.UrlRewriterUtils (160,000 to 160,099) + [LoggerMessage(EventId = 160_000, Level = LogLevel.Error)] + public static partial void UrlRewriterUtilsLogExceptionInRequest(this ILogger logger, Exception exception); + + // DotNetNuke.Entities.Urls.Config.RewriterConfiguration (160,100 to 160,199) + [LoggerMessage(EventId = 160_100, Level = LogLevel.Error, Message = "{LogInfo}")] + public static partial void RewriterConfigurationGetConfigFailed(this ILogger logger, LogInfo logInfo); + + /* + * 200,000 to 200,999 + * DotNetNuke.Services.Analytics namespace + * DotNetNuke.Services.Analytics.Config namespace + */ + + // DotNetNuke.Services.Analytics.GoogleAnalyticsController (200,000 to 200,099) + [LoggerMessage(EventId = 200_000, Level = LogLevel.Error)] + public static partial void GoogleAnalyticsControllerGetConfigFileException(this ILogger logger, Exception exception); + + // DotNetNuke.Services.Analytics.Config.AnalyticsConfiguration (200,100 to 200,199) + [LoggerMessage(EventId = 200_100, Level = LogLevel.Error)] + public static partial void AnalyticsConfigGetConfigException(this ILogger logger, Exception exception); + + /* + * 202,000 to 202,999 + * DotNetNuke.Services.Authentication namespace + * DotNetNuke.Services.Authentication.OAuth namespace + */ + + // DotNetNuke.Services.Authentication.OAuth.OAuthClientBase (202,000 to 202,099) + [LoggerMessage(EventId = 202_000, Level = LogLevel.Error, Message = "WebResponse exception: {ResponseContent}")] + public static partial void OAuthClientBaseWebResponseException(this ILogger logger, WebException exception, string responseContent); + + // DotNetNuke.Services.Authentication.AuthenticationConfig (202,100 to 202,199) + [LoggerMessage(EventId = 202_100, Level = LogLevel.Error)] + public static partial void AuthenticationConfigConstructorException(this ILogger logger, Exception exception); + + // DotNetNuke.Services.Authentication.AuthenticationController (202,200 to 202,299) + [LoggerMessage(EventId = 202_200, Level = LogLevel.Error)] + public static partial void AuthenticationControllerGetAuthenticationTypeException(this ILogger logger, Exception exception); + + /* + * 216,000 to 216,999 + * DotNetNuke.Services.Scheduling namespace + */ + + // DotNetNuke.Services.Scheduling.ScheduleHistoryItem (216,000 to 216,099) + [LoggerMessage(EventId = 216_000, Level = LogLevel.Debug, Message = "ScheduleHistoryItem.Succeeded Info (ScheduledTask Start): {FriendlyName}")] + public static partial void ScheduleHistoryItemSucceededStart(this ILogger logger, string friendlyName); + + [LoggerMessage(EventId = 216_001, Level = LogLevel.Debug, Message = "ScheduleHistoryItem.Succeeded Info (ScheduledTask End): {FriendlyName}")] + public static partial void ScheduleHistoryItemSucceededEnd(this ILogger logger, string friendlyName); + + [LoggerMessage(EventId = 216_002, Level = LogLevel.Trace, Message = "{Notes}")] + public static partial void ScheduleHistoryItemLogNote(this ILogger logger, string notes); + + // DotNetNuke.Services.Scheduling.Scheduler (216,100 to 216,199) + [LoggerMessage(EventId = 216_100, Level = LogLevel.Debug)] + public static partial void SchedulerReaderLockRequestTimeout(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 216_101, Level = LogLevel.Debug, Message = "loadqueue executingServer: {ExecutingServer}")] + public static partial void SchedulerLoadQueue(this ILogger logger, string executingServer); + + [LoggerMessage(EventId = 216_102, Level = LogLevel.Debug, Message = "LoadQueueFromTimer executingServer: {ExecutingServer}")] + public static partial void SchedulerLoadQueueFromTimer(this ILogger logger, string executingServer); + + // DotNetNuke.Services.Scheduling.ProcessGroup (216,200 to 216,299) + [LoggerMessage(EventId = 216_200, Level = LogLevel.Error)] + public static partial void ProcessGroupDoWorkException(this ILogger logger, Exception exception); + + /* + * 217,000 to 217,999 + * DotNetNuke.Services.Sitemap namespace + */ + + // DotNetNuke.Services.Sitemap.CoreSitemapProvider (217,000 to 217,099) + [LoggerMessage(EventId = 217_000, Level = LogLevel.Error, Message = "Error has occurred getting PageUrl for {TabName}")] + public static partial void CoreSitemapProviderErrorGettingPageUrl(this ILogger logger, Exception exception, string tabName); + + /* + * 219,000 to 219,999 + * DotNetNuke.Services.SystemHealth namespace + */ + + // DotNetNuke.Services.SystemHealth.WebServerMonitor (219,000 to 219,099) + [LoggerMessage(EventId = 219_000, Level = LogLevel.Information, Message = "Starting WebServerMonitor")] + public static partial void WebServerMonitorStartingWebServerMonitor(this ILogger logger); + + [LoggerMessage(EventId = 219_001, Level = LogLevel.Information, Message = "Starting UpdateCurrentServerActivity")] + public static partial void WebServerMonitorStartingUpdateCurrentServerActivity(this ILogger logger); + + [LoggerMessage(EventId = 219_002, Level = LogLevel.Information, Message = "Starting RemoveInActiveServers")] + public static partial void WebServerMonitorStartingRemoveInActiveServers(this ILogger logger); + + [LoggerMessage(EventId = 219_003, Level = LogLevel.Information, Message = "Finished RemoveInActiveServers")] + public static partial void WebServerMonitorFinishedRemoveInActiveServers(this ILogger logger); + + [LoggerMessage(EventId = 219_004, Level = LogLevel.Information, Message = "Finished UpdateCurrentServerActivity")] + public static partial void WebServerMonitorFinishedUpdateCurrentServerActivity(this ILogger logger); + + [LoggerMessage(EventId = 219_005, Level = LogLevel.Information, Message = "Finished WebServerMonitor")] + public static partial void WebServerMonitorFinishedWebServerMonitor(this ILogger logger); + + [LoggerMessage(EventId = 219_006, Level = LogLevel.Error, Message = "Error in WebServerMonitor: {Message}. {StackTrace}")] + public static partial void WebServerMonitorErrorInWebServerMonitor(this ILogger logger, Exception exception, string message, string stackTrace); + + /* + * 221,000 to 221,999 + * DotNetNuke.Services.UserProfile namespace + */ + + // DotNetNuke.Services.UserProfile.UserProfilePageHandler (221,000 to 221,099) + [LoggerMessage(EventId = 221_000, Level = LogLevel.Debug)] + public static partial void UserProfilePageHandlerException(this ILogger logger, Exception exception); + + /* + * 225,000 to 229,999 + * DotNetNuke.Services.Exceptions namespace + */ + + // DotNetNuke.Services.Exceptions.Exceptions (225,000 to 225,099) + [LoggerMessage(EventId = 225_000, Level = LogLevel.Error, Message = "FriendlyMessage=\"{FriendlyMessage}\" ctrl=\"{Control}\"")] + public static partial void ExceptionsProcessModuleLoadException(this ILogger logger, Exception exception, string friendlyMessage, Control control); + + [LoggerMessage(EventId = 225_001, Level = LogLevel.Error)] + public static partial void ExceptionsGetExceptionInfoReflectionPermissionException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 225_002, Level = LogLevel.Error)] + public static partial void ExceptionsLogModuleLoadException(this ILogger logger, ModuleLoadException exception); + + [LoggerMessage(EventId = 225_003, Level = LogLevel.Error)] + public static partial void ExceptionsLogPageLoadException(this ILogger logger, PageLoadException exception); + + [LoggerMessage(EventId = 225_004, Level = LogLevel.Error)] + public static partial void ExceptionsLogSchedulerException(this ILogger logger, SchedulerException exception); + + [LoggerMessage(EventId = 225_005, Level = LogLevel.Error)] + public static partial void ExceptionsLogSecurityException(this ILogger logger, SecurityException exception); + + [LoggerMessage(EventId = 225_006, Level = LogLevel.Error)] + public static partial void ExceptionsLogGeneralException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 225_007, Level = LogLevel.Error)] + public static partial void ExceptionsProcessSchedulerException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 225_008, Level = LogLevel.Error)] + public static partial void ExceptionsLogSearchException(this ILogger logger, SearchException exception); + + [LoggerMessage(EventId = 225_009, Level = LogLevel.Error, Message = "{URL}")] + public static partial void ExceptionsProcessPageLoadExceptionWithUrl(this ILogger logger, Exception exception, string url); + + [LoggerMessage(EventId = 225_010, Level = LogLevel.Error, Message = "{ResourceNotFound}: - {URL}")] + public static partial void ExceptionsProcessHttpException(this ILogger logger, Exception exception, string resourceNotFound, string url); + + [LoggerMessage(EventId = 225_011, Level = LogLevel.Critical)] + public static partial void ExceptionsProcessModuleLoadExceptionUnexpectedException(this ILogger logger, Exception exception); + + // DotNetNuke.Services.Exceptions.SecurityException (225,100 to 225,199) + [LoggerMessage(EventId = 225_100, Level = LogLevel.Error)] + public static partial void SecurityExceptionInitializeProviderVariablesException(this ILogger logger, Exception exception); + + // DotNetNuke.Services.Exceptions.BasePortalException (225,200 to 225,299) + [LoggerMessage(EventId = 225_200, Level = LogLevel.Error)] + public static partial void BasePortalExceptionExceptionGettingDataProviderType(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 225_201, Level = LogLevel.Error)] + public static partial void BasePortalExceptionExceptionGettingStackTrace(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 225_202, Level = LogLevel.Error)] + public static partial void BasePortalExceptionExceptionGettingMessage(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 225_203, Level = LogLevel.Error)] + public static partial void BasePortalExceptionExceptionGettingSource(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 225_204, Level = LogLevel.Error)] + public static partial void BasePortalExceptionInitializePrivateVariablesException(this ILogger logger, Exception exception); + + /* + * 230,000 to 239,999 + * DotNetNuke.Services.FileSystem namespace + * DotNetNuke.Services.FileSystem.EventArgs namespace + * DotNetNuke.Services.FileSystem.FolderMappings namespace + * DotNetNuke.Services.FileSystem.Internal namespace + * DotNetNuke.Services.FileSystem.Internal.SecurityCheckers namespace + */ + + // DotNetNuke.Services.FileSystem.FolderManager (230,000 to 230,099) + [LoggerMessage(EventId = 230_000, Level = LogLevel.Information, Message = "{Message}")] + public static partial void FolderManagerInvalidFileExtensionException(this ILogger logger, string message); + + [LoggerMessage(EventId = 230_001, Level = LogLevel.Error)] + public static partial void FolderManagerAddFolderException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 230_002, Level = LogLevel.Error)] + public static partial void FolderManagerDeleteFolderException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 230_003, Level = LogLevel.Error)] + public static partial void FolderManagerGetFileSystemFoldersRecursiveException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 230_004, Level = LogLevel.Error)] + public static partial void FolderManagerRemoveOrphanedFilesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 230_005, Level = LogLevel.Error)] + public static partial void FolderManagerAddOrUpdateFileException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 230_006, Level = LogLevel.Error)] + public static partial void FolderManagerSynchronizeFilesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 230_007, Level = LogLevel.Error)] + public static partial void FolderManagerDeleteFolderInternalException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 230_008, Level = LogLevel.Error, Message = "Could not create folder {FolderPath}. EXCEPTION: {Message}")] + public static partial void FolderManagerCouldNotCreateFolder(this ILogger logger, Exception exception, string folderPath, string message); + + // DotNetNuke.Services.FileSystem.FileManager (230,100 to 230,199) + [LoggerMessage(EventId = 230_100, Level = LogLevel.Warning)] + public static partial void FileManagerExtractFilesPermissionsNotMet(this ILogger logger, PermissionsNotMetException exception); + + [LoggerMessage(EventId = 230_101, Level = LogLevel.Warning)] + public static partial void FileManagerExtractFilesNoSpaceAvailable(this ILogger logger, NoSpaceAvailableException exception); + + [LoggerMessage(EventId = 230_102, Level = LogLevel.Warning)] + public static partial void FileManagerExtractFilesInvalidFileExtension(this ILogger logger, InvalidFileExtensionException exception); + + [LoggerMessage(EventId = 230_103, Level = LogLevel.Error)] + public static partial void FileManagerAddFileLockedException(this ILogger logger, FileLockedException exception); + + [LoggerMessage(EventId = 230_104, Level = LogLevel.Error)] + public static partial void FileManagerAddFileGeneralException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 230_105, Level = LogLevel.Error)] + public static partial void FileManagerCopyFileException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 230_106, Level = LogLevel.Error)] + public static partial void FileManagerFileExistsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 230_107, Level = LogLevel.Error)] + public static partial void FileManagerGetFileStreamException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 230_108, Level = LogLevel.Error)] + public static partial void FileManagerGetFileUrlException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 230_109, Level = LogLevel.Error)] + public static partial void FileManagerRenameFileException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 230_110, Level = LogLevel.Error)] + public static partial void FileManagerSetAttributesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 230_111, Level = LogLevel.Error)] + public static partial void FileManagerUpdateSizeAndModificationTimeException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 230_112, Level = LogLevel.Error)] + public static partial void FileManagerUpdateExtractFilesGeneralException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 230_113, Level = LogLevel.Error)] + public static partial void FileManagerWriteToStreamException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 230_114, Level = LogLevel.Error)] + public static partial void FileManagerWriteStreamException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 230_115, Level = LogLevel.Error)] + public static partial void FileManagerDeleteFileException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 230_116, Level = LogLevel.Error)] + public static partial void FileManagerAddFileException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 230_117, Level = LogLevel.Error)] + public static partial void FileManagerRotateFlipImageException(this ILogger logger, Exception exception); + + // DotNetNuke.Services.FileSystem.StandardFolderProvider (230,200 to 230,299) + [LoggerMessage(EventId = 230_200, Level = LogLevel.Warning, Message = "{Message}")] + public static partial void StandardFolderProviderFileStreamIOException(this ILogger logger, IOException exception, string message); + + [LoggerMessage(EventId = 230_201, Level = LogLevel.Error)] + public static partial void StandardFolderProviderGetFileAttributesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 230_202, Level = LogLevel.Error)] + public static partial void StandardFolderProviderGetLastModificationTimeException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 230_203, Level = LogLevel.Error)] + public static partial void StandardFolderProviderFileStreamGeneralException(this ILogger logger, Exception exception); + + // DotNetNuke.Services.FileSystem.FolderMappingsConfigController (230,300 to 230,399) + [LoggerMessage(EventId = 230_300, Level = LogLevel.Error)] + public static partial void FolderMappingsConfigControllerLoadConfigException(this ILogger logger, Exception exception); + + // DotNetNuke.Services.FileSystem.FileServerHandler (230,400 to 230,499) + [LoggerMessage(EventId = 230_400, Level = LogLevel.Error)] + public static partial void FileServerHandlerHandleFileLinkException(this ILogger logger, Exception exception); + + // DotNetNuke.Services.FileSystem.Internal.FileDeletionController (230,500 to 230,599) + [LoggerMessage(EventId = 230_500, Level = LogLevel.Error)] + public static partial void FileDeletionControllerDeleteFileException(this ILogger logger, Exception exception); + + // DotNetNuke.Services.FileSystem.Internal.FileSecurityController (230,600 to 230,699) + [LoggerMessage(EventId = 230_600, Level = LogLevel.Error, Message = "Create File Security Checker for '{Extension}' failed.")] + public static partial void FileSecurityControllerCreateFileSecurityCheckerFailed(this ILogger logger, Exception exception, string extension); + + /* + * 240,000 to 249,999 + * DotNetNuke.Services.Installer namespace + * DotNetNuke.Services.Installer.Blocker namespace + * DotNetNuke.Services.Installer.Dependencies namespace + * DotNetNuke.Services.Installer.Installers namespace + * DotNetNuke.Services.Installer.Log namespace + * DotNetNuke.Services.Installer.Packages namespace + * DotNetNuke.Services.Installer.Packages.WebControls namespace + * DotNetNuke.Services.Installer.Writers namespace + */ + + // DotNetNuke.Services.Installer.Log.Logger (240,000 to 240,099) + [LoggerMessage(EventId = 240_000, Level = LogLevel.Information, Message = "{Message}")] + public static partial void InstallLoggerLogInfo(this ILogger logger, string message); + + [LoggerMessage(EventId = 240_001, Level = LogLevel.Warning, Message = "{Message}")] + public static partial void InstallLoggerLogWarning(this ILogger logger, string message); + + [LoggerMessage(EventId = 240_002, Level = LogLevel.Error, Message = "{Message}")] + public static partial void InstallLoggerLogFailure(this ILogger logger, string message); + + // DotNetNuke.Services.Installer.Installers.CleanupInstaller (240,100 to 240,199) + [LoggerMessage(EventId = 240_100, Level = LogLevel.Warning, Message = "Ignoring invalid cleanup folder path '{Path}' in package '{PackageName}'.")] + public static partial void CleanupInstallerIgnoringInvalidCleanupFolderPath(this ILogger logger, string path, string packageName); + + [LoggerMessage(EventId = 240_101, Level = LogLevel.Error)] + public static partial void CleanupInstallerCleanupFileException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 240_101, Level = LogLevel.Error)] + public static partial void CleanupInstallerCleanupFolderException(this ILogger logger, Exception exception); + + // DotNetNuke.Services.Installer.Installer (240,200 to 240,299) + [LoggerMessage(EventId = 240_200, Level = LogLevel.Error)] + public static partial void InstallerBackupStreamInfoFileException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 240_201, Level = LogLevel.Error)] + public static partial void InstallerLogInstallEventException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 240_022, Level = LogLevel.Error, Message = "Exception deleting folder {TempInstallFolder} while installing {Name}")] + public static partial void InstallerExceptionDeletingFolderWhileInstalling(this ILogger logger, Exception exception, string tempInstallFolder, string name); + + // DotNetNuke.Services.Installer.Installers.ResourceFileInstaller (240,300 to 240,399) + [LoggerMessage(EventId = 240_300, Level = LogLevel.Error)] + public static partial void ResourceFileInstallerInstallFileException(this ILogger logger, Exception exception); + + // DotNetNuke.Services.Installer.Writers.ModulePackageWriter (240,400 to 240,499) + [LoggerMessage(EventId = 240_400, Level = LogLevel.Error)] + public static partial void ModulePackageWriterConvertControlTypeException(this ILogger logger, Exception exception); + + /* + * 250,000 to 259,999 + * DotNetNuke.Services.Localization namespace + * DotNetNuke.Services.Localization.Internal namespace + * DotNetNuke.Services.Localization.Persian namespace + */ + + // DotNetNuke.Services.Localization.LocalizationProvider (250,000 to 250,099) + [LoggerMessage(EventId = 250_000, Level = LogLevel.Warning, Message = "Missing localization key. key:{Key} resFileRoot:{ResourceFileRoot} threadCulture:{ThreadCulture} userlan:{UserLanguage}")] + public static partial void LocalizationProviderMissingLocalizationKey(this ILogger logger, string key, string resourceFileRoot, CultureInfo threadCulture, string userLanguage); + + [LoggerMessage(EventId = 250_001, Level = LogLevel.Error)] + public static partial void LocalizationProviderGetLocaleException(this ILogger logger, Exception exception); + + // DotNetNuke.Services.Localization.Localization (250,100 to 250,199) + [LoggerMessage(EventId = 250_100, Level = LogLevel.Error)] + public static partial void LocalizationGetSystemMessageException(this ILogger logger, NullReferenceException exception); + + /* + * 260,000 to 269,999 + * DotNetNuke.Services.Log.EventLog namespace + */ + + // DotNetNuke.Services.Log.EventLog.LogController (260,000 to 260,099) + [LoggerMessage(EventId = 260_000, Level = LogLevel.Debug)] + public static partial void LogControllerConfigFileNotFound(this ILogger logger, FileNotFoundException exception); + + [LoggerMessage(EventId = 260_001, Level = LogLevel.Information, Message = "{LogInfo}")] + public static partial void LogControllerLogInfo(this ILogger logger, LogInfo logInfo); + + [LoggerMessage(EventId = 260_001, Level = LogLevel.Debug)] + public static partial void LogControllerFailureToWriteToLogFile(this ILogger logger, IOException exception); + + [LoggerMessage(EventId = 260_002, Level = LogLevel.Error, Message = "filePath={FilePath}, header={Header}, message={Message}")] + public static partial void LogControllerRaiseError(this ILogger logger, string filePath, string header, string message); + + [LoggerMessage(EventId = 260_003, Level = LogLevel.Error)] + public static partial void LogControllerAddLogException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 260_004, Level = LogLevel.Error)] + public static partial void LogControllerAddLogToFileException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 260_005, Level = LogLevel.Error, Message = "Unable to retrieve HttpContext.Request, ignoring LogUserName")] + public static partial void LogControllerUnableToRetrieveRequestIgnoringLogUserName(this ILogger logger, Exception exception); + + // DotNetNuke.Services.Log.EventLog.DBLoggingProvider (260,100 to 260,199) + [LoggerMessage(EventId = 260_100, Level = LogLevel.Error)] + public static partial void DbLoggingProviderFillLogInfoException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 260_101, Level = LogLevel.Error)] + public static partial void DbLoggingProviderWriteLogSqlException(this ILogger logger, SqlException exception); + + [LoggerMessage(EventId = 260_102, Level = LogLevel.Error)] + public static partial void DbLoggingProviderWriteLogGeneralException(this ILogger logger, Exception exception); + + /* + * 270,000 to 279,999 + * DotNetNuke.Services.Mail namespace + * DotNetNuke.Services.Mail.OAuth namespace + */ + + // DotNetNuke.Services.Mail.SendTokenizedBulkEmail (270,000 to 270,099) + [LoggerMessage(EventId = 270_000, Level = LogLevel.Error)] + public static partial void SendTokenizedBulkEmailSendMailsException(this ILogger logger, Exception exception); + + /* + * 290,000 to 299,999 + * DotNetNuke.Services.Cache namespace + * DotNetNuke.Services.ModuleCache namespace + * DotNetNuke.Services.OutputCache namespace + * DotNetNuke.Services.OutputCache.Providers namespace + */ + + // DotNetNuke.Services.ModuleCache.PurgeModuleCache (290,000 to 290,099) + [LoggerMessage(EventId = 290_000, Level = LogLevel.Debug)] + public static partial void PurgeModuleCachePurgeNotSupportedException(this ILogger logger, NotSupportedException exception); + + // DotNetNuke.Services.OutputCache.PurgeOutputCache (290,100 to 290,199) + [LoggerMessage(EventId = 290_100, Level = LogLevel.Debug)] + public static partial void PurgeOutputCachePurgeNotSupportedException(this ILogger logger, NotSupportedException exception); + + // DotNetNuke.Services.Cache.CachingProvider (290,200 to 290,299) + [LoggerMessage(EventId = 290_200, Level = LogLevel.Warning, Message = "Disable cache expiration.")] + public static partial void CachingProviderDisableCacheExpiration(this ILogger logger); + + [LoggerMessage(EventId = 290_201, Level = LogLevel.Warning, Message = "Enable cache expiration.")] + public static partial void CachingProviderEnableCacheExpiration(this ILogger logger); + + // DotNetNuke.Services.Cache.FBCachingProvider (290,300 to 290,399) + [LoggerMessage(EventId = 290_300, Level = LogLevel.Error)] + public static partial void FbCachingProviderPurgeDeleteFileException(this ILogger logger, Exception exception); + + /* + * 300,000 to 309,999 + * DotNetNuke.Services.Search namespace + * DotNetNuke.Services.Search.Controllers namespace + * DotNetNuke.Services.Search.Entities namespace + * DotNetNuke.Services.Search.Internals namespace + */ + + // DotNetNuke.Services.Search.Internals.LuceneControllerImpl (300,000 to 300,099) + [LoggerMessage(EventId = 300_000, Level = LogLevel.Trace, Message = "Query: {Query}\n{Explanation}")] + public static partial void LuceneControllerSearchResultExplanation(this ILogger logger, Query query, string explanation); + + [LoggerMessage(EventId = 300_001, Level = LogLevel.Debug, Message = "Compacting Search Index - started")] + public static partial void LuceneControllerCompactingSearchIndexStarted(this ILogger logger); + + [LoggerMessage(EventId = 300_002, Level = LogLevel.Debug, Message = "Compacting Search Index - finished")] + public static partial void LuceneControllerCompactingSearchIndexFinished(this ILogger logger); + + [LoggerMessage(EventId = 300_003, Level = LogLevel.Error)] + public static partial void LuceneControllerSearchException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 300_004, Level = LogLevel.Error)] + public static partial void LuceneControllerGetCustomAnalyzerException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 300_005, Level = LogLevel.Error, Message = "Search Index Folder Is Not Available: {Message}, Retry {Retries} time(s).")] + public static partial void LuceneControllerSearchIndexFolderIsNotAvailable(this ILogger logger, Exception exception, string message, int retries); + + // DotNetNuke.Services.Search.ModuleIndexer (300,100 to 300,199) + [LoggerMessage(EventId = 300_100, Level = LogLevel.Trace, Message = "ModuleIndexer: {Count} search documents found for module [{DesktopModuleName} mid:{ModuleId}]")] + public static partial void ModuleIndexerSearchDocumentsFoundForModule(this ILogger logger, int count, string desktopModuleName, int moduleId); + + [LoggerMessage(EventId = 300_101, Level = LogLevel.Trace, Message = "ModuleIndexer: Search document for metaData found for module [{DesktopModuleName} mid:{ModuleId}]")] + public static partial void ModuleIndexerSearchDocumentForMetadataFoundForModule(this ILogger logger, string desktopModuleName, int moduleId); + + [LoggerMessage(EventId = 300_102, Level = LogLevel.Error)] + public static partial void ModuleIndexerGetModulesForIndexException(this ILogger logger, Exception exception); + + // DotNetNuke.Services.Search.TabIndexer (300,200 to 300,299) + [LoggerMessage(EventId = 300_200, Level = LogLevel.Trace, Message = "TabIndexer: Search document for metaData added for page [{Title} tid:{TabId}]")] + public static partial void TabIndexerPageMetadataDocumentAdded(this ILogger logger, string title, int tabId); + + // DotNetNuke.Services.Search.SearchEngineScheduler (300,300 to 300,399) + [LoggerMessage(EventId = 300_300, Level = LogLevel.Trace, Message = "Search: Site Crawler - Starting. Content change start time {LastSuccessfulDateTime}")] + public static partial void SearchEngineSchedulerStarting(this ILogger logger, DateTime lastSuccessfulDateTime); + + [LoggerMessage(EventId = 300_301, Level = LogLevel.Trace, Message = "Search: Site Crawler - Indexing Successful")] + public static partial void SearchEngineSchedulerSuccessful(this ILogger logger); + + // DotNetNuke.Services.Search.SearchEngineIndexer (300,400 to 300,499) + [LoggerMessage(EventId = 300_400, Level = LogLevel.Warning, Message = "Indexer not implemented")] + public static partial void SearchEngineIndexerNotImplemented(this ILogger logger, NotImplementedException exception); + + // DotNetNuke.Services.Search.Internals.InternalSearchControllerImpl (300,500 to 300,599) + [LoggerMessage(EventId = 300_500, Level = LogLevel.Error, Message = "Search Document error: {SearchDocument}")] + public static partial void InternalSearchControllerSearchDocumentError(this ILogger logger, Exception exception, SearchDocument searchDocument); + + // DotNetNuke.Services.Search.Controllers.ModuleResultController (300,600 to 300,699) + [LoggerMessage(EventId = 300_600, Level = LogLevel.Error)] + public static partial void ModuleResultControllerGetModuleSearchUrlException(this ILogger logger, Exception exception); + + /* + * 310,000 to 319,999 + * DotNetNuke.Services.Upgrade namespace + * DotNetNuke.Services.Upgrade.InternalController.Steps namespace + * DotNetNuke.Services.Upgrade.Internals namespace + * DotNetNuke.Services.Upgrade.Internals.InstallConfiguration namespace + * DotNetNuke.Services.Upgrade.Internals.Steps namespace + */ + + // DotNetNuke.Services.Upgrade.Internals.Steps.AddFcnModeStep (310,000 to 310,099) + [LoggerMessage(EventId = 310_000, Level = LogLevel.Trace, Message = "Adding FcnMode : {ErrorMessage}")] + public static partial void AddFcnModeStepAddingFcnMode(this ILogger logger, string errorMessage); + + // DotNetNuke.Services.Upgrade.InternalController.Steps.FilePermissionCheckStep (310,100 to 310,199) + [LoggerMessage(EventId = 310_100, Level = LogLevel.Trace, Message = "FilePermissionCheck - {Details}")] + public static partial void FilePermissionCheckStepCheck(this ILogger logger, string details); + + [LoggerMessage(EventId = 310_101, Level = LogLevel.Trace, Message = "FilePermissionCheck Status - {Status}")] + public static partial void FilePermissionCheckStepStatus(this ILogger logger, StepStatus status); + + // DotNetNuke.Services.Upgrade.Internals.Steps.InstallVersionStep (310,200 to 310,299) + [LoggerMessage(EventId = 310_200, Level = LogLevel.Trace, Message = "Adding InstallVersion : {ErrorMessage}")] + public static partial void InstallVersionStepAddingInstallVersion(this ILogger logger, string errorMessage); + + // DotNetNuke.Services.Upgrade.Upgrade (310,300 to 310,399) + [LoggerMessage(EventId = 310_300, Level = LogLevel.Trace, Message = "GetUpgradedScripts databaseVersion:{DatabaseVersion} applicationVersion:{ApplicationVersion}")] + public static partial void UpgradeGetUpgradedScripts(this ILogger logger, Version databaseVersion, Version applicationVersion); + + [LoggerMessage(EventId = 310_301, Level = LogLevel.Trace, Message = "GetUpgradedScripts including {File}")] + public static partial void UpgradeGetUpgradedScriptsIncluding(this ILogger logger, string file); + + [LoggerMessage(EventId = 310_302, Level = LogLevel.Error)] + public static partial void UpgradeAddModuleException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 310_303, Level = LogLevel.Error)] + public static partial void UpgradeAddPortalException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 310_304, Level = LogLevel.Error)] + public static partial void UpgradeDeleteFilesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 310_305, Level = LogLevel.Error)] + public static partial void UpgradeExceptionDeletingScriptFileAfterExecution(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 310_306, Level = LogLevel.Error)] + public static partial void UpgradeExceptionDeletingPackageFileAfterInstallation(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 310_307, Level = LogLevel.Error)] + public static partial void UpgradeExceptionInUpgradeApplication(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 310_308, Level = LogLevel.Error)] + public static partial void UpgradeExceptionLoggingException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 310_309, Level = LogLevel.Error, Message = "{Version}")] + public static partial void UpgradeExceptionDuringVersionSpecificUpgrade(this ILogger logger, Exception exception, Version version); + + [LoggerMessage(EventId = 310_310, Level = LogLevel.Error, Message = "{Version}")] + public static partial void UpgradeExceptionWritingExceptionLogForVersionSpecificUpgrade(this ILogger logger, Exception exception, Version version); + + [LoggerMessage(EventId = 310_311, Level = LogLevel.Error)] + public static partial void UpgradeExceptionUpdatingConfig(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 310_312, Level = LogLevel.Error)] + public static partial void UpgradeExceptionLoggingExceptionFromUpdatingConfig(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 310_313, Level = LogLevel.Error)] + public static partial void UpgradeUpdateNewtonsoftVersionException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 310_314, Level = LogLevel.Error)] + public static partial void UpgradeCreateExecuteScriptLogException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 310_315, Level = LogLevel.Error)] + public static partial void UpgradeCreateMemberRoleProviderLogException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 310_316, Level = LogLevel.Error)] + public static partial void UpgradeRemoveGettingStartedPageException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 310_317, Level = LogLevel.Error)] + public static partial void UpgradeFixFipsComplianceAssemblyException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 310_318, Level = LogLevel.Error)] + public static partial void UpgradeFindLanguageXmlDocumentException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 310_319, Level = LogLevel.Error, Message = "Error cleanup file {ListFile}")] + public static partial void UpgradeErrorCleanupFile(this ILogger logger, Exception exception, string listFile); + + [LoggerMessage(EventId = 310_320, Level = LogLevel.Error, Message = "File deletion failed for [Install/{File}]. PLEASE REMOVE THIS MANUALLY.")] + public static partial void UpgradeFileDeletionFailedFor(this ILogger logger, Exception exception, string file); + + [LoggerMessage(EventId = 310_321, Level = LogLevel.Error, Message = "{LogDescription}")] + public static partial void UpgradeFailureLog(this ILogger logger, string logDescription); + + // DotNetNuke.Services.Upgrade.InternalController.Steps.InstallExtensionsStep (310,400 to 310,499) + [LoggerMessage(EventId = 310_400, Level = LogLevel.Trace, Message = "{Details}")] + public static partial void InstallExtensionsStepInstallingExtensionPackage(this ILogger logger, string details); + + // DotNetNuke.Services.Upgrade.InternalController.Steps.UpdateLanguagePackStep (310,500 to 310,599) + [LoggerMessage(EventId = 310_500, Level = LogLevel.Error)] + public static partial void UpdateLanguagePackStepExecuteException(this ILogger logger, Exception exception); + + /* + * 601,000 to 601,999 + * DotNetNuke.UI.Containers namespace + * DotNetNuke.UI.Containers.EventListeners namespace + */ + + // DotNetNuke.UI.Containers.Container (601,000 to 601,099) + [LoggerMessage(EventId = 601_000, Level = LogLevel.Debug, Message = "Container.ProcessModule Start (TabId:{TabId},ModuleID: {DesktopModuleId}): Module FriendlyName: '{ModuleFriendlyName}')")] + public static partial void ContainerProcessModuleStart(this ILogger logger, int tabId, int desktopModuleId, string moduleFriendlyName); + + [LoggerMessage(EventId = 601_001, Level = LogLevel.Debug, Message = "Container.ProcessModule Info (TabId:{TabId},ModuleID: {DesktopModuleId}): ControlPane.Controls.Add(ModuleHost:{ModuleHostId})")] + public static partial void ContainerProcessModuleInfo(this ILogger logger, int tabId, int desktopModuleId, string moduleHostId); + + [LoggerMessage(EventId = 601_002, Level = LogLevel.Debug, Message = "Container.ProcessModule End (TabId:{TabId},ModuleID: {DesktopModuleId}): Module FriendlyName: '{ModuleFriendlyName}')")] + public static partial void ContainerProcessModuleEnd(this ILogger logger, int tabId, int desktopModuleId, string moduleFriendlyName); + + /* + * 603,000 to 603,999 + * DotNetNuke.UI.Modules namespace + * DotNetNuke.UI.Modules.Html5 namespace + */ + + // DotNetNuke.UI.Modules.ModuleControlFactory (603,000 to 603,099) + [LoggerMessage(EventId = 603_000, Level = LogLevel.Debug, Message = "ModuleControlFactory.LoadModuleControl Start (TabId:{TabId},ModuleId:{ModuleId}): ModuleControlSource:{ModuleControlSource}")] + public static partial void ModuleControlFactoryLoadModuleControlStart(this ILogger logger, int tabId, int moduleId, string moduleControlSource); + + [LoggerMessage(EventId = 603_001, Level = LogLevel.Debug, Message = "ModuleControlFactory.LoadModuleControl End (TabId:{TabId},ModuleId:{ModuleId}): ModuleControlSource:{ModuleControlSource}")] + public static partial void ModuleControlFactoryLoadModuleControlEnd(this ILogger logger, int tabId, int moduleId, string moduleControlSource); + + [LoggerMessage(EventId = 603_002, Level = LogLevel.Debug, Message = "ModuleControlFactory.LoadSettingsControl Start (TabId:{TabId},ModuleId:{ModuleId}): ModuleControlSource:{ModuleControlSource}")] + public static partial void ModuleControlFactoryLoadSettingsControlStart(this ILogger logger, int tabId, int moduleId, string moduleControlSource); + + [LoggerMessage(EventId = 603_003, Level = LogLevel.Debug, Message = "ModuleControlFactory.LoadSettingsControl End (TabId:{TabId},ModuleId:{ModuleId}): ModuleControlSource:{ModuleControlSource}")] + public static partial void ModuleControlFactoryLoadSettingsControlEnd(this ILogger logger, int tabId, int moduleId, string moduleControlSource); + + // DotNetNuke.UI.Modules.ModuleHost (603,100 to 603,199) + [LoggerMessage(EventId = 603_100, Level = LogLevel.Debug)] + public static partial void ModuleHostThreadAbortException(this ILogger logger, ThreadAbortException exception); + + [LoggerMessage(EventId = 603_101, Level = LogLevel.Error)] + public static partial void ModuleHostLoadModuleControlException(this ILogger logger, Exception exception); + + /* + * 604,000 to 604,999 + * DotNetNuke.UI.Skins namespace + * DotNetNuke.UI.Skins.Controls namespace + * DotNetNuke.UI.Skins.Controls.EventListeners namespace + */ + + // DotNetNuke.UI.Skins.SkinThumbNailControl (604,000 to 604,099) + [LoggerMessage(EventId = 604_000, Level = LogLevel.Error)] + public static partial void SkinThumbNailControlCreateThumbnailException(this ILogger logger, Exception exception); + + // DotNetNuke.UI.Skins.SkinFileProcessor (604,100 to 604,199) + [LoggerMessage(EventId = 604_100, Level = LogLevel.Error)] + public static partial void SkinFileProcessorLoadXmlFileException(this ILogger logger, Exception exception); + + // DotNetNuke.UI.Skins.SkinFileProcessor+SkinFile (604,200 to 604,299) + [LoggerMessage(EventId = 604_200, Level = LogLevel.Error)] + public static partial void SkinFileLoadXmlFileException(this ILogger logger, Exception exception); + + // DotNetNuke.UI.Skins.SkinController (604,300 to 604,399) + [LoggerMessage(EventId = 604_300, Level = LogLevel.Error)] + public static partial void SkinControllerExceptionLoggingInstallationEvent(this ILogger logger, Exception exception); + + /* + * 607,000 to 607,999 + * DotNetNuke.UI.WebControls namespace + * DotNetNuke.UI.WebControls.Internal namespace + */ + + // DotNetNuke.UI.WebControls.CaptchaControl (607,000 to 607,099) + [LoggerMessage(EventId = 607_000, Level = LogLevel.Debug)] + public static partial void CaptchaControlDecryptException(this ILogger logger, ArgumentException exception); + + [LoggerMessage(EventId = 607_001, Level = LogLevel.Error)] + public static partial void CaptchaControlCreateTextException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 607_002, Level = LogLevel.Error)] + public static partial void CaptchaControlGetFontException(this ILogger logger, Exception exception); + + // DotNetNuke.UI.WebControls.SettingInfo (607,100 to 607,199) + [LoggerMessage(EventId = 607_100, Level = LogLevel.Error)] + public static partial void SettingInfoBoolParseException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 607_101, Level = LogLevel.Error)] + public static partial void SettingInfoInt32ParseException(this ILogger logger, Exception exception); + + // DotNetNuke.UI.WebControls.TrueFalseEditControl (607,200 to 607,299) + [LoggerMessage(EventId = 607_200, Level = LogLevel.Error)] + public static partial void TrueFalseEditControlBooleanValueException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 607_201, Level = LogLevel.Error)] + public static partial void TrueFalseEditControlOldBooleanValueException(this ILogger logger, Exception exception); + + // DotNetNuke.UI.WebControls.IntegerEditControl (607,300 to 607,399) + [LoggerMessage(EventId = 607_300, Level = LogLevel.Error)] + public static partial void IntegerEditControlIntegerValueException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 607_301, Level = LogLevel.Error)] + public static partial void IntegerEditControlOldIntegerValueException(this ILogger logger, Exception exception); + + // DotNetNuke.UI.WebControls.DNNListEditControl (607,400 to 607,499) + [LoggerMessage(EventId = 607_400, Level = LogLevel.Error)] + public static partial void DnnListEditControlIntegerValueException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 607_401, Level = LogLevel.Error)] + public static partial void DnnListEditControlOldIntegerValueException(this ILogger logger, Exception exception); + + // DotNetNuke.UI.WebControls.DateEditControl (607,500 to 607,599) + [LoggerMessage(EventId = 607_500, Level = LogLevel.Error)] + public static partial void DateEditControlDateValueException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 607_501, Level = LogLevel.Error)] + public static partial void DateEditControlOldDateValueException(this ILogger logger, Exception exception); +} diff --git a/DNN Platform/Library/Security/Membership/AspNetMembershipProvider.cs b/DNN Platform/Library/Security/Membership/AspNetMembershipProvider.cs index 87ac9830bbe..c0d641b7421 100644 --- a/DNN Platform/Library/Security/Membership/AspNetMembershipProvider.cs +++ b/DNN Platform/Library/Security/Membership/AspNetMembershipProvider.cs @@ -1172,7 +1172,7 @@ private static void DeleteMembershipUser(UserInfo user) } catch (Exception exc) { - Logger.Error(exc); + Logger.AspNetMembershipProviderDeleteUserException(exc); } } diff --git a/DNN Platform/Library/Security/Roles/DNNRoleProvider.cs b/DNN Platform/Library/Security/Roles/DNNRoleProvider.cs index f28f1be85fd..ab7b3c34d9a 100644 --- a/DNN Platform/Library/Security/Roles/DNNRoleProvider.cs +++ b/DNN Platform/Library/Security/Roles/DNNRoleProvider.cs @@ -176,7 +176,7 @@ public override bool AddUserToRole(int portalId, UserInfo user, UserRoleInfo use catch (Exception exc) { // Clear User (duplicate User information) - Logger.Error(exc); + Logger.DnnRoleProviderAddUserToRoleException(exc); createStatus = false; } diff --git a/DNN Platform/Library/Security/Roles/RoleController.cs b/DNN Platform/Library/Security/Roles/RoleController.cs index d1f6ac11f1b..5e48c3c88d8 100644 --- a/DNN Platform/Library/Security/Roles/RoleController.cs +++ b/DNN Platform/Library/Security/Roles/RoleController.cs @@ -922,7 +922,7 @@ private void AutoAssignUsers(RoleInfo role) catch (Exception exc) { // user already belongs to role - Logger.Error(exc); + Logger.RoleControllerUserAlreadyBelongsToRoleException(exc); } } } diff --git a/DNN Platform/Library/Services/Analytics/Config/AnalyticsConfiguration.cs b/DNN Platform/Library/Services/Analytics/Config/AnalyticsConfiguration.cs index 5dfde3572c3..abc82095e5f 100644 --- a/DNN Platform/Library/Services/Analytics/Config/AnalyticsConfiguration.cs +++ b/DNN Platform/Library/Services/Analytics/Config/AnalyticsConfiguration.cs @@ -58,9 +58,7 @@ public static AnalyticsConfiguration GetConfig(string analyticsEngineName) { string cacheKey = analyticsEngineName + "." + PortalSettings.Current.PortalId; - var config = new AnalyticsConfiguration(); - config.Rules = new AnalyticsRuleCollection(); - config.Settings = new AnalyticsSettingCollection(); + var config = new AnalyticsConfiguration { Rules = [], Settings = [], }; string filePath = string.Empty; try @@ -87,7 +85,6 @@ public static AnalyticsConfiguration GetConfig(string analyticsEngineName) config.Rules = new AnalyticsRuleCollection(); config.Settings = new AnalyticsSettingCollection(); - var allSettings = new Hashtable(); foreach (XPathNavigator nav in doc.CreateNavigator().Select("AnalyticsConfig/Settings/AnalyticsSetting")) { var setting = new AnalyticsSetting(); @@ -126,7 +123,7 @@ public static AnalyticsConfiguration GetConfig(string analyticsEngineName) log.AddProperty("FilePath", filePath); log.AddProperty("ExceptionMessage", ex.Message); LogController.Instance.AddLog(log); - Logger.Error(ex); + Logger.AnalyticsConfigGetConfigException(ex); } return config; @@ -134,10 +131,10 @@ public static AnalyticsConfiguration GetConfig(string analyticsEngineName) public static void SaveConfig(string analyticsEngineName, AnalyticsConfiguration config) { - string cacheKey = analyticsEngineName + "." + PortalSettings.Current.PortalId; + string cacheKey = $"{analyticsEngineName}.{PortalSettings.Current.PortalId}"; if (config.Settings != null) { - // Create a new Xml Serializer + // Create a new XML Serializer var ser = new XmlSerializer(typeof(AnalyticsConfiguration)); string filePath = string.Empty; diff --git a/DNN Platform/Library/Services/Analytics/GoogleAnalyticsController.cs b/DNN Platform/Library/Services/Analytics/GoogleAnalyticsController.cs index ec785b98e9c..699471994b1 100644 --- a/DNN Platform/Library/Services/Analytics/GoogleAnalyticsController.cs +++ b/DNN Platform/Library/Services/Analytics/GoogleAnalyticsController.cs @@ -90,7 +90,7 @@ private static StreamReader GetConfigFile() LogController.Instance.AddLog(log); fileReader?.Close(); - Logger.Error(ex); + Logger.GoogleAnalyticsControllerGetConfigFileException(ex); } return fileReader; diff --git a/DNN Platform/Library/Services/Authentication/AuthenticationConfig.cs b/DNN Platform/Library/Services/Authentication/AuthenticationConfig.cs index eca85df8831..8c3b3abc7f3 100644 --- a/DNN Platform/Library/Services/Authentication/AuthenticationConfig.cs +++ b/DNN Platform/Library/Services/Authentication/AuthenticationConfig.cs @@ -41,7 +41,7 @@ protected AuthenticationConfig(int portalID) } catch (Exception ex) { - Logger.Error(ex); + Logger.AuthenticationConfigConstructorException(ex); } } diff --git a/DNN Platform/Library/Services/Authentication/AuthenticationController.cs b/DNN Platform/Library/Services/Authentication/AuthenticationController.cs index 4454e72c833..df950a8fa67 100644 --- a/DNN Platform/Library/Services/Authentication/AuthenticationController.cs +++ b/DNN Platform/Library/Services/Authentication/AuthenticationController.cs @@ -224,7 +224,7 @@ public static AuthenticationInfo GetAuthenticationType() } catch (Exception ex) { - Logger.Error(ex); + Logger.AuthenticationControllerGetAuthenticationTypeException(ex); } } diff --git a/DNN Platform/Library/Services/Authentication/OAuth/OAuthClientBase.cs b/DNN Platform/Library/Services/Authentication/OAuth/OAuthClientBase.cs index 9d5ceb17041..8c4fbf44c88 100644 --- a/DNN Platform/Library/Services/Authentication/OAuth/OAuthClientBase.cs +++ b/DNN Platform/Library/Services/Authentication/OAuth/OAuthClientBase.cs @@ -708,7 +708,7 @@ private string ExecuteWebRequest(HttpMethod method, Uri uri, string parameters, if (responseStream != null) { using var responseReader = new StreamReader(responseStream); - Logger.ErrorFormat(CultureInfo.InvariantCulture, "WebResponse exception: {0}", responseReader.ReadToEnd()); + Logger.OAuthClientBaseWebResponseException(ex, responseReader.ReadToEnd()); } } diff --git a/DNN Platform/Library/Services/Cache/CachingProvider.cs b/DNN Platform/Library/Services/Cache/CachingProvider.cs index 38b7273e7e5..39a59bcaefe 100644 --- a/DNN Platform/Library/Services/Cache/CachingProvider.cs +++ b/DNN Platform/Library/Services/Cache/CachingProvider.cs @@ -201,7 +201,7 @@ public virtual void Remove(string cacheKey) internal static void DisableCacheExpiration() { CacheExpirationDisable = true; - Logger.Warn("Disable cache expiration."); + Logger.CachingProviderDisableCacheExpiration(); } /// @@ -213,7 +213,7 @@ internal static void EnableCacheExpiration() { CacheExpirationDisable = false; DataCache.ClearHostCache(true); - Logger.Warn("Enable cache expiration."); + Logger.CachingProviderEnableCacheExpiration(); } /// Clears the cache internal. diff --git a/DNN Platform/Library/Services/Cache/FBCachingProvider.cs b/DNN Platform/Library/Services/Cache/FBCachingProvider.cs index ec82021d640..8f6fb113353 100644 --- a/DNN Platform/Library/Services/Cache/FBCachingProvider.cs +++ b/DNN Platform/Library/Services/Cache/FBCachingProvider.cs @@ -208,7 +208,7 @@ private static string PurgeCacheFiles(string folder) catch (Exception exc) { // an error occurred - Logger.Error(exc); + Logger.FbCachingProviderPurgeDeleteFileException(exc); purgeErrors += 1; } diff --git a/DNN Platform/Library/Services/Exceptions/BasePortalException.cs b/DNN Platform/Library/Services/Exceptions/BasePortalException.cs index 3ff3af24707..e2442f29cfa 100644 --- a/DNN Platform/Library/Services/Exceptions/BasePortalException.cs +++ b/DNN Platform/Library/Services/Exceptions/BasePortalException.cs @@ -195,7 +195,7 @@ private void InitializePrivateVariables() } catch (Exception exc) { - Logger.Error(exc); + Logger.BasePortalExceptionExceptionGettingDataProviderType(exc); this.DefaultDataProvider = string.Empty; } @@ -223,7 +223,7 @@ private void InitializePrivateVariables() } catch (Exception exc) { - Logger.Error(exc); + Logger.BasePortalExceptionExceptionGettingStackTrace(exc); this.stackTrace = string.Empty; } @@ -234,7 +234,7 @@ private void InitializePrivateVariables() } catch (Exception exc) { - Logger.Error(exc); + Logger.BasePortalExceptionExceptionGettingMessage(exc); this.message = string.Empty; } @@ -245,7 +245,7 @@ private void InitializePrivateVariables() } catch (Exception exc) { - Logger.Error(exc); + Logger.BasePortalExceptionExceptionGettingSource(exc); this.source = string.Empty; } @@ -270,7 +270,7 @@ private void InitializePrivateVariables() this.stackTrace = string.Empty; this.message = string.Empty; this.source = string.Empty; - Logger.Error(exc); + Logger.BasePortalExceptionInitializePrivateVariablesException(exc); } } diff --git a/DNN Platform/Library/Services/Exceptions/Exceptions.cs b/DNN Platform/Library/Services/Exceptions/Exceptions.cs index 861e6196428..6369dad3df1 100644 --- a/DNN Platform/Library/Services/Exceptions/Exceptions.cs +++ b/DNN Platform/Library/Services/Exceptions/Exceptions.cs @@ -6,19 +6,16 @@ namespace DotNetNuke.Services.Exceptions using System; using System.Diagnostics; using System.Globalization; - using System.Reflection; using System.Threading; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using DotNetNuke.Abstractions.Logging; - using DotNetNuke.Abstractions.Portals; using DotNetNuke.Common; using DotNetNuke.Common.Utilities; using DotNetNuke.Entities.Host; using DotNetNuke.Entities.Modules; - using DotNetNuke.Entities.Portals; using DotNetNuke.Instrumentation; using DotNetNuke.Services.Localization; using DotNetNuke.Services.Log.EventLog; @@ -86,7 +83,7 @@ public static ExceptionInfo GetExceptionInfo(Exception e) } catch (Exception exc) { - Logger.Error(exc); + Logger.ExceptionsGetExceptionInfoReflectionPermissionException(exc); objExceptionInfo.Method = "N/A - Reflection Permission required"; } @@ -289,11 +286,11 @@ public static void ProcessModuleLoadException(string friendlyMessage, Control ct } catch (Exception exc2) { - Logger.Fatal(exc2); + Logger.ExceptionsProcessModuleLoadExceptionUnexpectedException(exc2); ProcessPageLoadException(exc2); } - Logger.ErrorFormat(CultureInfo.InvariantCulture, "FriendlyMessage=\"{0}\" ctrl=\"{1}\" exc=\"{2}\"", friendlyMessage, ctrl, exc); + Logger.ExceptionsProcessModuleLoadException(exc, friendlyMessage, ctrl); } /// Processes the page load exception. @@ -318,7 +315,7 @@ public static void ProcessPageLoadException(Exception exc) /// The URL. public static void ProcessPageLoadException(Exception exc, string url) { - Logger.Error(url, exc); + Logger.ExceptionsProcessPageLoadExceptionWithUrl(exc, url); if (ThreadAbortCheck(exc)) { return; @@ -355,7 +352,7 @@ public static void ProcessPageLoadException(Exception exc, string url) /// The exception. public static void LogException(ModuleLoadException exc) { - Logger.Error(exc); + Logger.ExceptionsLogModuleLoadException(exc); var objExceptionLog = new ExceptionLogController(); objExceptionLog.AddLog(exc, ExceptionLogController.ExceptionLogType.MODULE_LOAD_EXCEPTION); } @@ -364,7 +361,7 @@ public static void LogException(ModuleLoadException exc) /// The exception. public static void LogException(PageLoadException exc) { - Logger.Error(exc); + Logger.ExceptionsLogPageLoadException(exc); var objExceptionLog = new ExceptionLogController(); objExceptionLog.AddLog(exc, ExceptionLogController.ExceptionLogType.PAGE_LOAD_EXCEPTION); } @@ -373,7 +370,7 @@ public static void LogException(PageLoadException exc) /// The exception. public static void LogException(SchedulerException exc) { - Logger.Error(exc); + Logger.ExceptionsLogSchedulerException(exc); var objExceptionLog = new ExceptionLogController(); objExceptionLog.AddLog(exc, ExceptionLogController.ExceptionLogType.SCHEDULER_EXCEPTION); } @@ -382,7 +379,7 @@ public static void LogException(SchedulerException exc) /// The exception. public static void LogException(SecurityException exc) { - Logger.Error(exc); + Logger.ExceptionsLogSecurityException(exc); var objExceptionLog = new ExceptionLogController(); objExceptionLog.AddLog(exc, ExceptionLogController.ExceptionLogType.SECURITY_EXCEPTION); } @@ -391,7 +388,7 @@ public static void LogException(SecurityException exc) /// The exception. public static void LogException(Exception exc) { - Logger.Error(exc); + Logger.ExceptionsLogGeneralException(exc); var objExceptionLog = new ExceptionLogController(); objExceptionLog.AddLog(exc, ExceptionLogController.ExceptionLogType.GENERAL_EXCEPTION); } @@ -400,7 +397,7 @@ public static void LogException(Exception exc) /// The exception. public static void ProcessSchedulerException(Exception exc) { - Logger.Error(exc); + Logger.ExceptionsProcessSchedulerException(exc); var objExceptionLog = new ExceptionLogController(); objExceptionLog.AddLog(exc, ExceptionLogController.ExceptionLogType.SCHEDULER_EXCEPTION); } @@ -409,7 +406,7 @@ public static void ProcessSchedulerException(Exception exc) /// The exception. public static void LogSearchException(SearchException exc) { - Logger.Error(exc); + Logger.ExceptionsLogSearchException(exc); var objExceptionLog = new ExceptionLogController(); objExceptionLog.AddLog(exc, ExceptionLogController.ExceptionLogType.SEARCH_INDEXER_EXCEPTION); } @@ -433,7 +430,7 @@ private static bool ThreadAbortCheck(Exception exc) private static void ProcessHttpException(HttpException exc, string url) { var notFoundErrorString = Localization.GetString("ResourceNotFound", Localization.SharedResourceFile); - Logger.Error(notFoundErrorString + ": - " + url, exc); + Logger.ExceptionsProcessHttpException(exc, notFoundErrorString, url); var log = new LogInfo { diff --git a/DNN Platform/Library/Services/Exceptions/SecurityException.cs b/DNN Platform/Library/Services/Exceptions/SecurityException.cs index 586b268baeb..fc286bea911 100644 --- a/DNN Platform/Library/Services/Exceptions/SecurityException.cs +++ b/DNN Platform/Library/Services/Exceptions/SecurityException.cs @@ -95,7 +95,7 @@ private void InitializePrivateVariables() { this.ip = string.Empty; this.querystring = string.Empty; - Logger.Error(exc); + Logger.SecurityExceptionInitializeProviderVariablesException(exc); } } diff --git a/DNN Platform/Library/Services/FileSystem/FileManager.cs b/DNN Platform/Library/Services/FileSystem/FileManager.cs index 858daa81752..7dd291c87b5 100644 --- a/DNN Platform/Library/Services/FileSystem/FileManager.cs +++ b/DNN Platform/Library/Services/FileSystem/FileManager.cs @@ -337,12 +337,12 @@ public virtual IFileInfo AddFile(IFolderInfo folder, string fileName, Stream fil } catch (FileLockedException fle) { - Logger.Error(fle); + Logger.FileManagerAddFileLockedException(fle); throw; } catch (Exception ex) { - Logger.Error(ex); + Logger.FileManagerAddFileGeneralException(ex); if (!folderProvider.FileExists(folder, file.FileName)) { @@ -410,7 +410,7 @@ public virtual IFileInfo CopyFile(IFileInfo file, IFolderInfo destinationFolder) } catch (Exception ex) { - Logger.Error(ex); + Logger.FileManagerCopyFileException(ex); throw new FolderProviderException(Localization.GetExceptionMessage("CopyFileUnderlyingSystemError", "The underlying system throw an exception. The file has not been copied."), ex); } @@ -522,7 +522,7 @@ public virtual bool FileExists(IFolderInfo folder, string fileName, bool retriev } catch (Exception ex) { - Logger.Error(ex); + Logger.FileManagerFileExistsException(ex); throw new FolderProviderException(Localization.GetExceptionMessage("UnderlyingSystemError", "The underlying system threw an exception."), ex); } @@ -652,7 +652,7 @@ public virtual Stream GetFileContent(IFileInfo file) } catch (Exception ex) { - Logger.Error(ex); + Logger.FileManagerGetFileStreamException(ex); throw new FolderProviderException(Localization.GetExceptionMessage("UnderlyingSystemError", "The underlying system threw an exception"), ex); } @@ -714,7 +714,7 @@ public string GetUrl(IFileInfo file) } catch (Exception ex) { - Logger.Error(ex); + Logger.FileManagerGetFileUrlException(ex); throw new FolderProviderException(Localization.GetExceptionMessage("UnderlyingSystemError", "The underlying system threw an exception."), ex); } @@ -851,7 +851,7 @@ public virtual IFileInfo RenameFile(IFileInfo file, string newFileName) } catch (Exception ex) { - Logger.Error(ex); + Logger.FileManagerRenameFileException(ex); throw new FolderProviderException(Localization.GetExceptionMessage("RenameFileUnderlyingSystemError", "The underlying system threw an exception. The file has not been renamed."), ex); } @@ -886,7 +886,7 @@ public void SetAttributes(IFileInfo file, FileAttributes fileAttributes) } catch (Exception ex) { - Logger.Error(ex); + Logger.FileManagerSetAttributesException(ex); throw new FolderProviderException(Localization.GetExceptionMessage("UnderlyingSystemError", "The underlying system threw an exception."), ex); } } @@ -1003,7 +1003,7 @@ public virtual IFileInfo UpdateFile(IFileInfo file, Stream fileContent) } catch (Exception ex) { - Logger.Error(ex); + Logger.FileManagerUpdateSizeAndModificationTimeException(ex); } return this.UpdateFile(file); @@ -1200,20 +1200,20 @@ internal virtual int ExtractFiles(IFileInfo file, IFolderInfo destinationFolder, } catch (PermissionsNotMetException exc) { - Logger.Warn(exc); + Logger.FileManagerExtractFilesPermissionsNotMet(exc); } catch (NoSpaceAvailableException exc) { - Logger.Warn(exc); + Logger.FileManagerExtractFilesNoSpaceAvailable(exc); } catch (InvalidFileExtensionException exc) { invalidFiles.Add(zipEntry.FullName); - Logger.Warn(exc); + Logger.FileManagerExtractFilesInvalidFileExtension(exc); } catch (Exception exc) { - Logger.Error(exc); + Logger.FileManagerUpdateExtractFilesGeneralException(exc); } } } @@ -1404,7 +1404,7 @@ internal virtual void WriteFileToHttpContext(IFileInfo file, ContentDisposition } catch (Exception ex) { - Logger.Error(ex); + Logger.FileManagerWriteToStreamException(ex); objResponse.Write("Error : " + ex.Message); } @@ -1438,7 +1438,7 @@ internal virtual void WriteStream(HttpResponse objResponse, Stream objStream) } catch (Exception ex) { - Logger.Error(ex); + Logger.FileManagerWriteStreamException(ex); objResponse.Write("Error : " + ex.Message); } finally @@ -1603,7 +1603,7 @@ private static void DeleteFileFromFolderProvider(IFileInfo file, FolderProvider } catch (Exception ex) { - Logger.Error(ex); + Logger.FileManagerDeleteFileException(ex); throw new FolderProviderException(Localization.GetExceptionMessage("UnderlyingSystemError", "The underlying system threw an exception."), ex); } } @@ -1827,7 +1827,7 @@ private void AddFileToFolderProvider(Stream fileContent, string fileName, IFolde } catch (Exception ex) { - Logger.Error(ex); + Logger.FileManagerAddFileException(ex); throw new FolderProviderException(Localization.GetExceptionMessage("UnderlyingSystemError", "The underlying system threw an exception."), ex); } } @@ -1866,7 +1866,7 @@ private void RotateFlipImage(ref Stream content) } catch (Exception ex) { - Logger.Error(ex); + Logger.FileManagerRotateFlipImageException(ex); } } diff --git a/DNN Platform/Library/Services/FileSystem/FileServerHandler.cs b/DNN Platform/Library/Services/FileSystem/FileServerHandler.cs index 50f1a360892..55aa78f442a 100644 --- a/DNN Platform/Library/Services/FileSystem/FileServerHandler.cs +++ b/DNN Platform/Library/Services/FileSystem/FileServerHandler.cs @@ -214,7 +214,7 @@ public void ProcessRequest(HttpContext context) } catch (Exception ex) { - Logger.Error(ex); + Logger.FileServerHandlerHandleFileLinkException(ex); } } diff --git a/DNN Platform/Library/Services/FileSystem/FolderManager.cs b/DNN Platform/Library/Services/FileSystem/FolderManager.cs index c67ed1119a3..a891f551151 100644 --- a/DNN Platform/Library/Services/FileSystem/FolderManager.cs +++ b/DNN Platform/Library/Services/FileSystem/FolderManager.cs @@ -40,7 +40,7 @@ namespace DotNetNuke.Services.FileSystem using Localization = DotNetNuke.Services.Localization.Localization; /// Exposes methods to manage folders. - public class FolderManager : ComponentBase, IFolderManager + public partial class FolderManager : ComponentBase, IFolderManager { private const string DefaultUsersFoldersPath = "Users"; private const string DefaultMappedPathSetting = "DefaultMappedPath"; @@ -144,7 +144,7 @@ public virtual IFolderInfo AddFolder(FolderMappingInfo folderMapping, string fol } catch (Exception ex) { - Logger.Error(ex); + Logger.FolderManagerAddFolderException(ex); throw new FolderProviderException(Localization.GetExceptionMessage("AddFolderUnderlyingSystemError", "The underlying system threw an exception. The folder has not been added."), ex); } @@ -1064,7 +1064,7 @@ internal virtual void DeleteFoldersFromExternalStorageLocations(Dictionary GetFileSystemFoldersRecursiv } catch (Exception ex) { - Logger.Error(ex); + Logger.FolderManagerGetFileSystemFoldersRecursiveException(ex); } } @@ -1625,7 +1625,7 @@ internal virtual void ProcessMergedTreeItemInAddMode(MergedTreeItem item, int po } catch (Exception ex) { - Logger.Error($"Could not create folder {item.FolderPath}. EXCEPTION: {ex.Message}", ex); + Logger.FolderManagerCouldNotCreateFolder(ex, item.FolderPath, ex.Message); } } @@ -1692,7 +1692,7 @@ internal virtual void RemoveOrphanedFiles(IFolderInfo folder) } catch (Exception ex) { - Logger.Error(ex); + Logger.FolderManagerRemoveOrphanedFilesException(ex); } } } @@ -1774,11 +1774,11 @@ internal virtual void SynchronizeFiles(MergedTreeItem item, int portalId) } catch (InvalidFileExtensionException ex) { - Logger.Info(ex.Message); + Logger.FolderManagerInvalidFileExtensionException(ex.Message); } catch (Exception ex) { - Logger.Error(ex); + Logger.FolderManagerAddOrUpdateFileException(ex); } } } @@ -1787,7 +1787,7 @@ internal virtual void SynchronizeFiles(MergedTreeItem item, int portalId) } catch (Exception ex) { - Logger.Error(ex); + Logger.FolderManagerSynchronizeFilesException(ex); } } @@ -2111,7 +2111,7 @@ private void DeleteFolderInternal(IFolderInfo folder, bool isCascadeDeleting) } catch (Exception ex) { - Logger.Error(ex); + Logger.FolderManagerDeleteFolderInternalException(ex); throw new FolderProviderException( Localization.GetExceptionMessage( diff --git a/DNN Platform/Library/Services/FileSystem/FolderMappings/FolderMappingsConfigController.cs b/DNN Platform/Library/Services/FileSystem/FolderMappings/FolderMappingsConfigController.cs index 502f1845ca1..cbbfbdbff56 100644 --- a/DNN Platform/Library/Services/FileSystem/FolderMappings/FolderMappingsConfigController.cs +++ b/DNN Platform/Library/Services/FileSystem/FolderMappings/FolderMappingsConfigController.cs @@ -61,7 +61,7 @@ public void LoadConfig() } catch (Exception ex) { - Logger.Error(ex); + Logger.FolderMappingsConfigControllerLoadConfigException(ex); } } @@ -70,7 +70,7 @@ public void SaveConfig(string folderMappinsSettings) { if (!File.Exists(DefaultConfigFilePath)) { - var folderMappingsConfigContent = "<" + this.ConfigNode + ">" + folderMappinsSettings + ""; + var folderMappingsConfigContent = $"<{this.ConfigNode}>{folderMappinsSettings}"; File.AppendAllText(DefaultConfigFilePath, folderMappingsConfigContent); var configDocument = new XmlDocument { XmlResolver = null }; using (var configReader = XmlReader.Create(new StringReader(folderMappingsConfigContent), new XmlReaderSettings { XmlResolver = null, })) diff --git a/DNN Platform/Library/Services/FileSystem/Internal/FileDeletionController.cs b/DNN Platform/Library/Services/FileSystem/Internal/FileDeletionController.cs index ea283790e93..8e927b35969 100644 --- a/DNN Platform/Library/Services/FileSystem/Internal/FileDeletionController.cs +++ b/DNN Platform/Library/Services/FileSystem/Internal/FileDeletionController.cs @@ -50,7 +50,7 @@ public void DeleteFile(IFileInfo file) } catch (Exception ex) { - Logger.Error(ex); + Logger.FileDeletionControllerDeleteFileException(ex); throw new FolderProviderException(Localization.GetExceptionMessage("DeleteFileUnderlyingSystemError", "The underlying system threw an exception. The file has not been deleted."), ex); } diff --git a/DNN Platform/Library/Services/FileSystem/Internal/FileSecurityController.cs b/DNN Platform/Library/Services/FileSystem/Internal/FileSecurityController.cs index 3e2f0d9de67..0d7bfeb409e 100644 --- a/DNN Platform/Library/Services/FileSystem/Internal/FileSecurityController.cs +++ b/DNN Platform/Library/Services/FileSystem/Internal/FileSecurityController.cs @@ -107,7 +107,7 @@ private IFileSecurityChecker GetSecurityChecker(string extension) } catch (Exception ex) { - Logger.Error($"Create File Security Checker for '{extension}' failed.", ex); + Logger.FileSecurityControllerCreateFileSecurityCheckerFailed(ex, extension); } } diff --git a/DNN Platform/Library/Services/FileSystem/Providers/StandardFolderProvider.cs b/DNN Platform/Library/Services/FileSystem/Providers/StandardFolderProvider.cs index 4ad9b62d656..5d278885b2c 100644 --- a/DNN Platform/Library/Services/FileSystem/Providers/StandardFolderProvider.cs +++ b/DNN Platform/Library/Services/FileSystem/Providers/StandardFolderProvider.cs @@ -140,7 +140,7 @@ public override bool FolderExists(string folderPath, FolderMappingInfo folderMap } catch (Exception ex) { - Logger.Error(ex); + Logger.StandardFolderProviderGetFileAttributesException(ex); } return fileAttributes; @@ -246,7 +246,7 @@ public override DateTime GetLastModificationTime(IFileInfo file) } catch (Exception ex) { - Logger.Error(ex); + Logger.StandardFolderProviderGetLastModificationTimeException(ex); } return lastModificationTime; @@ -439,11 +439,11 @@ protected Stream GetFileStreamInternal(string filePath) } catch (IOException iex) { - Logger.Warn(iex.Message); + Logger.StandardFolderProviderFileStreamIOException(iex, iex.Message); } catch (Exception ex) { - Logger.Error(ex); + Logger.StandardFolderProviderFileStreamGeneralException(ex); } return stream; diff --git a/DNN Platform/Library/Services/Installer/Installer.cs b/DNN Platform/Library/Services/Installer/Installer.cs index 3deb08ae36a..0cba719b7eb 100644 --- a/DNN Platform/Library/Services/Installer/Installer.cs +++ b/DNN Platform/Library/Services/Installer/Installer.cs @@ -250,13 +250,13 @@ public void DeleteTempFolder() } catch (Exception ex) { - Logger.Error("Exception deleting folder " + this.TempInstallFolder + " while installing " + this.InstallerInfo.ManifestFile.Name, ex); + Logger.InstallerExceptionDeletingFolderWhileInstalling(ex, this.TempInstallFolder, this.InstallerInfo.ManifestFile.Name); Exceptions.Exceptions.LogException(ex); } } - /// The Install method installs the feature. - /// A value indicating whether the install succeeded. + /// Installs the feature. + /// A value indicating whether the installation succeeded. public bool Install() { this.InstallerInfo.Log.StartJob(Util.INSTALL_Start); @@ -410,7 +410,7 @@ private static void BackupStreamIntoFile(MemoryStream stream, PackageInfo packag } catch (Exception ex) { - Logger.Error(ex); + Logger.InstallerBackupStreamInfoFileException(ex); } } @@ -469,7 +469,7 @@ private void LogInstallEvent(string package, string eventType) } catch (Exception exc) { - Logger.Error(exc); + Logger.InstallerLogInstallEventException(exc); } } diff --git a/DNN Platform/Library/Services/Installer/Installers/CleanupInstaller.cs b/DNN Platform/Library/Services/Installer/Installers/CleanupInstaller.cs index a55966d6b71..edef885a960 100644 --- a/DNN Platform/Library/Services/Installer/Installers/CleanupInstaller.cs +++ b/DNN Platform/Library/Services/Installer/Installers/CleanupInstaller.cs @@ -213,7 +213,7 @@ protected bool CleanupFile(InstallFile insFile) } catch (Exception exc) { - Logger.Error(exc); + Logger.CleanupInstallerCleanupFileException(exc); return false; } @@ -231,12 +231,12 @@ protected virtual void CleanupFolder(string path) } else { - Logger.Warn($"Ignoring invalid cleanup folder path '{path}' in package '{this.Package?.Name}'."); + Logger.CleanupInstallerIgnoringInvalidCleanupFolderPath(path, this.Package?.Name); } } catch (Exception ex) { - Logger.Error(ex); + Logger.CleanupInstallerCleanupFolderException(ex); } } diff --git a/DNN Platform/Library/Services/Installer/Installers/ResourceFileInstaller.cs b/DNN Platform/Library/Services/Installer/Installers/ResourceFileInstaller.cs index 4811683b2eb..7f29aaa3c37 100644 --- a/DNN Platform/Library/Services/Installer/Installers/ResourceFileInstaller.cs +++ b/DNN Platform/Library/Services/Installer/Installers/ResourceFileInstaller.cs @@ -149,7 +149,7 @@ protected override bool InstallFile(InstallFile insFile) } catch (Exception exc) { - Logger.Error(exc); + Logger.ResourceFileInstallerInstallFileException(exc); retValue = false; } diff --git a/DNN Platform/Library/Services/Installer/Log/Logger.cs b/DNN Platform/Library/Services/Installer/Log/Logger.cs index 984f2aba483..234f5f14e2e 100644 --- a/DNN Platform/Library/Services/Installer/Log/Logger.cs +++ b/DNN Platform/Library/Services/Installer/Log/Logger.cs @@ -13,7 +13,7 @@ namespace DotNetNuke.Services.Installer.Log using Microsoft.Extensions.Logging; /// The Logger class provides an Installer Log. - public class Logger + public partial class Logger { private static readonly ILogger DnnLogger = DnnLoggingController.GetLogger(); private readonly List logs; @@ -121,7 +121,7 @@ public string NormalClass public void AddFailure(string failure) { this.logs.Add(new LogEntry(LogType.Failure, failure)); - DnnLogger.Error(failure); + DnnLogger.InstallLoggerLogFailure(failure); this.valid = false; } @@ -136,7 +136,7 @@ public void AddFailure(Exception ex) public void AddInfo(string info) { this.logs.Add(new LogEntry(LogType.Info, info)); - DnnLogger.Info(info); + DnnLogger.InstallLoggerLogInfo(info); } /// The AddWarning method adds a new LogEntry of type Warning to the Logs collection. @@ -144,7 +144,7 @@ public void AddInfo(string info) public void AddWarning(string warning) { this.logs.Add(new LogEntry(LogType.Warning, warning)); - DnnLogger.Warn(warning); + DnnLogger.InstallLoggerLogWarning(warning); this.hasWarnings = true; } @@ -153,7 +153,7 @@ public void AddWarning(string warning) public void EndJob(string job) { this.logs.Add(new LogEntry(LogType.EndJob, job)); - DnnLogger.Info(job); + DnnLogger.InstallLoggerLogInfo(job); } /// GetLogsTable formats log entries in an HtmlTable. @@ -210,7 +210,7 @@ public void ResetFlags() public void StartJob(string job) { this.logs.Add(new LogEntry(LogType.StartJob, job)); - DnnLogger.Info(job); + DnnLogger.InstallLoggerLogInfo(job); } } } diff --git a/DNN Platform/Library/Services/Installer/Writers/ModulePackageWriter.cs b/DNN Platform/Library/Services/Installer/Writers/ModulePackageWriter.cs index aeff6cab0e1..3c49f2c6ea6 100644 --- a/DNN Platform/Library/Services/Installer/Writers/ModulePackageWriter.cs +++ b/DNN Platform/Library/Services/Installer/Writers/ModulePackageWriter.cs @@ -152,7 +152,7 @@ private static void ProcessControls(XPathNavigator controlNav, string moduleFold } catch (Exception exc) { - Logger.Error(exc); + Logger.ModulePackageWriterConvertControlTypeException(exc); throw new ReadManifestException(Util.EXCEPTION_Type, exc); } diff --git a/DNN Platform/Library/Services/Localization/Localization.cs b/DNN Platform/Library/Services/Localization/Localization.cs index 09b359ea02f..855a1e1ea50 100644 --- a/DNN Platform/Library/Services/Localization/Localization.cs +++ b/DNN Platform/Library/Services/Localization/Localization.cs @@ -1074,7 +1074,7 @@ public static string GetSystemMessage(string strLanguage, PortalSettings portalS } catch (NullReferenceException ex) { - Logger.Error(ex); + Logger.LocalizationGetSystemMessageException(ex); return messageName; } } diff --git a/DNN Platform/Library/Services/Localization/LocalizationProvider.cs b/DNN Platform/Library/Services/Localization/LocalizationProvider.cs index 7752faf8ce3..5631b056730 100644 --- a/DNN Platform/Library/Services/Localization/LocalizationProvider.cs +++ b/DNN Platform/Library/Services/Localization/LocalizationProvider.cs @@ -7,7 +7,6 @@ namespace DotNetNuke.Services.Localization using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; - using System.Globalization; using System.IO; using System.Linq; using System.Threading; @@ -102,7 +101,7 @@ public string GetString(string key, string resourceFileRoot, string language, Po if (!keyFound) { - Logger.WarnFormat(CultureInfo.InvariantCulture, "Missing localization key. key:{0} resFileRoot:{1} threadCulture:{2} userlan:{3}", key, resourceFileRoot, Thread.CurrentThread.CurrentUICulture, language); + Logger.LocalizationProviderMissingLocalizationKey(key, resourceFileRoot, Thread.CurrentThread.CurrentUICulture, language); } return string.IsNullOrEmpty(resourceValue) ? string.Empty : resourceValue; @@ -568,7 +567,7 @@ private static bool TryGetStringInternal(IHostSettings hostSettings, IApplicatio } catch (Exception ex) { - Logger.Error(ex); + Logger.LocalizationProviderGetLocaleException(ex); } if (userLocale != null && !string.IsNullOrEmpty(userLocale.Fallback)) diff --git a/DNN Platform/Library/Services/Log/EventLog/DBLoggingProvider.cs b/DNN Platform/Library/Services/Log/EventLog/DBLoggingProvider.cs index 27f4c084654..f496415381a 100644 --- a/DNN Platform/Library/Services/Log/EventLog/DBLoggingProvider.cs +++ b/DNN Platform/Library/Services/Log/EventLog/DBLoggingProvider.cs @@ -473,7 +473,7 @@ private static LogInfo FillLogInfo(IDataReader dr) } catch (Exception exc) { - Logger.Error(exc); + Logger.DbLoggingProviderFillLogInfoException(exc); } return (LogInfo)obj; @@ -572,12 +572,12 @@ private static void WriteLog(LogQueueItem logQueueItem) } catch (SqlException exc) { - Logger.Error(exc); + Logger.DbLoggingProviderWriteLogSqlException(exc); WriteError(logTypeConfigInfo, exc, "SQL Exception", SqlUtils.TranslateSQLException(exc)); } catch (Exception exc) { - Logger.Error(exc); + Logger.DbLoggingProviderWriteLogGeneralException(exc); WriteError(logTypeConfigInfo, exc, "Unhandled Error", exc.Message); } } diff --git a/DNN Platform/Library/Services/Log/EventLog/LogController.cs b/DNN Platform/Library/Services/Log/EventLog/LogController.cs index 5f987d3ecac..6e5536aa404 100644 --- a/DNN Platform/Library/Services/Log/EventLog/LogController.cs +++ b/DNN Platform/Library/Services/Log/EventLog/LogController.cs @@ -28,7 +28,7 @@ namespace DotNetNuke.Services.Log.EventLog using Microsoft.Extensions.Logging; /// - public class LogController : ServiceLocator, ILogController + public partial class LogController : ServiceLocator, ILogController { private const int WriterLockTimeout = 10000; // milliseconds private static readonly ILogger Logger = DnnLoggingController.GetLogger(); @@ -55,7 +55,7 @@ public void AddLog(LogInfo logInfo) ILogInfo theLogInfo = logInfo; if (this.appStatus.Status == UpgradeStatus.Install) { - Logger.Info(logInfo); + Logger.LogControllerLogInfo(logInfo); } else { @@ -81,7 +81,7 @@ public void AddLog(LogInfo logInfo) } catch (HttpException exception) { - Logger.Error("Unable to retrieve HttpContext.Request, ignoring LogUserName", exception); + Logger.LogControllerUnableToRetrieveRequestIgnoringLogUserName(exception); } } } @@ -141,7 +141,7 @@ public void AddLog(LogInfo logInfo) } catch (Exception exc) { - Logger.Error(exc); + Logger.LogControllerAddLogException(exc); AddLogToFile(logInfo); } @@ -159,7 +159,7 @@ public void AddLogType(string configFile, string fallbackConfigFile) } catch (FileNotFoundException exc) { - Logger.Debug(exc); + Logger.LogControllerConfigFileNotFound(exc); using var xmlReader = XmlReader.Create(fallbackConfigFile, new XmlReaderSettings { XmlResolver = null, }); xmlDoc.Load(xmlReader); } @@ -359,13 +359,13 @@ private static void AddLogToFile(LogInfo logInfo) // ReSharper disable once EmptyGeneralCatchClause catch (Exception exc) { - Logger.Error(exc); + Logger.LogControllerAddLogToFileException(exc); } } private static void RaiseError(string filePath, string header, string message) { - Logger.ErrorFormat(CultureInfo.InvariantCulture, "filePath={0}, header={1}, message={2}", filePath, header, message); + Logger.LogControllerRaiseError(filePath, header, message); if (HttpContext.Current != null) { @@ -414,7 +414,7 @@ private static void WriteLog(string filePath, string message) } catch (IOException exc) { - Logger.Debug(exc); + Logger.LogControllerFailureToWriteToLogFile(exc); Thread.Sleep(1); } } diff --git a/DNN Platform/Library/Services/Mail/SendTokenizedBulkEmail.cs b/DNN Platform/Library/Services/Mail/SendTokenizedBulkEmail.cs index 2d239d8a513..6fb715acbd1 100644 --- a/DNN Platform/Library/Services/Mail/SendTokenizedBulkEmail.cs +++ b/DNN Platform/Library/Services/Mail/SendTokenizedBulkEmail.cs @@ -305,7 +305,7 @@ public List Recipients() } /// Send bulkmail to all recipients according to settings. - /// Number of emails sent, null.integer if not determinable. + /// Number of emails sent, if not determinable. /// Detailed status report is sent by email to sending user. public int SendMails() { @@ -323,7 +323,7 @@ public int SendMails() { // Add Base Href for any images inserted in to the email. var host = this.PortalAlias.Contains("/") ? this.PortalAlias.Substring(0, this.PortalAlias.IndexOf('/')) : this.PortalAlias; - body = "" + this.Subject + "" + body + ""; + body = $"{this.Subject}{body}"; } string subject = this.Subject; @@ -475,7 +475,7 @@ public int SendMails() catch (Exception exc) { // send mail failure - Logger.Error(exc); + Logger.SendTokenizedBulkEmailSendMailsException(exc); Debug.Write(exc.Message); } diff --git a/DNN Platform/Library/Services/ModuleCache/PurgeModuleCache.cs b/DNN Platform/Library/Services/ModuleCache/PurgeModuleCache.cs index dfc6d727a8d..430ba9d3961 100644 --- a/DNN Platform/Library/Services/ModuleCache/PurgeModuleCache.cs +++ b/DNN Platform/Library/Services/ModuleCache/PurgeModuleCache.cs @@ -6,13 +6,15 @@ namespace DotNetNuke.Services.ModuleCache using System; using System.Collections.Generic; + using DotNetNuke.Abstractions.Portals; using DotNetNuke.Entities.Portals; using DotNetNuke.Instrumentation; using DotNetNuke.Services.Scheduling; using Microsoft.Extensions.Logging; - public class PurgeModuleCache : SchedulerClient + /// A scheduled task to purge the module cache. + public partial class PurgeModuleCache : SchedulerClient { private static readonly ILogger Logger = DnnLoggingController.GetLogger(); @@ -33,16 +35,16 @@ public override void DoWork() { try { - foreach (PortalInfo portal in portals) + foreach (IPortalInfo portal in portals) { - kvp.Value.PurgeExpiredItems(portal.PortalID); + kvp.Value.PurgeExpiredItems(portal.PortalId); this.ScheduleHistoryItem.AddLogNote($"Purged Module cache for {kvp.Key}. "); } } catch (NotSupportedException exc) { // some Module caching providers don't use this feature - Logger.Debug(exc); + Logger.PurgeModuleCachePurgeNotSupportedException(exc); } } diff --git a/DNN Platform/Library/Services/OutputCache/PurgeOutputCache.cs b/DNN Platform/Library/Services/OutputCache/PurgeOutputCache.cs index 7646b2c9c52..8813c770147 100644 --- a/DNN Platform/Library/Services/OutputCache/PurgeOutputCache.cs +++ b/DNN Platform/Library/Services/OutputCache/PurgeOutputCache.cs @@ -6,13 +6,15 @@ namespace DotNetNuke.Services.OutputCache using System; using System.Collections.Generic; + using DotNetNuke.Abstractions.Portals; using DotNetNuke.Entities.Portals; using DotNetNuke.Instrumentation; using DotNetNuke.Services.Scheduling; using Microsoft.Extensions.Logging; - public class PurgeOutputCache : SchedulerClient + /// A scheduled task to purge the output cache. + public partial class PurgeOutputCache : SchedulerClient { private static readonly ILogger Logger = DnnLoggingController.GetLogger(); @@ -33,16 +35,16 @@ public override void DoWork() { try { - foreach (PortalInfo portal in portals) + foreach (IPortalInfo portal in portals) { - kvp.Value.PurgeExpiredItems(portal.PortalID); + kvp.Value.PurgeExpiredItems(portal.PortalId); this.ScheduleHistoryItem.AddLogNote($"Purged output cache for {kvp.Key}. "); } } catch (NotSupportedException exc) { // some output caching providers don't use this feature - Logger.Debug(exc); + Logger.PurgeOutputCachePurgeNotSupportedException(exc); } } diff --git a/DNN Platform/Library/Services/Scheduling/ProcessGroup.cs b/DNN Platform/Library/Services/Scheduling/ProcessGroup.cs index d6fe02bd9fd..74e9ce58858 100644 --- a/DNN Platform/Library/Services/Scheduling/ProcessGroup.cs +++ b/DNN Platform/Library/Services/Scheduling/ProcessGroup.cs @@ -65,15 +65,11 @@ public void Run(ScheduleHistoryItem objScheduleHistoryItem) // in case the scheduler client // didn't have proper exception handling // make sure we fire the Errored event - Logger.Error(exc); + Logger.ProcessGroupDoWorkException(exc); if (process != null) { - if (process.ScheduleHistoryItem != null) - { - process.ScheduleHistoryItem.Succeeded = false; - } - + process.ScheduleHistoryItem?.Succeeded = false; process.Errored(ref exc); } } diff --git a/DNN Platform/Library/Services/Scheduling/ScheduleHistoryItem.cs b/DNN Platform/Library/Services/Scheduling/ScheduleHistoryItem.cs index 169e739ded5..b7364967b9a 100644 --- a/DNN Platform/Library/Services/Scheduling/ScheduleHistoryItem.cs +++ b/DNN Platform/Library/Services/Scheduling/ScheduleHistoryItem.cs @@ -12,8 +12,9 @@ namespace DotNetNuke.Services.Scheduling using Microsoft.Extensions.Logging; + /// History about a schedule item. [Serializable] - public class ScheduleHistoryItem : ScheduleItem + public partial class ScheduleHistoryItem : ScheduleItem { private static readonly ILogger TracelLogger = DnnLoggingController.GetLogger(); @@ -218,9 +219,13 @@ public bool Succeeded set { this.succeeded = value; - if (TracelLogger.IsDebugEnabled) + if (value) { - TracelLogger.Debug($"ScheduleHistoryItem.Succeeded Info (ScheduledTask {(value == false ? "Start" : "End")}): {this.FriendlyName}"); + TracelLogger.ScheduleHistoryItemSucceededEnd(this.FriendlyName); + } + else + { + TracelLogger.ScheduleHistoryItemSucceededStart(this.FriendlyName); } } } @@ -228,9 +233,9 @@ public bool Succeeded public virtual void AddLogNote(string notes) { this.logNotes.Append(notes); - if (TracelLogger.IsTraceEnabled) + if (TracelLogger.IsEnabled(LogLevel.Trace)) { - TracelLogger.Trace(notes.Replace(@"
", Environment.NewLine)); + TracelLogger.ScheduleHistoryItemLogNote(notes.Replace("
", Environment.NewLine)); } } diff --git a/DNN Platform/Library/Services/Scheduling/Scheduler.cs b/DNN Platform/Library/Services/Scheduling/Scheduler.cs index e51ccb8973b..29db98f3c54 100644 --- a/DNN Platform/Library/Services/Scheduling/Scheduler.cs +++ b/DNN Platform/Library/Services/Scheduling/Scheduler.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information namespace DotNetNuke.Services.Scheduling @@ -21,11 +21,13 @@ namespace DotNetNuke.Services.Scheduling using Microsoft.Extensions.Logging; using Microsoft.VisualBasic; - internal static class Scheduler + /// The scheduler. + internal static partial class Scheduler { private static readonly ILogger Logger = DnnLoggingController.GetLogger(typeof(Scheduler)); - internal static class CoreScheduler + /// The scheduler implementation. + internal static partial class CoreScheduler { // If KeepRunning gets switched to false, // the scheduler stops running. @@ -315,10 +317,7 @@ public static int GetScheduleInProgressCount() { // The reader lock request timed out. Interlocked.Increment(ref readerTimeouts); - if (Logger.IsDebugEnabled) - { - Logger.Debug(ex); - } + Logger.SchedulerReaderLockRequestTimeout(ex); return 0; } @@ -458,10 +457,7 @@ public static bool HasDependenciesConflict(ScheduleItem scheduleItem) { // The reader lock request timed out. Interlocked.Increment(ref readerTimeouts); - if (Logger.IsDebugEnabled) - { - Logger.Debug(ex); - } + Logger.SchedulerReaderLockRequestTimeout(ex); return false; } @@ -471,10 +467,7 @@ public static void LoadQueueFromEvent(EventName eventName) { var executingServer = ServerController.GetExecutingServerName(); List schedule = SchedulingController.GetScheduleByEvent(eventName.ToString(), executingServer); - if (Logger.IsDebugEnabled) - { - Logger.Debug("loadqueue executingServer:" + executingServer); - } + Logger.SchedulerLoadQueue(executingServer); var thisServer = GetServer(executingServer); if (thisServer == null) @@ -511,10 +504,7 @@ public static void LoadQueueFromTimer() forceReloadSchedule = false; var executingServer = ServerController.GetExecutingServerName(); List schedule = SchedulingController.GetSchedule(executingServer); - if (Logger.IsDebugEnabled) - { - Logger.Debug("LoadQueueFromTimer executingServer:" + executingServer); - } + Logger.SchedulerLoadQueueFromTimer(executingServer); var thisServer = GetServer(executingServer); if (thisServer == null) @@ -1363,10 +1353,7 @@ private static bool IsInProgress(ScheduleItem scheduleItem) { // The reader lock request timed out. Interlocked.Increment(ref readerTimeouts); - if (Logger.IsDebugEnabled) - { - Logger.Debug(ex); - } + Logger.SchedulerReaderLockRequestTimeout(ex); return false; } diff --git a/DNN Platform/Library/Services/Search/Controllers/ModuleResultController.cs b/DNN Platform/Library/Services/Search/Controllers/ModuleResultController.cs index 6c494c60d66..4b186a91c4e 100644 --- a/DNN Platform/Library/Services/Search/Controllers/ModuleResultController.cs +++ b/DNN Platform/Library/Services/Search/Controllers/ModuleResultController.cs @@ -151,7 +151,7 @@ public override string GetDocUrl(SearchResult searchResult) } catch (Exception ex) { - Logger.Error(ex); + Logger.ModuleResultControllerGetModuleSearchUrlException(ex); } break; diff --git a/DNN Platform/Library/Services/Search/Internals/InternalSearchControllerImpl.cs b/DNN Platform/Library/Services/Search/Internals/InternalSearchControllerImpl.cs index 4fdab5dc7b4..6a9ccfd9023 100644 --- a/DNN Platform/Library/Services/Search/Internals/InternalSearchControllerImpl.cs +++ b/DNN Platform/Library/Services/Search/Internals/InternalSearchControllerImpl.cs @@ -145,7 +145,7 @@ public void AddSearchDocuments(IEnumerable searchDocuments) } catch (Exception ex) { - Logger.ErrorFormat(CultureInfo.InvariantCulture, "Search Document error: {0}{1}{2}", searchDoc, Environment.NewLine, ex); + Logger.InternalSearchControllerSearchDocumentError(ex, searchDoc); } } diff --git a/DNN Platform/Library/Services/Search/Internals/LuceneControllerImpl.cs b/DNN Platform/Library/Services/Search/Internals/LuceneControllerImpl.cs index 9ba4951941c..92800f59d09 100644 --- a/DNN Platform/Library/Services/Search/Internals/LuceneControllerImpl.cs +++ b/DNN Platform/Library/Services/Search/Internals/LuceneControllerImpl.cs @@ -32,7 +32,7 @@ namespace DotNetNuke.Services.Search.Internals using Localization = DotNetNuke.Services.Localization.Localization; /// The Impl Controller class for Lucene. - internal class LuceneControllerImpl : ILuceneController, IDisposable + internal partial class LuceneControllerImpl : ILuceneController, IDisposable { private const string DefaultSearchFolder = @"App_Data\Search"; private const string WriteLockFile = "write.lock"; @@ -187,10 +187,9 @@ public LuceneResults Search(LuceneSearchContext searchContext) searcher.Search(searchContext.LuceneQuery.Query, null, searchSecurityTrimmer); luceneResults.TotalHits = searchSecurityTrimmer.TotalHits; - if (Logger.IsDebugEnabled) + if (Logger.IsEnabled(LogLevel.Trace)) { - var sb = GetSearcResultExplanation(searchContext.LuceneQuery, searchSecurityTrimmer.ScoreDocs, searcher); - Logger.Trace(sb); + Logger.LuceneControllerSearchResultExplanation(searchContext.LuceneQuery.Query, GetSearchResultExplanation(searchContext.LuceneQuery, searchSecurityTrimmer.ScoreDocs, searcher)); } // Page doesn't exist @@ -224,8 +223,8 @@ public LuceneResults Search(LuceneSearchContext searchContext) throw; } - Logger.Error(ex); - Logger.Error($"Search Index Folder Is Not Available: {ex.Message}, Retry {i + 1} time(s)."); + Logger.LuceneControllerSearchException(ex); + Logger.LuceneControllerSearchIndexFolderIsNotAvailable(ex, ex.Message, i + 1); Thread.Sleep(100); } } @@ -287,7 +286,7 @@ public bool OptimizeSearchIndex(bool doWait) { if (doWait) { - Logger.Debug("Compacting Search Index - started"); + Logger.LuceneControllerCompactingSearchIndexStarted(); } this.CheckDisposed(); @@ -298,7 +297,7 @@ public bool OptimizeSearchIndex(bool doWait) if (doWait) { this.Commit(); - Logger.Debug("Compacting Search Index - finished"); + Logger.LuceneControllerCompactingSearchIndexFinished(); } return true; @@ -399,7 +398,7 @@ public Analyzer GetCustomAnalyzer() } catch (Exception ex) { - Logger.Error(ex); + Logger.LuceneControllerGetCustomAnalyzerException(ex); } } } @@ -420,10 +419,9 @@ internal IndexSearcher GetSearcher() return this.reader.GetSearcher(); } - private static StringBuilder GetSearcResultExplanation(LuceneQuery luceneQuery, IEnumerable scoreDocs, IndexSearcher searcher) + private static string GetSearchResultExplanation(LuceneQuery luceneQuery, IEnumerable scoreDocs, IndexSearcher searcher) { var sb = new StringBuilder(); - sb.AppendLine("Query: " + luceneQuery.Query.ToString()); foreach (var match in scoreDocs) { var explanation = searcher.Explain(luceneQuery.Query, match.Doc); @@ -433,7 +431,7 @@ private static StringBuilder GetSearcResultExplanation(LuceneQuery luceneQuery, sb.AppendLine(explanation.ToString()); } - return sb; + return sb.ToString(); } private static string GetHighlightedText(FastVectorHighlighter highlighter, FieldQuery fieldQuery, IndexSearcher searcher, ScoreDoc match, string tag, int length) diff --git a/DNN Platform/Library/Services/Search/ModuleIndexer.cs b/DNN Platform/Library/Services/Search/ModuleIndexer.cs index c6385ff412e..364dcd1c311 100644 --- a/DNN Platform/Library/Services/Search/ModuleIndexer.cs +++ b/DNN Platform/Library/Services/Search/ModuleIndexer.cs @@ -29,7 +29,7 @@ namespace DotNetNuke.Services.Search using Localization = DotNetNuke.Services.Localization.Localization; /// The ModuleIndexer is an implementation of the abstract class. - public class ModuleIndexer : IndexingProviderBase + public partial class ModuleIndexer : IndexingProviderBase { private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly int ModuleSearchTypeId = SearchHelper.Instance.GetSearchTypeByName("module").SearchTypeId; @@ -106,16 +106,7 @@ public override int IndexSearchDocuments(int portalId, ScheduleHistoryItem sched AddModuleMetaData(searchItems, module); searchDocuments.AddRange(searchItems); - if (Logger.IsTraceEnabled) - { - Logger.TraceFormat( - CultureInfo.InvariantCulture, - "ModuleIndexer: {0} search documents found for module [{1} mid:{2}]", - searchItems.Count, - module.DesktopModule.ModuleName, - module.ModuleID); - } - + Logger.ModuleIndexerSearchDocumentsFoundForModule(searchItems.Count, module.DesktopModule.ModuleName, module.ModuleID); if (searchDocuments.Count >= saveThreshold) { totalIndexed += this.IndexCollectedDocs(indexer, searchDocuments, portalId, schedule); @@ -172,7 +163,7 @@ public List GetModuleMetaData(int portalId, DateTime startDate) searchDoc.Tags = module.Terms.Select(t => t.Name); } - Logger.Trace("ModuleIndexer: Search document for metaData found for module [" + module.DesktopModule.ModuleName + " mid:" + module.ModuleID + "]"); + Logger.ModuleIndexerSearchDocumentForMetadataFoundForModule(module.DesktopModule.ModuleName, module.ModuleID); searchDocuments.Add(searchDoc); } @@ -273,7 +264,7 @@ private static List GetModulesForIndex(int portalId) } catch (Exception ex) { - Logger.Error(ex); + Logger.ModuleIndexerGetModulesForIndexException(ex); ThrowLogError(module, ex); } finally diff --git a/DNN Platform/Library/Services/Search/SearchEngine.cs b/DNN Platform/Library/Services/Search/SearchEngine.cs index 2f9db76f95a..4fd643b9435 100644 --- a/DNN Platform/Library/Services/Search/SearchEngine.cs +++ b/DNN Platform/Library/Services/Search/SearchEngine.cs @@ -183,7 +183,7 @@ private int GetAndStoreSearchDocuments(IndexingProviderBase indexer) } catch (NotImplementedException exc) { - Logger.Warn("Indexer not implemented", exc); + Logger.SearchEngineIndexerNotImplemented(exc); } } @@ -196,7 +196,7 @@ private int GetAndStoreSearchDocuments(IndexingProviderBase indexer) } catch (NotImplementedException exc) { - Logger.Warn("Indexer not implemented", exc); + Logger.SearchEngineIndexerNotImplemented(exc); } return indexedCount; diff --git a/DNN Platform/Library/Services/Search/SearchEngineScheduler.cs b/DNN Platform/Library/Services/Search/SearchEngineScheduler.cs index 752c21090f2..ff45c480c4a 100644 --- a/DNN Platform/Library/Services/Search/SearchEngineScheduler.cs +++ b/DNN Platform/Library/Services/Search/SearchEngineScheduler.cs @@ -44,7 +44,7 @@ public override void DoWork() try { var lastSuccessFulDateTime = SearchHelper.Instance.GetLastSuccessfulIndexingDateTime(this.ScheduleHistoryItem.ScheduleID); - Logger.Trace("Search: Site Crawler - Starting. Content change start time " + lastSuccessFulDateTime.ToString("g", CultureInfo.InvariantCulture)); + Logger.SearchEngineSchedulerStarting(lastSuccessFulDateTime); this.ScheduleHistoryItem.AddLogNote(string.Format(CultureInfo.InvariantCulture, "Starting. Content change start time {0:g}", lastSuccessFulDateTime)); var searchEngine = new SearchEngine(this.ScheduleHistoryItem, lastSuccessFulDateTime, this.businessControllerProvider); @@ -64,7 +64,7 @@ public override void DoWork() this.ScheduleHistoryItem.AddLogNote("
Indexing Successful"); SearchHelper.Instance.SetLastSuccessfulIndexingDateTime(this.ScheduleHistoryItem.ScheduleID, this.ScheduleHistoryItem.StartDate); - Logger.Trace("Search: Site Crawler - Indexing Successful"); + Logger.SearchEngineSchedulerSuccessful(); } catch (Exception ex) { diff --git a/DNN Platform/Library/Services/Search/TabIndexer.cs b/DNN Platform/Library/Services/Search/TabIndexer.cs index 71b41c23787..2922633c104 100644 --- a/DNN Platform/Library/Services/Search/TabIndexer.cs +++ b/DNN Platform/Library/Services/Search/TabIndexer.cs @@ -17,7 +17,7 @@ namespace DotNetNuke.Services.Search using Microsoft.Extensions.Logging; /// An implementation of for pages. - public class TabIndexer : IndexingProviderBase + public partial class TabIndexer : IndexingProviderBase { private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private static readonly int TabSearchTypeId = SearchHelper.Instance.GetSearchTypeByName("tab").SearchTypeId; @@ -90,11 +90,7 @@ private static SearchDocument GetTabSearchDocument(TabInfo tab) searchDoc.Tags = tab.Terms.Select(t => t.Name); } - if (Logger.IsTraceEnabled) - { - Logger.Trace($"TabIndexer: Search document for metaData added for page [{tab.Title} tid:{tab.TabID}]"); - } - + Logger.TabIndexerPageMetadataDocumentAdded(tab.Title, tab.TabID); return searchDoc; } diff --git a/DNN Platform/Library/Services/Sitemap/CoreSitemapProvider.cs b/DNN Platform/Library/Services/Sitemap/CoreSitemapProvider.cs index 7116db036b4..57baf26c8c6 100644 --- a/DNN Platform/Library/Services/Sitemap/CoreSitemapProvider.cs +++ b/DNN Platform/Library/Services/Sitemap/CoreSitemapProvider.cs @@ -65,9 +65,9 @@ public override List GetUrls(int portalId, PortalSettings ps, string pageUrl = this.GetPageUrl(tab, currentLanguage, ps); urls.Add(pageUrl); } - catch (Exception) + catch (Exception exception) { - Logger.ErrorFormat(CultureInfo.InvariantCulture, "Error has occurred getting PageUrl for {0}", tab.TabName); + Logger.CoreSitemapProviderErrorGettingPageUrl(exception, tab.TabName); } } } diff --git a/DNN Platform/Library/Services/SystemHealth/WebServerMonitor.cs b/DNN Platform/Library/Services/SystemHealth/WebServerMonitor.cs index 6732ba88b1d..3fe94a569b2 100644 --- a/DNN Platform/Library/Services/SystemHealth/WebServerMonitor.cs +++ b/DNN Platform/Library/Services/SystemHealth/WebServerMonitor.cs @@ -14,40 +14,31 @@ namespace DotNetNuke.Services.SystemHealth using Microsoft.Extensions.Logging; - /// - /// When run on each server it updates the last activity date for the server and removes any servers that haven't been seen in 24 hours. - /// - public class WebServerMonitor : SchedulerClient + /// When run on each server it updates the last activity date for the server and removes any servers that haven't been seen in 24 hours. + public partial class WebServerMonitor : SchedulerClient { private static readonly ILogger Logger = DnnLoggingController.GetLogger(); - /// - /// Initializes a new instance of the class. - /// Constructs a WebServerMonitor SchedulerClient. - /// + /// Initializes a new instance of the class. /// A SchedulerHistoryItem. - /// - /// This must be run on all servers. - /// + /// This must be run on all servers. public WebServerMonitor(ScheduleHistoryItem objScheduleHistoryItem) { this.ScheduleHistoryItem = objScheduleHistoryItem; } - /// - /// Runs on the active server and updates the last activity date for the current server. - /// + /// Runs on the active server and updates the last activity date for the current server. public override void DoWork() { try { - Logger.Info("Starting WebServerMonitor"); + Logger.WebServerMonitorStartingWebServerMonitor(); UpdateCurrentServerActivity(); DisableServersWithoutRecentActivity(); RemoveInActiveServers(); - Logger.Info("Finished WebServerMonitor"); + Logger.WebServerMonitorFinishedWebServerMonitor(); this.ScheduleHistoryItem.Succeeded = true; } catch (Exception exc) @@ -55,20 +46,20 @@ public override void DoWork() this.ScheduleHistoryItem.Succeeded = false; this.ScheduleHistoryItem.AddLogNote($"Updating server health failed: {exc}."); this.Errored(ref exc); - Logger.ErrorFormat(CultureInfo.InvariantCulture, "Error in WebServerMonitor: {0}. {1}", exc.Message, exc.StackTrace); + Logger.WebServerMonitorErrorInWebServerMonitor(exc, exc.Message, exc.StackTrace); Exceptions.LogException(exc); } } private static void UpdateCurrentServerActivity() { - Logger.Info("Starting UpdateCurrentServerActivity"); + Logger.WebServerMonitorStartingUpdateCurrentServerActivity(); // Creating a new ServerInfo object, by default points it at the current server var currentServer = new ServerInfo(); ServerController.UpdateServerActivity(currentServer); - Logger.Info("Finished UpdateCurrentServerActivity"); + Logger.WebServerMonitorFinishedUpdateCurrentServerActivity(); } private static void DisableServersWithoutRecentActivity() @@ -91,7 +82,7 @@ private static void DisableServersWithoutRecentActivity() private static void RemoveInActiveServers() { - Logger.Info("Starting RemoveInActiveServers"); + Logger.WebServerMonitorStartingRemoveInActiveServers(); var serversWithActivity = ServerController.GetEnabledServersWithActivity(); var newServer = serversWithActivity.FirstOrDefault(); @@ -106,7 +97,7 @@ private static void RemoveInActiveServers() } } - Logger.Info("Finished RemoveInActiveServers"); + Logger.WebServerMonitorFinishedRemoveInActiveServers(); } } } diff --git a/DNN Platform/Library/Services/Upgrade/Internals/Steps/AddFcnModeStep.cs b/DNN Platform/Library/Services/Upgrade/Internals/Steps/AddFcnModeStep.cs index 2355034f83a..c0654bfdbec 100644 --- a/DNN Platform/Library/Services/Upgrade/Internals/Steps/AddFcnModeStep.cs +++ b/DNN Platform/Library/Services/Upgrade/Internals/Steps/AddFcnModeStep.cs @@ -14,7 +14,7 @@ namespace DotNetNuke.Services.Upgrade.Internals.Steps using Localization = DotNetNuke.Services.Localization.Localization; /// AddFcnModeVerificationStep - Step that performs FcnMode verification checks prior to installation. - public class AddFcnModeStep : BaseInstallationStep + public partial class AddFcnModeStep : BaseInstallationStep { private static readonly ILogger Logger = DnnLoggingController.GetLogger(); @@ -28,7 +28,7 @@ public override void Execute() if (!string.IsNullOrEmpty(strError)) { this.Errors.Add(Localization.GetString("FcnMode", this.LocalInstallResourceFile) + ": " + strError); - Logger.TraceFormat(CultureInfo.InvariantCulture, "Adding FcnMode : {0}", strError); + Logger.AddFcnModeStepAddingFcnMode(strError); } this.Status = this.Errors.Count > 0 ? StepStatus.Retry : StepStatus.Done; diff --git a/DNN Platform/Library/Services/Upgrade/Internals/Steps/FilePermissionCheckStep.cs b/DNN Platform/Library/Services/Upgrade/Internals/Steps/FilePermissionCheckStep.cs index dedeeaa616a..7632c114465 100644 --- a/DNN Platform/Library/Services/Upgrade/Internals/Steps/FilePermissionCheckStep.cs +++ b/DNN Platform/Library/Services/Upgrade/Internals/Steps/FilePermissionCheckStep.cs @@ -17,7 +17,7 @@ namespace DotNetNuke.Services.Upgrade.InternalController.Steps using Localization = DotNetNuke.Services.Localization.Localization; /// FilePermissionCheck - Step that performs file permission checks prior to installation. - public class FilePermissionCheckStep : BaseInstallationStep + public partial class FilePermissionCheckStep : BaseInstallationStep { private static readonly ILogger Logger = DnnLoggingController.GetLogger(); @@ -37,7 +37,7 @@ public override void Execute() + Localization.GetString("FileCreateCheck", this.LocalInstallResourceFile) + Localization.GetString("FileDeleteCheck", this.LocalInstallResourceFile) + Localization.GetString("FolderDeleteCheck", this.LocalInstallResourceFile); - Logger.TraceFormat(CultureInfo.InvariantCulture, "FilePermissionCheck - {0}", this.Details); + Logger.FilePermissionCheckStepCheck(this.Details); if (!verifiers.All(v => v.VerifyAll())) { @@ -47,7 +47,7 @@ public override void Execute() this.Percentage = 100; this.Status = this.Errors.Count > 0 ? StepStatus.Retry : StepStatus.Done; - Logger.TraceFormat(CultureInfo.InvariantCulture, "FilePermissionCheck Status - {0}", this.Status); + Logger.FilePermissionCheckStepStatus(this.Status); } } } diff --git a/DNN Platform/Library/Services/Upgrade/Internals/Steps/InstallExtensionsStep.cs b/DNN Platform/Library/Services/Upgrade/Internals/Steps/InstallExtensionsStep.cs index 23acbb87b69..7fde54f872e 100644 --- a/DNN Platform/Library/Services/Upgrade/Internals/Steps/InstallExtensionsStep.cs +++ b/DNN Platform/Library/Services/Upgrade/Internals/Steps/InstallExtensionsStep.cs @@ -40,7 +40,7 @@ public override void Execute() var packageType = package.Value.PackageType; var message = string.Format(CultureInfo.CurrentCulture, Localization.GetString("InstallingExtension", this.LocalInstallResourceFile), packageType, Path.GetFileName(file)); this.Details = message; - Logger.Trace(this.Details); + Logger.InstallExtensionsStepInstallingExtensionPackage(this.Details); var success = Upgrade.InstallPackage(file, packageType, false); if (!success) { diff --git a/DNN Platform/Library/Services/Upgrade/Internals/Steps/InstallVersionStep.cs b/DNN Platform/Library/Services/Upgrade/Internals/Steps/InstallVersionStep.cs index 0daab0c54a6..9a5d8de02da 100644 --- a/DNN Platform/Library/Services/Upgrade/Internals/Steps/InstallVersionStep.cs +++ b/DNN Platform/Library/Services/Upgrade/Internals/Steps/InstallVersionStep.cs @@ -4,8 +4,6 @@ namespace DotNetNuke.Services.Upgrade.Internals.Steps { - using System.Globalization; - using DotNetNuke.Common.Utilities; using DotNetNuke.Data; using DotNetNuke.Instrumentation; @@ -15,7 +13,7 @@ namespace DotNetNuke.Services.Upgrade.Internals.Steps using Localization = DotNetNuke.Services.Localization.Localization; /// DatabaseVerificationStep - Step that performs database verification checks prior to installation. - public class InstallVersionStep : BaseInstallationStep + public partial class InstallVersionStep : BaseInstallationStep { private static readonly ILogger Logger = DnnLoggingController.GetLogger(); @@ -31,8 +29,8 @@ public override void Execute() if (!string.IsNullOrEmpty(strError)) { - this.Errors.Add(Localization.GetString("InstallVersion", this.LocalInstallResourceFile) + ": " + strError); - Logger.TraceFormat(CultureInfo.InvariantCulture, "Adding InstallVersion : {0}", strError); + this.Errors.Add($"{Localization.GetString("InstallVersion", this.LocalInstallResourceFile)}: {strError}"); + Logger.InstallVersionStepAddingInstallVersion(strError); } this.Status = this.Errors.Count > 0 ? StepStatus.Retry : StepStatus.Done; diff --git a/DNN Platform/Library/Services/Upgrade/Internals/Steps/UpdateLanguagePackStep.cs b/DNN Platform/Library/Services/Upgrade/Internals/Steps/UpdateLanguagePackStep.cs index 94058df043b..11b87f66098 100644 --- a/DNN Platform/Library/Services/Upgrade/Internals/Steps/UpdateLanguagePackStep.cs +++ b/DNN Platform/Library/Services/Upgrade/Internals/Steps/UpdateLanguagePackStep.cs @@ -48,7 +48,7 @@ public override void Execute() { // we shouldn't break the install process when LP download failed, for admin user can install the LP after website created. // so we logged what's wrong here, and user can check it later. - Logger.Error(ex); + Logger.UpdateLanguagePackStepExecuteException(ex); } } diff --git a/DNN Platform/Library/Services/Upgrade/Upgrade.cs b/DNN Platform/Library/Services/Upgrade/Upgrade.cs index 8626d69818a..8fd31ec0a00 100644 --- a/DNN Platform/Library/Services/Upgrade/Upgrade.cs +++ b/DNN Platform/Library/Services/Upgrade/Upgrade.cs @@ -329,7 +329,7 @@ public static int AddModuleToPage(TabInfo page, int moduleDefId, string moduleTi } catch (Exception exc) { - Logger.Error(exc); + Logger.UpgradeAddModuleException(exc); DnnInstallLogger.InstallLogError(exc); } } @@ -519,7 +519,7 @@ public static int AddPortal(IEventLogger eventLogger, IApplicationStatusInfo app } catch (Exception ex) { - Logger.Error(ex); + Logger.UpgradeAddPortalException(ex); if (HttpContext.Current != null) { @@ -572,7 +572,7 @@ public static void DeleteInstallerFiles() } catch (Exception ex) { - Logger.Error("File deletion failed for [Install\\" + file + "]. PLEASE REMOVE THIS MANUALLY." + ex); + Logger.UpgradeFileDeletionFailedFor(ex, file); } } } @@ -603,7 +603,7 @@ public static string DeleteFiles(string providerPath, Version version, bool writ } catch (Exception ex) { - Logger.Error("Error cleanup file " + listFile, ex); + Logger.UpgradeErrorCleanupFile(ex, listFile); exceptions += $"Error: {ex.Message + ex.StackTrace}{Environment.NewLine}"; @@ -611,15 +611,13 @@ public static string DeleteFiles(string providerPath, Version version, bool writ DnnInstallLogger.InstallLogError(exceptions); try { - using (StreamWriter streamWriter = File.CreateText(providerPath + stringVersion + "_Config.log")) - { - streamWriter.WriteLine(exceptions); - streamWriter.Close(); - } + using var streamWriter = File.CreateText(providerPath + stringVersion + "_Config.log"); + streamWriter.WriteLine(exceptions); + streamWriter.Close(); } catch (Exception exc) { - Logger.Error(exc); + Logger.UpgradeDeleteFilesException(exc); } } @@ -655,7 +653,7 @@ public static void ExecuteScripts(string strProviderPath) } catch (Exception exc) { - Logger.Error(exc); + Logger.UpgradeExceptionDeletingScriptFileAfterExecution(exc); } } } @@ -855,7 +853,7 @@ public static ArrayList GetUpgradeScripts(string providerPath, Version databaseV string[] files = Directory.GetFiles(providerPath, "*." + DefaultProvider); Array.Sort(files); // The order of the returned file names is not guaranteed on certain NAS systems; use the Sort method if a specific sort order is required. - Logger.TraceFormat(CultureInfo.InvariantCulture, "GetUpgradedScripts databaseVersion:{0} applicationVersion:{1}", databaseVersion, ApplicationVersion); + Logger.UpgradeGetUpgradedScripts(databaseVersion, ApplicationVersion); foreach (string file in files) { @@ -878,7 +876,7 @@ public static ArrayList GetUpgradeScripts(string providerPath, Version databaseV scriptFiles.AddRange(incrementalFiles); } - Logger.TraceFormat(CultureInfo.InvariantCulture, "GetUpgradedScripts including {0}", file); + Logger.UpgradeGetUpgradedScriptsIncluding(file); } if (version == databaseVersion && version <= ApplicationVersion && GetFileName(file).Length == 9 + DefaultProvider.Length) @@ -889,7 +887,7 @@ public static ArrayList GetUpgradeScripts(string providerPath, Version databaseV scriptFiles.AddRange(incrementalFiles); } - Logger.TraceFormat(CultureInfo.InvariantCulture, "GetUpgradedScripts including {0}", file); + Logger.UpgradeGetUpgradedScriptsIncluding(file); } ////else @@ -1201,7 +1199,7 @@ public static bool InstallPackage(string file, string packageType, bool writeFee foreach (var log in installer.InstallerInfo.Log.Logs .Where(l => l.Type == LogType.Failure)) { - Logger.Error(log.Description); + Logger.UpgradeFailureLog(log.Description); DnnInstallLogger.InstallLogError(log.Description); } @@ -1224,7 +1222,7 @@ public static bool InstallPackage(string file, string packageType, bool writeFee } catch (Exception exc) { - Logger.Error(exc); + Logger.UpgradeExceptionDeletingPackageFileAfterInstallation(exc); } } @@ -1382,7 +1380,7 @@ public static void UpgradeApplication() { try { - // Remove UpdatePanel from Login Control - not neccessary in popup. + // Remove UpdatePanel from Login Control - not necessary in popup. var loginControl = ModuleControlController.GetModuleControlByControlKey("Login", -1); loginControl.SupportsPartialRendering = false; @@ -1394,7 +1392,7 @@ public static void UpgradeApplication() } catch (Exception ex) { - Logger.Error(ex); + Logger.UpgradeExceptionInUpgradeApplication(ex); var log = new LogInfo { LogTypeKey = nameof(EventLogType.HOST_ALERT), @@ -1409,7 +1407,7 @@ public static void UpgradeApplication() } catch (Exception exc) { - Logger.Error(exc); + Logger.UpgradeExceptionLoggingException(exc); } } @@ -1457,7 +1455,7 @@ public static string UpgradeApplication(string providerPath, Version version, bo } catch (Exception ex) { - Logger.Error(ex); + Logger.UpgradeExceptionDuringVersionSpecificUpgrade(ex, version); exceptions += $"Error: {ex.Message + ex.StackTrace}{Environment.NewLine}"; // log the results @@ -1472,15 +1470,13 @@ public static string UpgradeApplication(string providerPath, Version version, bo try { - using (StreamWriter streamWriter = File.CreateText(providerPath + Globals.FormatVersion(version) + "_Application.log.resources")) - { - streamWriter.WriteLine(exceptions); - streamWriter.Close(); - } + using var streamWriter = File.CreateText(providerPath + Globals.FormatVersion(version) + "_Application.log.resources"); + streamWriter.WriteLine(exceptions); + streamWriter.Close(); } catch (Exception exc) { - Logger.Error(exc); + Logger.UpgradeExceptionWritingExceptionLogForVersionSpecificUpgrade(exc, version); } } @@ -1576,7 +1572,7 @@ public static string UpdateConfig(string providerPath, string configFile, Versio } catch (Exception ex) { - Logger.Error(ex); + Logger.UpgradeExceptionUpdatingConfig(ex); exceptions += $"Error: {ex.Message + ex.StackTrace}{Environment.NewLine}"; // log the results @@ -1588,7 +1584,7 @@ public static string UpdateConfig(string providerPath, string configFile, Versio } catch (Exception exc) { - Logger.Error(exc); + Logger.UpgradeExceptionLoggingExceptionFromUpdatingConfig(exc); } } finally @@ -1903,7 +1899,7 @@ public static bool UpdateNewtonsoftVersion() } catch (Exception ex) { - Logger.Error(ex); + Logger.UpgradeUpdateNewtonsoftVersionException(ex); } return false; @@ -1973,7 +1969,7 @@ internal static string ExecuteScript(string scriptFile, bool writeFeedback) catch (Exception exc) { // does not have permission to create the log file - Logger.Error(exc); + Logger.UpgradeCreateExecuteScriptLogException(exc); } if (!writeFeedback) @@ -2126,12 +2122,11 @@ internal static void CheckFipsCompilanceAssemblies() protected static bool IsLanguageEnabled(int portalid, string code) { - Locale enabledLanguage; - return LocaleController.Instance.GetLocales(portalid).TryGetValue(code, out enabledLanguage); + return LocaleController.Instance.GetLocales(portalid).TryGetValue(code, out _); } /// AddModuleControl adds a new Module Control to the system. - /// The Module Definition Id. + /// The Module Definition ID. /// The key for this control in the Definition. /// The title of this control. /// Te source of ths control. @@ -2413,7 +2408,7 @@ private static string InstallMemberRoleProviderScript(string providerPath, strin catch (Exception exc) { // does not have permission to create the log file - Logger.Error(exc); + Logger.UpgradeCreateMemberRoleProviderLogException(exc); } return exceptions; @@ -2505,7 +2500,7 @@ private static void RemoveGettingStartedPages() } catch (Exception ex) { - Logger.Error(ex); + Logger.UpgradeRemoveGettingStartedPageException(ex); } } } @@ -2673,7 +2668,7 @@ private static void FixFipsCompilanceAssembly(string filePath) } catch (Exception ex) { - Logger.Error(ex); + Logger.UpgradeFixFipsComplianceAssemblyException(ex); } } @@ -2768,7 +2763,7 @@ private static XmlDocument FindLanguageXmlDocument(string cultureCode, ref IDict } catch (Exception ex) { - Logger.Error(ex); + Logger.UpgradeFindLanguageXmlDocumentException(ex); return null; } diff --git a/DNN Platform/Library/Services/UserProfile/UserProfilePageHandler.cs b/DNN Platform/Library/Services/UserProfile/UserProfilePageHandler.cs index f4c7ebee3ee..c472b6bf1df 100644 --- a/DNN Platform/Library/Services/UserProfile/UserProfilePageHandler.cs +++ b/DNN Platform/Library/Services/UserProfile/UserProfilePageHandler.cs @@ -15,18 +15,13 @@ namespace DotNetNuke.Services.UserProfile using Microsoft.Extensions.Logging; - public class UserProfilePageHandler : IHttpHandler + /// Redirects to the user's profile page. + public partial class UserProfilePageHandler : IHttpHandler { private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// - public bool IsReusable - { - get - { - return true; - } - } + public bool IsReusable => true; /// This handler handles requests for LinkClick.aspx, but only those specific to file serving. /// System.Web.HttpContext. @@ -88,7 +83,7 @@ public void ProcessRequest(HttpContext context) } catch (Exception exc) { - Logger.Debug(exc); + Logger.UserProfilePageHandlerException(exc); // The user cannot be found (potential DOS) Exceptions.Exceptions.ProcessHttpException(context.Request); diff --git a/DNN Platform/Library/UI/Containers/Container.cs b/DNN Platform/Library/UI/Containers/Container.cs index 87646d0b55e..a034550f4f2 100644 --- a/DNN Platform/Library/UI/Containers/Container.cs +++ b/DNN Platform/Library/UI/Containers/Container.cs @@ -32,7 +32,7 @@ namespace DotNetNuke.UI.Containers using Microsoft.Extensions.Logging; /// Container is the base for the Containers. - public class Container : UserControl + public partial class Container : UserControl { private readonly ILogger tracelLogger = DnnLoggingController.GetLogger("DNN.Trace"); private readonly IClientResourceController clientResourceController; @@ -275,10 +275,7 @@ private void ProcessHeader() /// ProcessModule processes the module which is attached to this container. private void ProcessModule() { - if (this.tracelLogger.IsDebugEnabled) - { - this.tracelLogger.Debug($"Container.ProcessModule Start (TabId:{this.PortalSettings.ActiveTab.TabID},ModuleID: {this.ModuleConfiguration.ModuleDefinition.DesktopModuleID}): Module FriendlyName: '{this.ModuleConfiguration.ModuleDefinition.FriendlyName}')"); - } + this.tracelLogger.ContainerProcessModuleStart(this.PortalSettings.ActiveTab.TabID, this.ModuleConfiguration.ModuleDefinition.DesktopModuleID, this.ModuleConfiguration.ModuleDefinition.FriendlyName); if (this.ContentPane != null) { @@ -300,10 +297,7 @@ private void ProcessModule() // Try to load the module control this.moduleHost = new ModuleHost(this.ModuleConfiguration, this.ParentSkin, this); - if (this.tracelLogger.IsDebugEnabled) - { - this.tracelLogger.Debug($"Container.ProcessModule Info (TabId:{this.PortalSettings.ActiveTab.TabID},ModuleID: {this.ModuleConfiguration.ModuleDefinition.DesktopModuleID}): ControlPane.Controls.Add(ModuleHost:{this.moduleHost.ID})"); - } + this.tracelLogger.ContainerProcessModuleInfo(this.PortalSettings.ActiveTab.TabID, this.ModuleConfiguration.ModuleDefinition.DesktopModuleID, this.moduleHost.ID); this.ContentPane.Controls.Add(this.ModuleHost); @@ -320,16 +314,10 @@ private void ProcessModule() this.ProcessStylesheets(this.ModuleHost != null); } - if (this.tracelLogger.IsDebugEnabled) - { - this.tracelLogger.Debug($"Container.ProcessModule End (TabId:{this.PortalSettings.ActiveTab.TabID},ModuleID: {this.ModuleConfiguration.ModuleDefinition.DesktopModuleID}): Module FriendlyName: '{this.ModuleConfiguration.ModuleDefinition.FriendlyName}')"); - } + this.tracelLogger.ContainerProcessModuleEnd(this.PortalSettings.ActiveTab.TabID, this.ModuleConfiguration.ModuleDefinition.DesktopModuleID, this.ModuleConfiguration.ModuleDefinition.FriendlyName); } - /// - /// ProcessStylesheets processes the Module and Container stylesheets and adds - /// them to the Page. - /// + /// ProcessStylesheets processes the Module and Container stylesheets and adds them to the Page. private void ProcessStylesheets(bool includeModuleCss) { this.clientResourceController.RegisterStylesheet(this.ContainerPath + "container.css", FileOrder.Css.ContainerCss, true); diff --git a/DNN Platform/Library/UI/Modules/ModuleControlFactory.cs b/DNN Platform/Library/UI/Modules/ModuleControlFactory.cs index a3be6f3b7cf..cb5397556d0 100644 --- a/DNN Platform/Library/UI/Modules/ModuleControlFactory.cs +++ b/DNN Platform/Library/UI/Modules/ModuleControlFactory.cs @@ -27,10 +27,7 @@ public partial class ModuleControlFactory [DnnDeprecated(9, 4, 0, "This implementation has moved to DotNetNuke.ModulePipeline.ModuleControlPipeline")] public static partial Control LoadModuleControl(TemplateControl containerControl, ModuleInfo moduleConfiguration, string controlKey, string controlSrc) { - if (TracelLogger.IsDebugEnabled) - { - TracelLogger.Debug($"ModuleControlFactory.LoadModuleControl Start (TabId:{moduleConfiguration.TabID},ModuleId:{moduleConfiguration.ModuleID}): ModuleControlSource:{moduleConfiguration.ModuleControl.ControlSrc}"); - } + TracelLogger.ModuleControlFactoryLoadModuleControlStart(moduleConfiguration.TabID, moduleConfiguration.ModuleID, moduleConfiguration.ModuleControl.ControlSrc); Control control = null; IModuleControlFactory controlFactory = GetModuleControlFactory(controlSrc); @@ -40,25 +37,18 @@ public static partial Control LoadModuleControl(TemplateControl containerControl control = controlFactory.CreateControl(containerControl, controlKey, controlSrc); } - // set the control ID to the resource file name ( ie. controlname.ascx = controlname ) + // set the control ID to the resource file name ( i.e. controlname.ascx = controlname ) // this is necessary for the Localization in PageBase if (control != null) { control.ID = Path.GetFileNameWithoutExtension(controlSrc); - - var moduleControl = control as IModuleControl; - - if (moduleControl != null) + if (control is IModuleControl moduleControl) { moduleControl.ModuleContext.Configuration = moduleConfiguration; } } - if (TracelLogger.IsDebugEnabled) - { - TracelLogger.Debug($"ModuleControlFactory.LoadModuleControl End (TabId:{moduleConfiguration.TabID},ModuleId:{moduleConfiguration.ModuleID}): ModuleControlSource:{moduleConfiguration.ModuleControl.ControlSrc}"); - } - + TracelLogger.ModuleControlFactoryLoadModuleControlEnd(moduleConfiguration.TabID, moduleConfiguration.ModuleID, moduleConfiguration.ModuleControl.ControlSrc); return control; } @@ -66,10 +56,7 @@ public static partial Control LoadModuleControl(TemplateControl containerControl [DnnDeprecated(9, 4, 0, "This implementation has moved to DotNetNuke.ModulePipeline.ModuleControlPipeline")] public static partial Control LoadModuleControl(TemplateControl containerControl, ModuleInfo moduleConfiguration) { - if (TracelLogger.IsDebugEnabled) - { - TracelLogger.Debug($"ModuleControlFactory.LoadModuleControl Start (TabId:{moduleConfiguration.TabID},ModuleId:{moduleConfiguration.ModuleID}): ModuleControlSource:{moduleConfiguration.ModuleControl.ControlSrc}"); - } + TracelLogger.ModuleControlFactoryLoadModuleControlStart(moduleConfiguration.TabID, moduleConfiguration.ModuleID, moduleConfiguration.ModuleControl.ControlSrc); Control control = null; IModuleControlFactory controlFactory = GetModuleControlFactory(moduleConfiguration.ModuleControl.ControlSrc); @@ -79,25 +66,19 @@ public static partial Control LoadModuleControl(TemplateControl containerControl control = controlFactory.CreateModuleControl(containerControl, moduleConfiguration); } - // set the control ID to the resource file name ( ie. controlname.ascx = controlname ) + // set the control ID to the resource file name ( i.e. controlname.ascx = controlname ) // this is necessary for the Localization in PageBase if (control != null) { control.ID = Path.GetFileNameWithoutExtension(moduleConfiguration.ModuleControl.ControlSrc); - var moduleControl = control as IModuleControl; - - if (moduleControl != null) + if (control is IModuleControl moduleControl) { moduleControl.ModuleContext.Configuration = moduleConfiguration; } } - if (TracelLogger.IsDebugEnabled) - { - TracelLogger.Debug($"ModuleControlFactory.LoadModuleControl End (TabId:{moduleConfiguration.TabID},ModuleId:{moduleConfiguration.ModuleID}): ModuleControlSource:{moduleConfiguration.ModuleControl.ControlSrc}"); - } - + TracelLogger.ModuleControlFactoryLoadModuleControlEnd(moduleConfiguration.TabID, moduleConfiguration.ModuleID, moduleConfiguration.ModuleControl.ControlSrc); return control; } @@ -105,10 +86,7 @@ public static partial Control LoadModuleControl(TemplateControl containerControl [DnnDeprecated(9, 4, 0, "This implementation has moved to DotNetNuke.ModulePipeline.ModuleControlPipeline")] public static partial Control LoadSettingsControl(TemplateControl containerControl, ModuleInfo moduleConfiguration, string controlSrc) { - if (TracelLogger.IsDebugEnabled) - { - TracelLogger.Debug($"ModuleControlFactory.LoadSettingsControl Start (TabId:{moduleConfiguration.TabID},ModuleId:{moduleConfiguration.ModuleID}): ModuleControlSource:{moduleConfiguration.ModuleControl.ControlSrc}"); - } + TracelLogger.ModuleControlFactoryLoadSettingsControlStart(moduleConfiguration.TabID, moduleConfiguration.ModuleID, moduleConfiguration.ModuleControl.ControlSrc); Control control = null; IModuleControlFactory controlFactory = GetModuleControlFactory(controlSrc); @@ -118,7 +96,7 @@ public static partial Control LoadSettingsControl(TemplateControl containerContr control = controlFactory.CreateSettingsControl(containerControl, moduleConfiguration, controlSrc); } - // set the control ID to the resource file name ( ie. controlname.ascx = controlname ) + // set the control ID to the resource file name ( i.e. controlname.ascx = controlname ) // this is necessary for the Localization in PageBase if (control != null) { @@ -128,19 +106,13 @@ public static partial Control LoadSettingsControl(TemplateControl containerContr control.ID = fileNameWithoutExtension.Replace('.', '-'); } - var settingsControl = control as ISettingsControl; - - if (settingsControl != null) + if (control is ISettingsControl settingsControl) { settingsControl.ModuleContext.Configuration = moduleConfiguration; } } - if (TracelLogger.IsDebugEnabled) - { - TracelLogger.Debug($"ModuleControlFactory.LoadSettingsControl End (TabId:{moduleConfiguration.TabID},ModuleId:{moduleConfiguration.ModuleID}): ModuleControlSource:{moduleConfiguration.ModuleControl.ControlSrc}"); - } - + TracelLogger.ModuleControlFactoryLoadSettingsControlEnd(moduleConfiguration.TabID, moduleConfiguration.ModuleID, moduleConfiguration.ModuleControl.ControlSrc); return control; } diff --git a/DNN Platform/Library/UI/Modules/ModuleHost.cs b/DNN Platform/Library/UI/Modules/ModuleHost.cs index 9ddf1a16c89..38f0c740839 100644 --- a/DNN Platform/Library/UI/Modules/ModuleHost.cs +++ b/DNN Platform/Library/UI/Modules/ModuleHost.cs @@ -39,7 +39,7 @@ namespace DotNetNuke.UI.Modules using Globals = DotNetNuke.Common.Globals; /// ModuleHost hosts a Module Control (or its cached Content). - public sealed class ModuleHost : Panel + public sealed partial class ModuleHost : Panel { private const string DefaultCssProvider = "DnnPageHeaderProvider"; private const string DefaultJsProvider = "DnnBodyProvider"; @@ -249,7 +249,7 @@ private bool DisplayContent() return content; } - /// LoadModuleControl loads the ModuleControl (PortalModuelBase). + /// LoadModuleControl loads the ModuleControl (PortalModuleBase). private void LoadModuleControl() { try @@ -275,24 +275,21 @@ private void LoadModuleControl() this.control = this.moduleControlPipeline.CreateModuleControl(this.moduleConfiguration); } - if (this.Skin != null) - { - // check for IMC - this.Skin.Communicator.LoadCommunicator(this.control); - } + // check for IMC + this.Skin?.Communicator.LoadCommunicator(this.control); // add module settings this.ModuleControl.ModuleContext.Configuration = this.moduleConfiguration; } catch (ThreadAbortException exc) { - Logger.Debug(exc); + Logger.ModuleHostThreadAbortException(exc); Thread.ResetAbort(); } catch (Exception exc) { - Logger.Error(exc); + Logger.ModuleHostLoadModuleControlException(exc); // add module settings this.control = this.moduleControlPipeline.CreateModuleControl(this.moduleConfiguration); diff --git a/DNN Platform/Library/UI/Skins/SkinController.cs b/DNN Platform/Library/UI/Skins/SkinController.cs index 7a1676b1535..385b7e41375 100644 --- a/DNN Platform/Library/UI/Skins/SkinController.cs +++ b/DNN Platform/Library/UI/Skins/SkinController.cs @@ -482,7 +482,7 @@ public static string UploadLegacySkin(string rootPath, string skinRoot, string s } catch (Exception exc) { - Logger.Error(exc); + Logger.SkinControllerExceptionLoggingInstallationEvent(exc); } return strMessage; diff --git a/DNN Platform/Library/UI/Skins/SkinFileProcessor.cs b/DNN Platform/Library/UI/Skins/SkinFileProcessor.cs index 6c85188a42d..376fbc086d2 100644 --- a/DNN Platform/Library/UI/Skins/SkinFileProcessor.cs +++ b/DNN Platform/Library/UI/Skins/SkinFileProcessor.cs @@ -58,10 +58,7 @@ public SkinFileProcessor(string controlKey, string controlSrc) this.ObjectFactory = new ObjectParser(this.controlList); } - /// - /// Initializes a new instance of the class. - /// SkinFileProcessor class constructor. - /// + /// Initializes a new instance of the class. /// File path to the portals upload directory. /// Specifies type of skin (Skins or Containers). /// Name of folder in which skin will reside (Zip file name). @@ -101,7 +98,7 @@ public SkinFileProcessor(string skinPath, string skinRoot, string skinName) catch (Exception ex) { // could not load XML file - Logger.Error(ex); + Logger.SkinFileProcessorLoadXmlFileException(ex); this.Message += SkinController.FormatMessage(string.Format(CultureInfo.CurrentCulture, this.pACKAGELOADERROR, ex.Message), Path.GetFileName(fileName), 2, true); } } @@ -885,7 +882,7 @@ public SkinFile(string skinRoot, string fileName, XmlDocument skinAttributes) catch (Exception exc) { // could not load XML file - Logger.Error(exc); + Logger.SkinFileLoadXmlFileException(exc); this.fileAttributes = skinAttributes; this.messages += SkinController.FormatMessage(this.fileLoadError, fileName, 2, true); } diff --git a/DNN Platform/Library/UI/Skins/SkinThumbNailControl.cs b/DNN Platform/Library/UI/Skins/SkinThumbNailControl.cs index 298800f60aa..7f77d165964 100644 --- a/DNN Platform/Library/UI/Skins/SkinThumbNailControl.cs +++ b/DNN Platform/Library/UI/Skins/SkinThumbNailControl.cs @@ -333,7 +333,7 @@ private static string CreateThumbnail(string strImage) } catch (Exception ex) { - Logger.Error(ex); + Logger.SkinThumbNailControlCreateThumbnailException(ex); } } diff --git a/DNN Platform/Library/UI/WebControls/CaptchaControl.cs b/DNN Platform/Library/UI/WebControls/CaptchaControl.cs index b284a25e346..337a330d7f7 100644 --- a/DNN Platform/Library/UI/WebControls/CaptchaControl.cs +++ b/DNN Platform/Library/UI/WebControls/CaptchaControl.cs @@ -32,7 +32,7 @@ namespace DotNetNuke.UI.WebControls /// The CaptchaControl control provides a Captcha Challenge control. [ToolboxData("<{0}:CaptchaControl Runat=\"server\" CaptchaHeight=\"100px\" CaptchaWidth=\"300px\" />")] - public class CaptchaControl : WebControl, INamingContainer, IPostBackDataHandler + public partial class CaptchaControl : WebControl, INamingContainer, IPostBackDataHandler { internal const string KEY = "captcha"; private const int EXPIRATIONDEFAULT = 120; @@ -622,7 +622,7 @@ private static GraphicsPath CreateText(string text, int width, int height, Graph } catch (Exception exc) { - Logger.Error(exc); + Logger.CaptchaControlCreateTextException(exc); } return textPath; @@ -674,7 +674,7 @@ private static string Decrypt(string encryptedContent) } catch (ArgumentException exc) { - Logger.Debug(exc); + Logger.CaptchaControlDecryptException(exc); } return decryptedText; @@ -731,7 +731,7 @@ private static FontFamily GetFont() } catch (Exception exc) { - Logger.Error(exc); + Logger.CaptchaControlGetFontException(exc); font = null; } diff --git a/DNN Platform/Library/UI/WebControls/PropertyEditor/Edit Controls/DNN Edit Controls/DNNListEditControl.cs b/DNN Platform/Library/UI/WebControls/PropertyEditor/Edit Controls/DNN Edit Controls/DNNListEditControl.cs index e20d95a513b..473ebb52efb 100644 --- a/DNN Platform/Library/UI/WebControls/PropertyEditor/Edit Controls/DNN Edit Controls/DNNListEditControl.cs +++ b/DNN Platform/Library/UI/WebControls/PropertyEditor/Edit Controls/DNN Edit Controls/DNNListEditControl.cs @@ -79,7 +79,7 @@ protected int IntegerValue } catch (Exception exc) { - Logger.Error(exc); + Logger.DnnListEditControlIntegerValueException(exc); } return intValue; @@ -126,7 +126,7 @@ protected int OldIntegerValue } catch (Exception exc) { - Logger.Error(exc); + Logger.DnnListEditControlOldIntegerValueException(exc); } return intValue; diff --git a/DNN Platform/Library/UI/WebControls/PropertyEditor/Edit Controls/DateEditControl.cs b/DNN Platform/Library/UI/WebControls/PropertyEditor/Edit Controls/DateEditControl.cs index ee8832da2ba..3758a6c08c0 100644 --- a/DNN Platform/Library/UI/WebControls/PropertyEditor/Edit Controls/DateEditControl.cs +++ b/DNN Platform/Library/UI/WebControls/PropertyEditor/Edit Controls/DateEditControl.cs @@ -43,7 +43,7 @@ protected DateTime DateValue } catch (Exception exc) { - Logger.Error(exc); + Logger.DateEditControlDateValueException(exc); } return dteValue; @@ -104,7 +104,7 @@ protected DateTime OldDateValue } catch (Exception exc) { - Logger.Error(exc); + Logger.DateEditControlOldDateValueException(exc); } return dteValue; diff --git a/DNN Platform/Library/UI/WebControls/PropertyEditor/Edit Controls/IntegerEditControl.cs b/DNN Platform/Library/UI/WebControls/PropertyEditor/Edit Controls/IntegerEditControl.cs index 03914b80c95..29ea60db4e4 100644 --- a/DNN Platform/Library/UI/WebControls/PropertyEditor/Edit Controls/IntegerEditControl.cs +++ b/DNN Platform/Library/UI/WebControls/PropertyEditor/Edit Controls/IntegerEditControl.cs @@ -47,7 +47,7 @@ protected int IntegerValue } catch (Exception exc) { - Logger.Error(exc); + Logger.IntegerEditControlIntegerValueException(exc); } return intValue; @@ -71,7 +71,7 @@ protected int OldIntegerValue } catch (Exception exc) { - Logger.Error(exc); + Logger.IntegerEditControlOldIntegerValueException(exc); } return intValue; diff --git a/DNN Platform/Library/UI/WebControls/PropertyEditor/Edit Controls/TrueFalseEditControl.cs b/DNN Platform/Library/UI/WebControls/PropertyEditor/Edit Controls/TrueFalseEditControl.cs index 3349ac43510..0bbea29200e 100644 --- a/DNN Platform/Library/UI/WebControls/PropertyEditor/Edit Controls/TrueFalseEditControl.cs +++ b/DNN Platform/Library/UI/WebControls/PropertyEditor/Edit Controls/TrueFalseEditControl.cs @@ -42,7 +42,7 @@ protected bool BooleanValue } catch (Exception exc) { - Logger.Error(exc); + Logger.TrueFalseEditControlBooleanValueException(exc); } return boolValue; @@ -58,12 +58,12 @@ protected bool OldBooleanValue bool boolValue = Null.NullBoolean; try { - // Try and cast the value to an Boolean + // Try and cast the value to a Boolean boolValue = Convert.ToBoolean(this.OldValue, CultureInfo.InvariantCulture); } catch (Exception exc) { - Logger.Error(exc); + Logger.TrueFalseEditControlOldBooleanValueException(exc); } return boolValue; diff --git a/DNN Platform/Library/UI/WebControls/PropertyEditor/SettingInfo.cs b/DNN Platform/Library/UI/WebControls/PropertyEditor/SettingInfo.cs index 3d0558443f7..78cd22e6b26 100644 --- a/DNN Platform/Library/UI/WebControls/PropertyEditor/SettingInfo.cs +++ b/DNN Platform/Library/UI/WebControls/PropertyEditor/SettingInfo.cs @@ -42,7 +42,7 @@ public SettingInfo(object name, object value) } catch (Exception exc) { - Logger.Error(exc); + Logger.SettingInfoBoolParseException(exc); } } @@ -56,7 +56,7 @@ public SettingInfo(object name, object value) } catch (Exception exc) { - Logger.Error(exc); + Logger.SettingInfoInt32ParseException(exc); } } } diff --git a/DNN Platform/Modules/CoreMessaging/Components/CoreMessagingBusinessController.cs b/DNN Platform/Modules/CoreMessaging/Components/CoreMessagingBusinessController.cs index 8551acff77d..5473da907b5 100644 --- a/DNN Platform/Modules/CoreMessaging/Components/CoreMessagingBusinessController.cs +++ b/DNN Platform/Modules/CoreMessaging/Components/CoreMessagingBusinessController.cs @@ -70,7 +70,7 @@ public string UpgradeModule(string version) } catch (Exception exc) { - Logger.Error(exc); + Logger.CoreMessagingBusinessControllerUpgradeModuleException(exc); return "Failed"; } diff --git a/DNN Platform/Modules/CoreMessaging/DotNetNuke.Modules.CoreMessaging.csproj b/DNN Platform/Modules/CoreMessaging/DotNetNuke.Modules.CoreMessaging.csproj index e955a0e2757..c3fc7bf2ef7 100644 --- a/DNN Platform/Modules/CoreMessaging/DotNetNuke.Modules.CoreMessaging.csproj +++ b/DNN Platform/Modules/CoreMessaging/DotNetNuke.Modules.CoreMessaging.csproj @@ -70,6 +70,7 @@ Properties\SolutionInfo.cs + diff --git a/DNN Platform/Modules/CoreMessaging/LoggerMessages.cs b/DNN Platform/Modules/CoreMessaging/LoggerMessages.cs new file mode 100644 index 00000000000..d91b3da00d8 --- /dev/null +++ b/DNN Platform/Modules/CoreMessaging/LoggerMessages.cs @@ -0,0 +1,69 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace DotNetNuke.Modules.CoreMessaging +{ + using System; + + using Microsoft.Extensions.Logging; + + /// Extension methods for for pre-defined logging messages. + /// The DotNetNuke.Modules.CoreMessaging project has been assigned event IDs from 3,000,000 to 3,099,999. + internal static partial class LoggerMessages + { + [LoggerMessage(EventId = 3_000_000, Level = LogLevel.Error)] + public static partial void CoreMessagingBusinessControllerUpgradeModuleException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_000_100, Level = LogLevel.Error)] + public static partial void FileUploadControllerUploadFileException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_000_200, Level = LogLevel.Error, Message = "An unexpected error occurred while trying to fetch the inbox, consult the server logs for more information.")] + public static partial void MessagingServiceControllerUnexpectedErrorFetchingInbox(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_000_201, Level = LogLevel.Error, Message = "An unexpected error occurred while attempting to fetch the Sent box, consult the server logs for more information.")] + public static partial void MessagingServiceControllerUnexpectedErrorFetchingSentBox(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_000_202, Level = LogLevel.Error, Message = "An unexpected error occurred while attempting to fetch the archived box.")] + public static partial void MessagingServiceControllerUnexpectedErrorFetchingArchivedBox(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_000_203, Level = LogLevel.Error, Message = "An unexpected error occurred while attempting to fetch the thread, consult the server logs for more information.")] + public static partial void MessagingServiceControllerUnexpectedErrorFetchingThread(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_000_204, Level = LogLevel.Error, Message = "An unexpected error occurred while attempting to reply to a conversation, see the server logs for more information.")] + public static partial void MessagingServiceControllerUnexpectedErrorReplying(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_000_205, Level = LogLevel.Error, Message = "An unexpected error occurred while attempting to fetch the archived box, consult the server logs for more information.")] + public static partial void MessagingServiceControllerUnexpectedErrorMarkingArchived(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_000_206, Level = LogLevel.Error, Message = "An unexpected error occurred while attempting to restore an archived conversation, consult the server logs for more information.")] + public static partial void MessagingServiceControllerUnexpectedErrorRestoringArchivedConversation(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_000_207, Level = LogLevel.Error, Message = "An unexpected error occurred while attempting mark a conversation as read, consult the server logs for more information.")] + public static partial void MessagingServiceControllerUnexpectedErrorMarkingConversationAsRead(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_000_208, Level = LogLevel.Error, Message = "An unexpected error occurred while attempting to restore an archived conversation, consult the server logs for more information.")] + public static partial void MessagingServiceControllerUnexpectedErrorMarkingConversationAsUnread(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_000_209, Level = LogLevel.Error, Message = "An unexpected error occurred while attempting to delete a user from a conversation, consult the server logs for more information.")] + public static partial void MessagingServiceControllerUnexpectedErrorDeleteUserFromConversation(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_000_210, Level = LogLevel.Error, Message = "An unexpected error occurred while attempting to fetch messaging notifications, consult the server logs for more information.")] + public static partial void MessagingServiceControllerUnexpectedErrorFetchingNotifications(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_000_211, Level = LogLevel.Error, Message = "An unexpected error occurred while attempting to check the recipient count on a reply, consult the server logs for more information.")] + public static partial void MessagingServiceControllerUnexpectedErrorCheckRecipientCount(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_000_212, Level = LogLevel.Error, Message = "An unexpected error occurred while attempting to get the notification count, consult the server logs for more information.")] + public static partial void MessagingServiceControllerUnexpectedErrorGettingNotificationCount(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_000_213, Level = LogLevel.Error, Message = "An unexpected error occurred while attempting to , consult the server logs for more information.")] + public static partial void MessagingServiceControllerUnexpectedErrorGettingUnreadCount(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_000_214, Level = LogLevel.Error, Message = "An unexpected error occurred while attempting to get the unread messages and new notifications count, consult the server logs for more information.")] + public static partial void MessagingServiceControllerUnexpectedErrorGettingUnreadAndNotificationCounts(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_000_215, Level = LogLevel.Error, Message = "An unexpected error occurred while attempting to dismiss notifications, consult the server logs for more information.")] + public static partial void MessagingServiceControllerUnexpectedErrorDismissingNotifications(this ILogger logger, Exception exception); + } +} diff --git a/DNN Platform/Modules/CoreMessaging/Services/FileUploadController.cs b/DNN Platform/Modules/CoreMessaging/Services/FileUploadController.cs index 0e122b42ccf..0ca40aabe1f 100644 --- a/DNN Platform/Modules/CoreMessaging/Services/FileUploadController.cs +++ b/DNN Platform/Modules/CoreMessaging/Services/FileUploadController.cs @@ -44,7 +44,7 @@ public HttpResponseMessage UploadFile() } catch (Exception exc) { - Logger.Error(exc); + Logger.FileUploadControllerUploadFileException(exc); } return this.IframeSafeJson(statuses); diff --git a/DNN Platform/Modules/CoreMessaging/Services/MessagingServiceController.cs b/DNN Platform/Modules/CoreMessaging/Services/MessagingServiceController.cs index 3f4bad6a251..71d61d975a6 100644 --- a/DNN Platform/Modules/CoreMessaging/Services/MessagingServiceController.cs +++ b/DNN Platform/Modules/CoreMessaging/Services/MessagingServiceController.cs @@ -83,9 +83,8 @@ public HttpResponseMessage Inbox(int afterMessageId, int numberOfRecords) } catch (Exception ex) { - var message = "An unexpected error occurred while trying to fetch the inbox, consult the server logs for more information."; - Logger.Error(message, ex); - return this.Request.CreateResponse(HttpStatusCode.InternalServerError, message); + Logger.MessagingServiceControllerUnexpectedErrorFetchingInbox(ex); + return this.Request.CreateResponse(HttpStatusCode.InternalServerError, "An unexpected error occurred while trying to fetch the inbox, consult the server logs for more information."); } } @@ -107,9 +106,8 @@ public HttpResponseMessage Sentbox(int afterMessageId, int numberOfRecords) } catch (Exception ex) { - var message = "An unexpected error occurred while attempting to fetch the Sent box, consult the server logs for more information."; - Logger.Error(message, ex); - return this.Request.CreateResponse(HttpStatusCode.InternalServerError, message); + Logger.MessagingServiceControllerUnexpectedErrorFetchingSentBox(ex); + return this.Request.CreateResponse(HttpStatusCode.InternalServerError, "An unexpected error occurred while attempting to fetch the Sent box, consult the server logs for more information."); } } @@ -131,9 +129,8 @@ public HttpResponseMessage Archived(int afterMessageId, int numberOfRecords) } catch (Exception ex) { - var message = "An unexpected error occurred while attempting to fetch the archived box."; - Logger.Error(message, ex); - return this.Request.CreateResponse(HttpStatusCode.InternalServerError, message); + Logger.MessagingServiceControllerUnexpectedErrorFetchingArchivedBox(ex); + return this.Request.CreateResponse(HttpStatusCode.InternalServerError, "An unexpected error occurred while attempting to fetch the archived box."); } } @@ -158,9 +155,8 @@ public HttpResponseMessage Thread(int conversationId, int afterMessageId, int nu } catch (Exception ex) { - var message = "An unexpected error occurred while attempting to fetch the thread, consult the server logs for more information."; - Logger.Error(message, ex); - return this.Request.CreateResponse(HttpStatusCode.InternalServerError, message); + Logger.MessagingServiceControllerUnexpectedErrorFetchingThread(ex); + return this.Request.CreateResponse(HttpStatusCode.InternalServerError, "An unexpected error occurred while attempting to fetch the thread, consult the server logs for more information."); } } @@ -187,9 +183,8 @@ public HttpResponseMessage Reply(ReplyDTO postData) } catch (Exception ex) { - var message = "An unexpected error occurred while attempting to reply to a conversation, see the server logs for more information."; - Logger.Error(message, ex); - return this.Request.CreateResponse(HttpStatusCode.InternalServerError, message); + Logger.MessagingServiceControllerUnexpectedErrorReplying(ex); + return this.Request.CreateResponse(HttpStatusCode.InternalServerError, "An unexpected error occurred while attempting to reply to a conversation, see the server logs for more information."); } } @@ -207,9 +202,8 @@ public HttpResponseMessage MarkArchived(ConversationDTO postData) } catch (Exception ex) { - var message = "An unexpected error occurred while attempting to fetch the archived box, consult the server logs for more information."; - Logger.Error(message, ex); - return this.Request.CreateResponse(HttpStatusCode.InternalServerError, message); + Logger.MessagingServiceControllerUnexpectedErrorMarkingArchived(ex); + return this.Request.CreateResponse(HttpStatusCode.InternalServerError, "An unexpected error occurred while attempting to fetch the archived box, consult the server logs for more information."); } } @@ -227,9 +221,8 @@ public HttpResponseMessage MarkUnArchived(ConversationDTO postData) } catch (Exception ex) { - var message = "An unexpected error occurred while attempting to restore an archived conversation, consult the server logs for more information."; - Logger.Error(message, ex); - return this.Request.CreateResponse(HttpStatusCode.InternalServerError, message); + Logger.MessagingServiceControllerUnexpectedErrorRestoringArchivedConversation(ex); + return this.Request.CreateResponse(HttpStatusCode.InternalServerError, "An unexpected error occurred while attempting to restore an archived conversation, consult the server logs for more information."); } } @@ -247,9 +240,8 @@ public HttpResponseMessage MarkRead(ConversationDTO postData) } catch (Exception ex) { - var message = "An unexpected error occurred while attempting mark a conversation as read, consult the server logs for more information."; - Logger.Error(message, ex); - return this.Request.CreateResponse(HttpStatusCode.InternalServerError, message); + Logger.MessagingServiceControllerUnexpectedErrorMarkingConversationAsRead(ex); + return this.Request.CreateResponse(HttpStatusCode.InternalServerError, "An unexpected error occurred while attempting mark a conversation as read, consult the server logs for more information."); } } @@ -267,9 +259,8 @@ public HttpResponseMessage MarkUnRead(ConversationDTO postData) } catch (Exception ex) { - var message = "An unexpected error occurred while attempting to restore an archived conversation, consult the server logs for more information."; - Logger.Error(message, ex); - return this.Request.CreateResponse(HttpStatusCode.InternalServerError, message); + Logger.MessagingServiceControllerUnexpectedErrorMarkingConversationAsUnread(ex); + return this.Request.CreateResponse(HttpStatusCode.InternalServerError, "An unexpected error occurred while attempting to restore an archived conversation, consult the server logs for more information."); } } @@ -287,9 +278,8 @@ public HttpResponseMessage DeleteUserFromConversation(ConversationDTO postData) } catch (Exception ex) { - var message = "An unexpected error occurred while attempting to delete a user from a conversation, consult the server logs for more information."; - Logger.Error(message, ex); - return this.Request.CreateResponse(HttpStatusCode.InternalServerError, message); + Logger.MessagingServiceControllerUnexpectedErrorDeleteUserFromConversation(ex); + return this.Request.CreateResponse(HttpStatusCode.InternalServerError, "An unexpected error occurred while attempting to delete a user from a conversation, consult the server logs for more information."); } } @@ -363,14 +353,13 @@ public HttpResponseMessage Notifications(int afterNotificationId, int numberOfRe } catch (Exception ex) { - var message = "An unexpected error occurred while attempting to fetch messaging notifications, consult the server logs for more information."; - Logger.Error(message, ex); - return this.Request.CreateResponse(HttpStatusCode.InternalServerError, message); + Logger.MessagingServiceControllerUnexpectedErrorFetchingNotifications(ex); + return this.Request.CreateResponse(HttpStatusCode.InternalServerError, "An unexpected error occurred while attempting to fetch messaging notifications, consult the server logs for more information."); } } /// Checks if a reply has recipients. - /// The id of conversation to check./>. + /// The ID of conversation to check./>. /// The recipient count or an InternalServerError. [HttpGet] public HttpResponseMessage CheckReplyHasRecipients(int conversationId) @@ -382,9 +371,8 @@ public HttpResponseMessage CheckReplyHasRecipients(int conversationId) } catch (Exception ex) { - var message = "An unexpected error occurred while attempting to check the recipient count on a reply, consult the server logs for more information."; - Logger.Error(message, ex); - return this.Request.CreateResponse(HttpStatusCode.InternalServerError, message); + Logger.MessagingServiceControllerUnexpectedErrorCheckRecipientCount(ex); + return this.Request.CreateResponse(HttpStatusCode.InternalServerError, "An unexpected error occurred while attempting to check the recipient count on a reply, consult the server logs for more information."); } } @@ -401,9 +389,8 @@ public HttpResponseMessage CountNotifications() } catch (Exception ex) { - const string message = "An unexpected error occurred while attempting to get the notification count, consult the server logs for more information."; - Logger.Error(message, ex); - return this.Request.CreateResponse(HttpStatusCode.InternalServerError, message); + Logger.MessagingServiceControllerUnexpectedErrorGettingNotificationCount(ex); + return this.Request.CreateResponse(HttpStatusCode.InternalServerError, "An unexpected error occurred while attempting to get the notification count, consult the server logs for more information."); } } @@ -420,9 +407,8 @@ public HttpResponseMessage CountUnreadMessages() } catch (Exception ex) { - var message = "An unexpected error occurred while attempting to , consult the server logs for more information."; - Logger.Error(message, ex); - return this.Request.CreateResponse(HttpStatusCode.InternalServerError, message); + Logger.MessagingServiceControllerUnexpectedErrorGettingUnreadCount(ex); + return this.Request.CreateResponse(HttpStatusCode.InternalServerError, "An unexpected error occurred while attempting to , consult the server logs for more information."); } } @@ -444,9 +430,8 @@ public HttpResponseMessage GetTotals() } catch (Exception ex) { - var message = "An unexpected error occurred while attempting to get the unread messages and new notifications count, consult the server logs for more information."; - Logger.Error(message, ex); - return this.Request.CreateResponse(HttpStatusCode.InternalServerError, message); + Logger.MessagingServiceControllerUnexpectedErrorGettingUnreadAndNotificationCounts(ex); + return this.Request.CreateResponse(HttpStatusCode.InternalServerError, "An unexpected error occurred while attempting to get the unread messages and new notifications count, consult the server logs for more information."); } } @@ -463,9 +448,8 @@ public HttpResponseMessage DismissAllNotifications() } catch (Exception ex) { - var message = "An unexpected error occurred while attempting to dismiss notifications, consult the server logs for more information."; - Logger.Error(message, ex); - return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, message); + Logger.MessagingServiceControllerUnexpectedErrorDismissingNotifications(ex); + return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "An unexpected error occurred while attempting to dismiss notifications, consult the server logs for more information."); } } diff --git a/DNN Platform/Modules/DnnExportImport/Components/Controllers/BaseController.cs b/DNN Platform/Modules/DnnExportImport/Components/Controllers/BaseController.cs index cefd180e46f..c0b1afd6b71 100644 --- a/DNN Platform/Modules/DnnExportImport/Components/Controllers/BaseController.cs +++ b/DNN Platform/Modules/DnnExportImport/Components/Controllers/BaseController.cs @@ -353,8 +353,7 @@ private static void DeleteJobData(ExportImportJob job) } catch (Exception ex) { - Logger.Error( - $"Failed to delete the job data. Error:{ex.Message}. It will need to be deleted manually. Folder Path:{jobFolder}"); + Logger.BaseControllerFailedToDeleteJobData(ex, ex.Message, jobFolder); } } } diff --git a/DNN Platform/Modules/DnnExportImport/Components/Engines/ExportImportEngine.cs b/DNN Platform/Modules/DnnExportImport/Components/Engines/ExportImportEngine.cs index 545ef448728..f70d8ea82d4 100644 --- a/DNN Platform/Modules/DnnExportImport/Components/Engines/ExportImportEngine.cs +++ b/DNN Platform/Modules/DnnExportImport/Components/Engines/ExportImportEngine.cs @@ -725,11 +725,7 @@ private static void CleanupDatabaseIfDirty(ExportImportRepository repository) } catch (Exception e) { - Logger.ErrorFormat( - CultureInfo.InvariantCulture, - "Unable to clear {0} while calling CleanupDatabaseIfDirty. Error: {1}", - type.Name, - e.Message); + Logger.ExportImportEngineUnableToClear(e, type.Name); } } } diff --git a/DNN Platform/Modules/DnnExportImport/Components/Scheduler/ExportImportScheduler.cs b/DNN Platform/Modules/DnnExportImport/Components/Scheduler/ExportImportScheduler.cs index 62e1cfeb57a..a875352457d 100644 --- a/DNN Platform/Modules/DnnExportImport/Components/Scheduler/ExportImportScheduler.cs +++ b/DNN Platform/Modules/DnnExportImport/Components/Scheduler/ExportImportScheduler.cs @@ -126,7 +126,7 @@ public override void DoWork() SchedulingController.PurgeScheduleHistory(); - Logger.Error("The Scheduler item stopped because main thread stopped, set schedule into emergency mode so it will start after app restart."); + Logger.ExportImportSchedulerItemStoppedBecauseMainThreadStoppedSetScheduledIntoEmergencyModeSoItWillStartAfterAppRestart(); succeeded = false; } catch (Exception ex) @@ -183,7 +183,7 @@ public override void DoWork() this.ScheduleHistoryItem.AddLogNote(sb.ToString()); this.engine.AddLogsToDatabase(job.JobId, result.CompleteLog); - Logger.Trace("Site Export/Import: Job Finished"); + Logger.ExportImportSchedulerJobFinished(); } ////SetLastSuccessfulIndexingDateTime(ScheduleHistoryItem.ScheduleID, ScheduleHistoryItem.StartDate); diff --git a/DNN Platform/Modules/DnnExportImport/Components/Services/PackagesExportService.cs b/DNN Platform/Modules/DnnExportImport/Components/Services/PackagesExportService.cs index d4538630b7c..e75679c1e74 100644 --- a/DNN Platform/Modules/DnnExportImport/Components/Services/PackagesExportService.cs +++ b/DNN Platform/Modules/DnnExportImport/Components/Services/PackagesExportService.cs @@ -192,7 +192,7 @@ public void InstallPackage(string filePath) catch (Exception ex) { this.Result.AddLogEntry("Import Package error", $"{filePath}. ERROR: {ex.Message}"); - Logger.Error(ex); + Logger.PackagesExportServiceInstallPackageException(ex); } } @@ -291,7 +291,7 @@ private void ProcessImportModulePackage(ExportPackage exportPackage, string temp this.Result.AddLogEntry( "Import Package error", $"{exportPackage.PackageName} : {exportPackage.Version} - {ex.Message}"); - Logger.Error(ex); + Logger.PackagesExportServiceProcessImportModulePackageException(ex); } } diff --git a/DNN Platform/Modules/DnnExportImport/Components/Services/PagesExportService.cs b/DNN Platform/Modules/DnnExportImport/Components/Services/PagesExportService.cs index ad70f10d261..74942001608 100644 --- a/DNN Platform/Modules/DnnExportImport/Components/Services/PagesExportService.cs +++ b/DNN Platform/Modules/DnnExportImport/Components/Services/PagesExportService.cs @@ -1138,7 +1138,7 @@ private int ImportTabModulesAndRelatedItems(TabInfo localTab, ExportTab otherTab catch (Exception ex) { this.Result.AddLogEntry("EXCEPTION importing tab module, Module ID=" + local.ModuleID, ex.Message, ReportLevel.Error); - Logger.Error(ex); + Logger.PagesExportServiceImportNewTabModuleException(ex); } } else @@ -1308,7 +1308,7 @@ private int ImportTabModulesAndRelatedItems(TabInfo localTab, ExportTab otherTab catch (Exception ex) { this.Result.AddLogEntry("EXCEPTION importing tab module, Module ID=" + local.ModuleID, ex.Message, ReportLevel.Error); - Logger.Error(ex); + Logger.PagesExportServiceImportExistingTabModuleException(ex); } } } @@ -1327,7 +1327,7 @@ private int ImportTabModulesAndRelatedItems(TabInfo localTab, ExportTab otherTab } catch (Exception ex) { - Logger.Error(new ImportException($"Delete TabModule Failed: {moduleId}", ex)); + Logger.PagesExportServiceDeleteTabModuleException(new ImportException($"Delete TabModule Failed: {moduleId}", ex)); } this.Result.AddLogEntry("Removed existing tab module", "Module ID=" + moduleId); @@ -1552,17 +1552,8 @@ private int ImportPortableContent(int tabId, ModuleInfo localModule, ExportModul } catch (Exception ex) { - this.Result.AddLogEntry( - "Error importing module data, Module ID=" + localModule.ModuleID, - ex.Message, - ReportLevel.Error); - Logger.ErrorFormat( - CultureInfo.InvariantCulture, - "ModuleContent: (Module ID={0}). Error: {1}{2}{3}", - localModule.ModuleID, - ex, - Environment.NewLine, - moduleContent.XmlContent); + this.Result.AddLogEntry($"Error importing module data, Module ID={localModule.ModuleID}", ex.Message, ReportLevel.Error); + Logger.PagesExportServiceModuleContentError(ex, localModule.ModuleID, moduleContent.XmlContent); } } } @@ -1570,14 +1561,14 @@ private int ImportPortableContent(int tabId, ModuleInfo localModule, ExportModul if (restoreCount > 0) { - this.Result.AddLogEntry("Added/Updated module content inside Tab ID=" + tabId, "Module ID=" + localModule.ModuleID); + this.Result.AddLogEntry($"Added/Updated module content inside Tab ID={tabId}", $"Module ID={localModule.ModuleID}"); return restoreCount; } } catch (Exception ex) { this.Result.AddLogEntry("Error creating business class type", desktopModuleInfo.BusinessControllerClass, ReportLevel.Error); - Logger.Error("Error creating business class type. " + ex); + Logger.PagesExportServiceErrorCreatingBusinessClassType(ex); } return 0; @@ -1964,7 +1955,7 @@ private int ExportModulePackage(ExportModule exportModule) } catch (Exception ex) { - Logger.Error(ex); + Logger.PagesExportServiceExportModulePackageException(ex); return 0; } } @@ -2052,7 +2043,7 @@ private int ExportPortableContent(ExportTab exportPage, ExportModule exportModul catch (Exception ex) { this.Result.AddLogEntry("Error creating business class type", desktopModuleInfo.BusinessControllerClass, ReportLevel.Error); - Logger.Error("Error creating business class type. " + ex); + Logger.PagesExportServiceErrorCreatingBusinessClassType(ex); } return 0; diff --git a/DNN Platform/Modules/DnnExportImport/Components/Services/ThemesExportService.cs b/DNN Platform/Modules/DnnExportImport/Components/Services/ThemesExportService.cs index 4208442c512..ec6d5e40d38 100644 --- a/DNN Platform/Modules/DnnExportImport/Components/Services/ThemesExportService.cs +++ b/DNN Platform/Modules/DnnExportImport/Components/Services/ThemesExportService.cs @@ -213,7 +213,7 @@ public override void ImportData(ExportImportJob importJob, ImportDto importDto) catch (Exception ex) { this.Result.AddLogEntry("Import Theme error", file); - Logger.Error(ex); + Logger.ThemesExportServiceImportThemeFileException(ex); } } diff --git a/DNN Platform/Modules/DnnExportImport/LoggerMessages.cs b/DNN Platform/Modules/DnnExportImport/LoggerMessages.cs new file mode 100644 index 00000000000..3c4b8072efc --- /dev/null +++ b/DNN Platform/Modules/DnnExportImport/LoggerMessages.cs @@ -0,0 +1,55 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.ExportImport; + +using System; + +using Dnn.ExportImport.Components.Common; + +using Microsoft.Extensions.Logging; + +/// Extension methods for for pre-defined logging messages. +/// The DnnExportImport project has been assigned event IDs from 4,000,000 to 4,999,999. +internal static partial class LoggerMessages +{ + [LoggerMessage(EventId = 4_000_000, Level = LogLevel.Trace, Message = "Site Export/Import: Job Finished")] + public static partial void ExportImportSchedulerJobFinished(this ILogger logger); + + [LoggerMessage(EventId = 4_000_001, Level = LogLevel.Error, Message = "The Scheduler item stopped because main thread stopped, set schedule into emergency mode so it will start after app restart.")] + public static partial void ExportImportSchedulerItemStoppedBecauseMainThreadStoppedSetScheduledIntoEmergencyModeSoItWillStartAfterAppRestart(this ILogger logger); + + [LoggerMessage(EventId = 4_000_100, Level = LogLevel.Error, Message = "Unable to clear {TypeName} while calling CleanupDatabaseIfDirty.")] + public static partial void ExportImportEngineUnableToClear(this ILogger logger, Exception exception, string typeName); + + [LoggerMessage(EventId = 4_000_200, Level = LogLevel.Error, Message = "ModuleContent: (Module ID={ModuleId}). {XmlContent}")] + public static partial void PagesExportServiceModuleContentError(this ILogger logger, Exception exception, int moduleId, string xmlContent); + + [LoggerMessage(EventId = 4_000_201, Level = LogLevel.Error)] + public static partial void PagesExportServiceImportNewTabModuleException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 4_000_201, Level = LogLevel.Error)] + public static partial void PagesExportServiceImportExistingTabModuleException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 4_000_202, Level = LogLevel.Error)] + public static partial void PagesExportServiceDeleteTabModuleException(this ILogger logger, ImportException exception); + + [LoggerMessage(EventId = 4_000_203, Level = LogLevel.Error)] + public static partial void PagesExportServiceExportModulePackageException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 4_000_204, Level = LogLevel.Error, Message = "Error creating business class type.")] + public static partial void PagesExportServiceErrorCreatingBusinessClassType(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 4_000_300, Level = LogLevel.Error)] + public static partial void PackagesExportServiceInstallPackageException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 4_000_301, Level = LogLevel.Error)] + public static partial void PackagesExportServiceProcessImportModulePackageException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 4_000_400, Level = LogLevel.Error)] + public static partial void ThemesExportServiceImportThemeFileException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 4_000_500, Level = LogLevel.Error, Message = "Failed to delete the job data. Error:{Message}. It will need to be deleted manually. Folder Path:{FolderPath}")] + public static partial void BaseControllerFailedToDeleteJobData(this ILogger logger, Exception exception, string message, string folderPath); +} diff --git a/DNN Platform/Modules/Groups/DotNetNuke.Modules.Groups.csproj b/DNN Platform/Modules/Groups/DotNetNuke.Modules.Groups.csproj index 2b44d392b05..5112528b56b 100644 --- a/DNN Platform/Modules/Groups/DotNetNuke.Modules.Groups.csproj +++ b/DNN Platform/Modules/Groups/DotNetNuke.Modules.Groups.csproj @@ -118,6 +118,7 @@ GroupEdit.ascx + GroupView.ascx diff --git a/DNN Platform/Modules/Groups/LoggerMessages.cs b/DNN Platform/Modules/Groups/LoggerMessages.cs new file mode 100644 index 00000000000..8acdb20add3 --- /dev/null +++ b/DNN Platform/Modules/Groups/LoggerMessages.cs @@ -0,0 +1,33 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace DotNetNuke.Modules.Groups +{ + using System; + + using Microsoft.Extensions.Logging; + + /// Extension methods for for pre-defined logging messages. + /// The DotNetNuke.Modules.Groups project has been assigned event IDs from 3,100,000 to 3,199,999. + internal static partial class LoggerMessages + { + [LoggerMessage(EventId = 3_100_000, Level = LogLevel.Error)] + public static partial void ModerationServiceControllerApproveGroupException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_100_001, Level = LogLevel.Error)] + public static partial void ModerationServiceControllerRejectGroupException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_100_002, Level = LogLevel.Error)] + public static partial void ModerationServiceControllerJoinGroupException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_100_003, Level = LogLevel.Error)] + public static partial void ModerationServiceControllerLeaveGroupException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_100_004, Level = LogLevel.Error)] + public static partial void ModerationServiceControllerApproveMemberException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_100_005, Level = LogLevel.Error)] + public static partial void ModerationServiceControllerRejectMemberException(this ILogger logger, Exception exception); + } +} diff --git a/DNN Platform/Modules/Groups/ModerationServiceController.cs b/DNN Platform/Modules/Groups/ModerationServiceController.cs index 742bdc1989c..bddb74e6ea0 100644 --- a/DNN Platform/Modules/Groups/ModerationServiceController.cs +++ b/DNN Platform/Modules/Groups/ModerationServiceController.cs @@ -124,7 +124,7 @@ public HttpResponseMessage ApproveGroup(NotificationDTO postData) } catch (Exception exc) { - Logger.Error(exc); + Logger.ModerationServiceControllerApproveGroupException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -165,7 +165,7 @@ public HttpResponseMessage RejectGroup(NotificationDTO postData) } catch (Exception exc) { - Logger.Error(exc); + Logger.ModerationServiceControllerRejectGroupException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -211,7 +211,7 @@ public HttpResponseMessage JoinGroup(RoleDTO postData) } catch (Exception exc) { - Logger.Error(exc); + Logger.ModerationServiceControllerJoinGroupException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } @@ -245,7 +245,7 @@ public HttpResponseMessage LeaveGroup(RoleDTO postData) } catch (Exception exc) { - Logger.Error(exc); + Logger.ModerationServiceControllerLeaveGroupException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } @@ -299,7 +299,7 @@ public HttpResponseMessage ApproveMember(NotificationDTO postData) } catch (Exception exc) { - Logger.Error(exc); + Logger.ModerationServiceControllerApproveMemberException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } @@ -345,7 +345,7 @@ public HttpResponseMessage RejectMember(NotificationDTO postData) } catch (Exception exc) { - Logger.Error(exc); + Logger.ModerationServiceControllerRejectMemberException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } diff --git a/DNN Platform/Modules/Journal/DotNetNuke.Modules.Journal.csproj b/DNN Platform/Modules/Journal/DotNetNuke.Modules.Journal.csproj index d31c100aeea..821a60fe2b9 100644 --- a/DNN Platform/Modules/Journal/DotNetNuke.Modules.Journal.csproj +++ b/DNN Platform/Modules/Journal/DotNetNuke.Modules.Journal.csproj @@ -117,6 +117,7 @@ + diff --git a/DNN Platform/Modules/Journal/FileUploadController.cs b/DNN Platform/Modules/Journal/FileUploadController.cs index c5d72ea5bd7..3f02fe240be 100644 --- a/DNN Platform/Modules/Journal/FileUploadController.cs +++ b/DNN Platform/Modules/Journal/FileUploadController.cs @@ -41,7 +41,7 @@ public HttpResponseMessage UploadFile() } catch (Exception exc) { - Logger.Error(exc); + Logger.FileUploadControllerUploadFileException(exc); } return IframeSafeJson(statuses); diff --git a/DNN Platform/Modules/Journal/LoggerMessages.cs b/DNN Platform/Modules/Journal/LoggerMessages.cs new file mode 100644 index 00000000000..10e0ad007e4 --- /dev/null +++ b/DNN Platform/Modules/Journal/LoggerMessages.cs @@ -0,0 +1,48 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace DotNetNuke.Modules.Journal +{ + using System; + + using Microsoft.Extensions.Logging; + + /// Extension methods for for pre-defined logging messages. + /// The DotNetNuke.Modules.Journal project has been assigned event IDs from 3,200,000 to 3,299,999. + internal static partial class LoggerMessages + { + [LoggerMessage(EventId = 3_200_000, Level = LogLevel.Error)] + public static partial void ServicesControllerCreateException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_200_001, Level = LogLevel.Error)] + public static partial void ServicesControllerDeleteException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_200_002, Level = LogLevel.Error)] + public static partial void ServicesControllerSoftDeleteException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_200_003, Level = LogLevel.Error)] + public static partial void ServicesControllerPreviewUrlException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_200_004, Level = LogLevel.Error)] + public static partial void ServicesControllerGetListForProfileException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_200_005, Level = LogLevel.Error)] + public static partial void ServicesControllerLikeException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_200_006, Level = LogLevel.Error)] + public static partial void ServicesControllerCommentSaveException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_200_007, Level = LogLevel.Error)] + public static partial void ServicesControllerCommentDeleteException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_200_008, Level = LogLevel.Error)] + public static partial void ServicesControllerGetSuggestionsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_200_100, Level = LogLevel.Error)] + public static partial void FileUploadControllerUploadFileException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_200_200, Level = LogLevel.Error)] + public static partial void NotificationServicesControllerViewJournalException(this ILogger logger, Exception exception); + } +} diff --git a/DNN Platform/Modules/Journal/NotificationServicesController.cs b/DNN Platform/Modules/Journal/NotificationServicesController.cs index aeb7d016309..c178302c1fc 100644 --- a/DNN Platform/Modules/Journal/NotificationServicesController.cs +++ b/DNN Platform/Modules/Journal/NotificationServicesController.cs @@ -11,7 +11,6 @@ namespace DotNetNuke.Modules.Journal using DotNetNuke.Common; using DotNetNuke.Common.Utilities; - using DotNetNuke.Entities.Users; using DotNetNuke.Instrumentation; using DotNetNuke.Security; using DotNetNuke.Services.Journal; @@ -34,7 +33,7 @@ public HttpResponseMessage ViewJournal(NotificationDTO postData) { var notification = NotificationsController.Instance.GetNotification(postData.NotificationId); - if (notification != null && notification.Context != null && notification.Context.Contains("_")) + if (notification is { Context: not null, } && notification.Context.Contains("_")) { // Dismiss the notification NotificationsController.Instance.DeleteNotificationRecipient(postData.NotificationId, this.UserInfo.UserID); @@ -43,17 +42,17 @@ public HttpResponseMessage ViewJournal(NotificationDTO postData) var userId = Convert.ToInt32(context[0]); var journalId = Convert.ToInt32(context[1]); var ji = JournalController.Instance.GetJournalItem(this.PortalSettings.PortalId, userId, journalId); - if (ji.ProfileId != Null.NullInteger) - { - return this.Request.CreateResponse(HttpStatusCode.OK, new { Result = "success", Link = Globals.UserProfileURL(ji.ProfileId) }); - } - - return this.Request.CreateResponse(HttpStatusCode.OK, new { Result = "success", Link = Globals.UserProfileURL(userId) }); + var profileLink = ji.ProfileId != Null.NullInteger + ? Globals.UserProfileURL(ji.ProfileId) + : Globals.UserProfileURL(userId); + return this.Request.CreateResponse( + HttpStatusCode.OK, + new { Result = "success", Link = profileLink, }); } } catch (Exception exc) { - Logger.Error(exc); + Logger.NotificationServicesControllerViewJournalException(exc); } return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "unable to process notification"); diff --git a/DNN Platform/Modules/Journal/ServicesController.cs b/DNN Platform/Modules/Journal/ServicesController.cs index 66c143a59a9..d1ee7849046 100644 --- a/DNN Platform/Modules/Journal/ServicesController.cs +++ b/DNN Platform/Modules/Journal/ServicesController.cs @@ -83,7 +83,7 @@ public HttpResponseMessage Create(CreateDTO postData) } catch (Exception exc) { - Logger.Error(exc); + Logger.ServicesControllerCreateException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -113,7 +113,7 @@ public HttpResponseMessage Delete(JournalIdDTO postData) } catch (Exception exc) { - Logger.Error(exc); + Logger.ServicesControllerDeleteException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -143,7 +143,7 @@ public HttpResponseMessage SoftDelete(JournalIdDTO postData) } catch (Exception exc) { - Logger.Error(exc); + Logger.ServicesControllerSoftDeleteException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -160,7 +160,7 @@ public HttpResponseMessage PreviewUrl(PreviewDTO postData) } catch (Exception exc) { - Logger.Error(exc); + Logger.ServicesControllerPreviewUrlException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -176,7 +176,7 @@ public HttpResponseMessage GetListForProfile(GetListForProfileDTO postData) } catch (Exception exc) { - Logger.Error(exc); + Logger.ServicesControllerGetListForProfileException(exc); throw new HttpException(500, exc.Message); } } @@ -198,7 +198,7 @@ public HttpResponseMessage Like(JournalIdDTO postData) } catch (Exception exc) { - Logger.Error(exc); + Logger.ServicesControllerLikeException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -229,7 +229,7 @@ public HttpResponseMessage CommentSave(CommentSaveDTO postData) } catch (Exception exc) { - Logger.Error(exc); + Logger.ServicesControllerCommentSaveException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -264,7 +264,7 @@ public HttpResponseMessage CommentDelete(CommentDeleteDTO postData) } catch (Exception exc) { - Logger.Error(exc); + Logger.ServicesControllerCommentDeleteException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -303,7 +303,7 @@ public HttpResponseMessage GetSuggestions(string keyword) } catch (Exception exc) { - Logger.Error(exc); + Logger.ServicesControllerGetSuggestionsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } diff --git a/DNN Platform/Modules/MemberDirectory/DotNetNuke.Modules.MemberDirectory.csproj b/DNN Platform/Modules/MemberDirectory/DotNetNuke.Modules.MemberDirectory.csproj index d984cde841b..2b38ddc383c 100644 --- a/DNN Platform/Modules/MemberDirectory/DotNetNuke.Modules.MemberDirectory.csproj +++ b/DNN Platform/Modules/MemberDirectory/DotNetNuke.Modules.MemberDirectory.csproj @@ -77,6 +77,7 @@ + diff --git a/DNN Platform/Modules/MemberDirectory/LoggerMessages.cs b/DNN Platform/Modules/MemberDirectory/LoggerMessages.cs new file mode 100644 index 00000000000..945f98ad5bf --- /dev/null +++ b/DNN Platform/Modules/MemberDirectory/LoggerMessages.cs @@ -0,0 +1,42 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace DotNetNuke.Modules.MemberDirectory +{ + using System; + + using Microsoft.Extensions.Logging; + + /// Extension methods for for pre-defined logging messages. + /// The DotNetNuke.Modules.MemberDirectory project has been assigned event IDs from 3,300,000 to 3,399,999. + internal static partial class LoggerMessages + { + [LoggerMessage(EventId = 3_300_000, Level = LogLevel.Error)] + public static partial void MemberDirectoryControllerAdvancedSearchException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_300_001, Level = LogLevel.Error)] + public static partial void MemberDirectoryControllerBasicSearchException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_300_002, Level = LogLevel.Error)] + public static partial void MemberDirectoryControllerGetMemberException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_300_003, Level = LogLevel.Error)] + public static partial void MemberDirectoryControllerGetSuggestionsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_300_004, Level = LogLevel.Error)] + public static partial void MemberDirectoryControllerAcceptFriendException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_300_005, Level = LogLevel.Error)] + public static partial void MemberDirectoryControllerAddFriendException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_300_006, Level = LogLevel.Error)] + public static partial void MemberDirectoryControllerFollowException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_300_007, Level = LogLevel.Error)] + public static partial void MemberDirectoryControllerRemoveFriendException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 3_300_008, Level = LogLevel.Error)] + public static partial void MemberDirectoryControllerUnfollowException(this ILogger logger, Exception exception); + } +} diff --git a/DNN Platform/Modules/MemberDirectory/Services/MemberDirectoryController.cs b/DNN Platform/Modules/MemberDirectory/Services/MemberDirectoryController.cs index ddacf3ec690..7ae56a4491f 100644 --- a/DNN Platform/Modules/MemberDirectory/Services/MemberDirectoryController.cs +++ b/DNN Platform/Modules/MemberDirectory/Services/MemberDirectoryController.cs @@ -72,7 +72,7 @@ public HttpResponseMessage AdvancedSearch(int userId, int groupId, int pageIndex } catch (Exception exc) { - Logger.Error(exc); + Logger.MemberDirectoryControllerAdvancedSearchException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -87,7 +87,7 @@ public HttpResponseMessage BasicSearch(int groupId, string searchTerm, int pageI } catch (Exception exc) { - Logger.Error(exc); + Logger.MemberDirectoryControllerBasicSearchException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -105,7 +105,7 @@ public HttpResponseMessage GetMember(int userId) } catch (Exception exc) { - Logger.Error(exc); + Logger.MemberDirectoryControllerGetMemberException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -123,7 +123,7 @@ public HttpResponseMessage GetSuggestions(int groupId, string displayName) } catch (Exception exc) { - Logger.Error(exc); + Logger.MemberDirectoryControllerGetSuggestionsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -140,7 +140,7 @@ public HttpResponseMessage AcceptFriend(FriendDTO postData) } catch (Exception exc) { - Logger.Error(exc); + Logger.MemberDirectoryControllerAcceptFriendException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -157,7 +157,7 @@ public HttpResponseMessage AddFriend(FriendDTO postData) } catch (Exception exc) { - Logger.Error(exc); + Logger.MemberDirectoryControllerAddFriendException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -174,7 +174,7 @@ public HttpResponseMessage Follow(FollowDTO postData) } catch (Exception exc) { - Logger.Error(exc); + Logger.MemberDirectoryControllerFollowException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -191,7 +191,7 @@ public HttpResponseMessage RemoveFriend(FriendDTO postData) } catch (Exception exc) { - Logger.Error(exc); + Logger.MemberDirectoryControllerRemoveFriendException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -208,7 +208,7 @@ public HttpResponseMessage UnFollow(FollowDTO postData) } catch (Exception exc) { - Logger.Error(exc); + Logger.MemberDirectoryControllerUnfollowException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } diff --git a/DNN Platform/Modules/RazorHost/CreateModule.ascx.cs b/DNN Platform/Modules/RazorHost/CreateModule.ascx.cs index 06e56ad624c..4a929a4d6e7 100644 --- a/DNN Platform/Modules/RazorHost/CreateModule.ascx.cs +++ b/DNN Platform/Modules/RazorHost/CreateModule.ascx.cs @@ -177,13 +177,13 @@ private void Create() } catch (Exception ex) { - Logger.Error(ex); + Logger.CreateModuleDeleteFileException(ex); } // Optionally goto new Page if (this.chkAddPage.Checked) { - string tabName = "Test " + this.txtName.Text + " Page"; + string tabName = $"Test {this.txtName.Text} Page"; string tabPath = Globals.GenerateTabPath(Null.NullInteger, tabName); int tabID = TabController.GetTabByTabPath(this.ModuleContext.PortalId, tabPath, this.ModuleContext.PortalSettings.CultureCode); diff --git a/DNN Platform/Modules/RazorHost/DotNetNuke.Modules.RazorHost.csproj b/DNN Platform/Modules/RazorHost/DotNetNuke.Modules.RazorHost.csproj index 280526d010f..6e94d3a1019 100644 --- a/DNN Platform/Modules/RazorHost/DotNetNuke.Modules.RazorHost.csproj +++ b/DNN Platform/Modules/RazorHost/DotNetNuke.Modules.RazorHost.csproj @@ -125,6 +125,7 @@ EditScript.ascx ASPXCodeBehind + RazorHost.ascx diff --git a/DNN Platform/Modules/RazorHost/LoggerMessages.cs b/DNN Platform/Modules/RazorHost/LoggerMessages.cs new file mode 100644 index 00000000000..ad76c3578f4 --- /dev/null +++ b/DNN Platform/Modules/RazorHost/LoggerMessages.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace DotNetNuke.Modules.RazorHost +{ + using System; + + using Microsoft.Extensions.Logging; + + /// Extension methods for for pre-defined logging messages. + /// The DotNetNuke.Modules.RazorHost project has been assigned event IDs from 3,400,000 to 3,499,999. + internal static partial class LoggerMessages + { + [LoggerMessage(EventId = 3_400_000, Level = LogLevel.Error)] + public static partial void CreateModuleDeleteFileException(this ILogger logger, Exception exception); + } +} diff --git a/DNN Platform/Modules/ResourceManager/Components/ResourceManagerController.cs b/DNN Platform/Modules/ResourceManager/Components/ResourceManagerController.cs index 67ca53e636e..a55f7dafd60 100644 --- a/DNN Platform/Modules/ResourceManager/Components/ResourceManagerController.cs +++ b/DNN Platform/Modules/ResourceManager/Components/ResourceManagerController.cs @@ -14,7 +14,7 @@ namespace Dnn.Modules.ResourceManager.Components using Microsoft.Extensions.Logging; /// Provides upgrade support for module. - public class ResourceManagerController : IUpgradeable + public partial class ResourceManagerController : IUpgradeable { private static readonly ILogger Logger = DnnLoggingController.GetLogger(); @@ -26,7 +26,7 @@ public string UpgradeModule(string version) switch (version) { case "00.00.01": - Logger.Info("Adding Global Assets host menu item."); + Logger.ResourceManagerControllerAddingGlobalAssetsHostMenuItem(); ModuleDefinitionInfo mDef = ModuleDefinitionController.GetModuleDefinitionByFriendlyName("ResourceManager"); // Add tab to Admin Menu @@ -43,11 +43,11 @@ public string UpgradeModule(string version) var moduleId = Upgrade.AddModuleToPage(hostPage, mDef.ModuleDefID, "Global Assets Management", "~/Icons/Sigma/Files_32X32_Standard.png", true); ModuleController.Instance.UpdateModuleSetting(moduleId, Constants.HomeFolderSettingName, "1"); ModuleController.Instance.UpdateModuleSetting(moduleId, Constants.ModeSettingName, "0"); - Logger.Info("Added Global Assets host menu item."); + Logger.ResourceManagerControllerAddedGlobalAssetsHostMenuItem(); } // Remove Previous Host File Manager pages - Logger.Info("Removing old pages."); + Logger.ResourceManagerControllerRemovingOldPages(); Upgrade.RemoveHostPage("File Manager"); Upgrade.RemoveHostPage("File Management"); @@ -58,7 +58,7 @@ public string UpgradeModule(string version) } catch (Exception exc) { - Logger.Error(exc); + Logger.ResourceManagerControllerUpgradeModuleException(exc); return "Failed"; } } diff --git a/DNN Platform/Modules/ResourceManager/Dnn.Modules.ResourceManager.csproj b/DNN Platform/Modules/ResourceManager/Dnn.Modules.ResourceManager.csproj index 25281c9fd08..1ca58f50603 100644 --- a/DNN Platform/Modules/ResourceManager/Dnn.Modules.ResourceManager.csproj +++ b/DNN Platform/Modules/ResourceManager/Dnn.Modules.ResourceManager.csproj @@ -106,6 +106,7 @@ + diff --git a/DNN Platform/Modules/ResourceManager/LoggerMessages.cs b/DNN Platform/Modules/ResourceManager/LoggerMessages.cs new file mode 100644 index 00000000000..b075e7d92f6 --- /dev/null +++ b/DNN Platform/Modules/ResourceManager/LoggerMessages.cs @@ -0,0 +1,27 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.Modules.ResourceManager +{ + using System; + + using Microsoft.Extensions.Logging; + + /// Extension methods for for pre-defined logging messages. + /// The Dnn.Modules.ResourceManager project has been assigned event IDs from 3,600,000 to 3,699,999. + internal static partial class LoggerMessages + { + [LoggerMessage(EventId = 3_600_000, Level = LogLevel.Information, Message = "Adding Global Assets host menu item.")] + public static partial void ResourceManagerControllerAddingGlobalAssetsHostMenuItem(this ILogger logger); + + [LoggerMessage(EventId = 3_600_001, Level = LogLevel.Information, Message = "Added Global Assets host menu item.")] + public static partial void ResourceManagerControllerAddedGlobalAssetsHostMenuItem(this ILogger logger); + + [LoggerMessage(EventId = 3_600_002, Level = LogLevel.Information, Message = "Removing old pages.")] + public static partial void ResourceManagerControllerRemovingOldPages(this ILogger logger); + + [LoggerMessage(EventId = 3_600_003, Level = LogLevel.Error)] + public static partial void ResourceManagerControllerUpgradeModuleException(this ILogger logger, Exception exception); + } +} diff --git a/DNN Platform/Providers/ClientCapabilityProviders/Provider.AspNetCCP/AspNetClientCapability.cs b/DNN Platform/Providers/ClientCapabilityProviders/Provider.AspNetCCP/AspNetClientCapability.cs index 0b5d9f905a8..b80d80ab86d 100644 --- a/DNN Platform/Providers/ClientCapabilityProviders/Provider.AspNetCCP/AspNetClientCapability.cs +++ b/DNN Platform/Providers/ClientCapabilityProviders/Provider.AspNetCCP/AspNetClientCapability.cs @@ -80,7 +80,7 @@ public AspNetClientCapability(string userAgent, HttpCapabilitiesBase browserCaps } catch (Exception ex) { - Logger.Error(ex); + Logger.AspNetClientCapabilityDetectOperatingSystemException(ex); } } } diff --git a/DNN Platform/Providers/ClientCapabilityProviders/Provider.AspNetCCP/LoggerMessages.cs b/DNN Platform/Providers/ClientCapabilityProviders/Provider.AspNetCCP/LoggerMessages.cs new file mode 100644 index 00000000000..d20f0bf949c --- /dev/null +++ b/DNN Platform/Providers/ClientCapabilityProviders/Provider.AspNetCCP/LoggerMessages.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace DotNetNuke.Providers.AspNetClientCapabilityProvider; + +using System; + +using Microsoft.Extensions.Logging; + +/// Extension methods for for pre-defined logging messages. +/// The DotNetNuke.Providers.AspNetCCP project has been assigned event IDs from 2,400,000 to 2,499,999. +internal static partial class LoggerMessages +{ + [LoggerMessage(EventId = 2_400_000, Level = LogLevel.Error)] + public static partial void AspNetClientCapabilityDetectOperatingSystemException(this ILogger logger, Exception exception); +} diff --git a/DNN Platform/Providers/FolderProviders/AzureFolderProvider/Settings.ascx.cs b/DNN Platform/Providers/FolderProviders/AzureFolderProvider/Settings.ascx.cs index d1d861f32e2..59b7da670ff 100644 --- a/DNN Platform/Providers/FolderProviders/AzureFolderProvider/Settings.ascx.cs +++ b/DNN Platform/Providers/FolderProviders/AzureFolderProvider/Settings.ascx.cs @@ -274,7 +274,7 @@ private bool CreateContainer(string containerName) } catch (Exception ex) { - Logger.Error(ex); + Logger.SettingsStorageCredentialsException(ex); this.valContainerName.ErrorMessage = Localization.GetString("AuthenticationFailure.ErrorMessage", this.LocalResourceFile); this.valContainerName.IsValid = false; @@ -320,7 +320,7 @@ private bool CreateContainer(string containerName) case "ContainerAlreadyExists": return true; default: - Logger.Error(ex); + Logger.SettingsCreateContainerStorageException(ex); this.valContainerName.ErrorMessage = Localization.GetString( "NewContainer.ErrorMessage", this.LocalResourceFile); @@ -334,7 +334,7 @@ private bool CreateContainer(string containerName) } catch (Exception ex) { - Logger.Error(ex); + Logger.SettingsCreateContainerGeneralException(ex); this.valContainerName.ErrorMessage = Localization.GetString("NewContainer.ErrorMessage", this.LocalResourceFile); } @@ -361,7 +361,7 @@ private void LoadContainers() } catch (Exception ex) { - Logger.Error(ex); + Logger.SettingsStorageCredentialsException(ex); this.valContainerName.ErrorMessage = Localization.GetString("AuthenticationFailure.ErrorMessage", this.LocalResourceFile); this.valContainerName.IsValid = false; @@ -389,7 +389,7 @@ private void LoadContainers() this.valContainerName.ErrorMessage = Localization.GetString("AuthenticationFailure.ErrorMessage", this.LocalResourceFile); break; default: - Logger.Error(ex); + Logger.SettingsLoadContainersStorageException(ex); this.valContainerName.ErrorMessage = Localization.GetString("ListContainers.ErrorMessage", this.LocalResourceFile); break; } @@ -403,7 +403,7 @@ private void LoadContainers() } catch (Exception ex) { - Logger.Error(ex); + Logger.SettingsLoadContainersGeneralException(ex); this.valContainerName.ErrorMessage = Localization.GetString("ListContainers.ErrorMessage", this.LocalResourceFile); this.valContainerName.IsValid = false; } diff --git a/DNN Platform/Providers/FolderProviders/DotNetNuke.Providers.FolderProviders.csproj b/DNN Platform/Providers/FolderProviders/DotNetNuke.Providers.FolderProviders.csproj index 1f06d9cc12f..1e4aa50fecb 100644 --- a/DNN Platform/Providers/FolderProviders/DotNetNuke.Providers.FolderProviders.csproj +++ b/DNN Platform/Providers/FolderProviders/DotNetNuke.Providers.FolderProviders.csproj @@ -97,6 +97,7 @@ + diff --git a/DNN Platform/Providers/FolderProviders/LoggerMessages.cs b/DNN Platform/Providers/FolderProviders/LoggerMessages.cs new file mode 100644 index 00000000000..23aba64baf2 --- /dev/null +++ b/DNN Platform/Providers/FolderProviders/LoggerMessages.cs @@ -0,0 +1,33 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace DotNetNuke.Providers.FolderProviders +{ + using System; + + using Microsoft.Extensions.Logging; + using Microsoft.WindowsAzure.Storage; + + using LogLevel = Microsoft.Extensions.Logging.LogLevel; + + /// Extension methods for for pre-defined logging messages. + /// The DotNetNuke.Providers.FolderProviders project has been assigned event IDs from 2,500,000 to 2,999,999. + internal static partial class LoggerMessages + { + [LoggerMessage(EventId = 2_500_000, Level = LogLevel.Error)] + public static partial void SettingsStorageCredentialsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 2_500_001, Level = LogLevel.Error)] + public static partial void SettingsCreateContainerStorageException(this ILogger logger, StorageException exception); + + [LoggerMessage(EventId = 2_500_002, Level = LogLevel.Error)] + public static partial void SettingsCreateContainerGeneralException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 2_500_003, Level = LogLevel.Error)] + public static partial void SettingsLoadContainersStorageException(this ILogger logger, StorageException exception); + + [LoggerMessage(EventId = 2_500_004, Level = LogLevel.Error)] + public static partial void SettingsLoadContainersGeneralException(this ILogger logger, Exception exception); + } +} diff --git a/DNN Platform/Syndication/LoggerMessages.cs b/DNN Platform/Syndication/LoggerMessages.cs new file mode 100644 index 00000000000..5045d3c8a1e --- /dev/null +++ b/DNN Platform/Syndication/LoggerMessages.cs @@ -0,0 +1,32 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace DotNetNuke.Services.Syndication; + +using System; + +using Microsoft.Extensions.Logging; + +/// Extension methods for for pre-defined logging messages. +/// The DotNetNuke.Syndication project has been assigned event IDs from 2,300,000 to 2,399,999. +internal static partial class LoggerMessages +{ + [LoggerMessage(EventId = 2_300_000, Level = LogLevel.Error)] + public static partial void OpmlDownloadManagerDeleteException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 2_300_100, Level = LogLevel.Error)] + public static partial void RssDownloadManagerDeleteException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 2_300_200, Level = LogLevel.Error)] + public static partial void OpmlParseCreatedException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 2_300_201, Level = LogLevel.Error)] + public static partial void OpmlParseXmlUrlException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 2_300_201, Level = LogLevel.Error)] + public static partial void OpmlParseHtmlUrlException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 2_300_201, Level = LogLevel.Error)] + public static partial void OpmlParseUrlException(this ILogger logger, Exception exception); +} diff --git a/DNN Platform/Syndication/OPML/Opml.cs b/DNN Platform/Syndication/OPML/Opml.cs index a415a4c5b95..b3d88c49579 100644 --- a/DNN Platform/Syndication/OPML/Opml.cs +++ b/DNN Platform/Syndication/OPML/Opml.cs @@ -350,7 +350,7 @@ internal static OpmlOutline ParseXml(XmlElement node) } catch (Exception ex) { - Logger.Error(ex); + Logger.OpmlParseCreatedException(ex); } newOutline.Category = ParseElement(node, "category"); @@ -360,7 +360,7 @@ internal static OpmlOutline ParseXml(XmlElement node) } catch (Exception ex) { - Logger.Error(ex); + Logger.OpmlParseXmlUrlException(ex); } try @@ -369,7 +369,7 @@ internal static OpmlOutline ParseXml(XmlElement node) } catch (Exception ex) { - Logger.Error(ex); + Logger.OpmlParseHtmlUrlException(ex); } newOutline.Language = ParseElement(node, "language"); @@ -381,7 +381,7 @@ internal static OpmlOutline ParseXml(XmlElement node) } catch (Exception ex) { - Logger.Error(ex); + Logger.OpmlParseUrlException(ex); } newOutline.Description = ParseElement(node, "description"); diff --git a/DNN Platform/Syndication/OPML/OpmlDownloadManager.cs b/DNN Platform/Syndication/OPML/OpmlDownloadManager.cs index 3308115bdb7..a6289f11736 100644 --- a/DNN Platform/Syndication/OPML/OpmlDownloadManager.cs +++ b/DNN Platform/Syndication/OPML/OpmlDownloadManager.cs @@ -207,7 +207,7 @@ private Opml TryLoadFromDisk(Uri uri) } catch (Exception ex) { - Logger.Error(ex); + Logger.OpmlDownloadManagerDeleteException(ex); } // try next file diff --git a/DNN Platform/Syndication/RSS/RssDownloadManager.cs b/DNN Platform/Syndication/RSS/RssDownloadManager.cs index 590502c4a18..b6bd978a696 100644 --- a/DNN Platform/Syndication/RSS/RssDownloadManager.cs +++ b/DNN Platform/Syndication/RSS/RssDownloadManager.cs @@ -193,7 +193,7 @@ private RssChannelDom TryLoadFromDisk(string url) } catch (Exception ex) { - Logger.Error(ex); + Logger.RssDownloadManagerDeleteException(ex); } // try next file diff --git a/DNN Platform/Website/Default.aspx.cs b/DNN Platform/Website/Default.aspx.cs index 6f7350caf32..3c5a66d6e3f 100644 --- a/DNN Platform/Website/Default.aspx.cs +++ b/DNN Platform/Website/Default.aspx.cs @@ -44,6 +44,8 @@ namespace DotNetNuke.Framework using DotNetNuke.UI.Utilities; using DotNetNuke.Web.Client.ClientResourceManagement; using DotNetNuke.Web.Client.ResourceManager; + using DotNetNuke.Website; + using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -280,7 +282,7 @@ protected override void OnInit(EventArgs e) } catch (Exception ex) { - Logger.Error("CSP error", ex); + Logger.DefaultCspError(ex); } } } diff --git a/DNN Platform/Website/DesktopModules/Admin/Authentication/Login.ascx.cs b/DNN Platform/Website/DesktopModules/Admin/Authentication/Login.ascx.cs index b9c6aaff9fe..ee2706b2c8d 100644 --- a/DNN Platform/Website/DesktopModules/Admin/Authentication/Login.ascx.cs +++ b/DNN Platform/Website/DesktopModules/Admin/Authentication/Login.ascx.cs @@ -47,6 +47,8 @@ namespace DotNetNuke.Modules.Admin.Authentication using DotNetNuke.UI.Skins.Controls; using DotNetNuke.UI.UserControls; using DotNetNuke.UI.WebControls; + using DotNetNuke.Website; + using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -437,7 +439,7 @@ protected override void OnLoad(EventArgs e) catch (Exception ex) { // control not there - Logger.Error(ex); + Logger.AuthenticationLoginPageNoException(ex); } } diff --git a/DNN Platform/Website/DesktopModules/Admin/Security/EditUser.ascx.cs b/DNN Platform/Website/DesktopModules/Admin/Security/EditUser.ascx.cs index c275b0ed06e..995010a723e 100644 --- a/DNN Platform/Website/DesktopModules/Admin/Security/EditUser.ascx.cs +++ b/DNN Platform/Website/DesktopModules/Admin/Security/EditUser.ascx.cs @@ -32,6 +32,8 @@ namespace DotNetNuke.Modules.Admin.Users using DotNetNuke.Services.Localization; using DotNetNuke.Services.Mail; using DotNetNuke.UI.Skins.Controls; + using DotNetNuke.Website; + using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -378,7 +380,7 @@ protected void cmdUpdate_Click(object sender, EventArgs e) } catch (Exception exc) { - Logger.Error(exc); + Logger.EditUserUpdateException(exc); if (exc.Message == "Display Name must be unique") { this.AddModuleMessage("DisplayNameNotUnique", ModuleMessage.ModuleMessageType.RedError, true); diff --git a/DNN Platform/Website/DesktopModules/Admin/Security/Password.ascx.cs b/DNN Platform/Website/DesktopModules/Admin/Security/Password.ascx.cs index a644bcb3c55..e960d18b685 100644 --- a/DNN Platform/Website/DesktopModules/Admin/Security/Password.ascx.cs +++ b/DNN Platform/Website/DesktopModules/Admin/Security/Password.ascx.cs @@ -26,6 +26,7 @@ namespace DotNetNuke.Modules.Admin.Users using DotNetNuke.Services.Mail; using DotNetNuke.UI.Skins.Controls; using DotNetNuke.Web.UI.WebControls; + using DotNetNuke.Website; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -351,12 +352,12 @@ private void CmdReset_Click(object sender, EventArgs e) } catch (ArgumentException exc) { - Logger.Error(exc); + Logger.PasswordResetArgumentException(exc); this.OnPasswordUpdated(new PasswordUpdatedEventArgs(PasswordUpdateStatus.InvalidPasswordAnswer)); } catch (Exception exc) { - Logger.Error(exc); + Logger.PasswordResetGeneralException(exc); this.OnPasswordUpdated(new PasswordUpdatedEventArgs(PasswordUpdateStatus.PasswordResetFailed)); } } @@ -386,12 +387,12 @@ private void CmdUserReset_Click(object sender, EventArgs e) } catch (ArgumentException exc) { - Logger.Error(exc); + Logger.PasswordUserResetArgumentException(exc); this.OnPasswordUpdated(new PasswordUpdatedEventArgs(PasswordUpdateStatus.InvalidPasswordAnswer)); } catch (Exception exc) { - Logger.Error(exc); + Logger.PasswordUserResetGeneralException(exc); this.OnPasswordUpdated(new PasswordUpdatedEventArgs(PasswordUpdateStatus.PasswordResetFailed)); } } @@ -503,7 +504,7 @@ private void CmdUpdate_Click(object sender, EventArgs e) catch (MembershipPasswordException exc) { // Password Answer missing - Logger.Error(exc); + Logger.PasswordUserUpdateMembershipPasswordException(exc); this.OnPasswordUpdated(new PasswordUpdatedEventArgs(PasswordUpdateStatus.InvalidPasswordAnswer)); } @@ -514,7 +515,7 @@ private void CmdUpdate_Click(object sender, EventArgs e) catch (Exception exc) { // Fail - Logger.Error(exc); + Logger.PasswordUserUpdateGeneralException(exc); this.OnPasswordUpdated(new PasswordUpdatedEventArgs(PasswordUpdateStatus.PasswordResetFailed)); } @@ -530,7 +531,7 @@ private void CmdUpdate_Click(object sender, EventArgs e) catch (MembershipPasswordException exc) { // Password Answer missing - Logger.Error(exc); + Logger.PasswordUserAdminUpdateMembershipPasswordException(exc); this.OnPasswordUpdated(new PasswordUpdatedEventArgs(PasswordUpdateStatus.InvalidPasswordAnswer)); } @@ -541,7 +542,7 @@ private void CmdUpdate_Click(object sender, EventArgs e) catch (Exception exc) { // Fail - Logger.Error(exc); + Logger.PasswordUserAdminUpdateGeneralException(exc); this.OnPasswordUpdated(new PasswordUpdatedEventArgs(PasswordUpdateStatus.PasswordResetFailed)); } diff --git a/DNN Platform/Website/DesktopModules/Admin/Security/SecurityRoles.ascx.cs b/DNN Platform/Website/DesktopModules/Admin/Security/SecurityRoles.ascx.cs index 7a142aaadd7..3e0dccd478d 100644 --- a/DNN Platform/Website/DesktopModules/Admin/Security/SecurityRoles.ascx.cs +++ b/DNN Platform/Website/DesktopModules/Admin/Security/SecurityRoles.ascx.cs @@ -30,6 +30,7 @@ namespace DotNetNuke.Modules.Admin.Security using DotNetNuke.Services.Localization; using DotNetNuke.UI.Skins.Controls; using DotNetNuke.UI.Utilities; + using DotNetNuke.Website; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -329,9 +330,7 @@ protected override void OnInit(EventArgs e) this.CurrentPage = 1; if (this.Request.QueryString["CurrentPage"] != null) { - var currentPage = 0; - if (int.TryParse(this.Request.QueryString["CurrentPage"], out currentPage) - && currentPage > 0) + if (int.TryParse(this.Request.QueryString["CurrentPage"], out var currentPage) && currentPage > 0) { this.CurrentPage = currentPage; } @@ -367,13 +366,13 @@ protected override void OnLoad(EventArgs e) return; } - this.placeIsOwner.Visible = (this.Role.SecurityMode == SecurityMode.SocialGroup) || (this.Role.SecurityMode == SecurityMode.Both); - this.placeIsOwnerHeader.Visible = (this.Role.SecurityMode == SecurityMode.SocialGroup) || (this.Role.SecurityMode == SecurityMode.Both); + this.placeIsOwner.Visible = this.Role.SecurityMode is SecurityMode.SocialGroup or SecurityMode.Both; + this.placeIsOwnerHeader.Visible = this.Role.SecurityMode is SecurityMode.SocialGroup or SecurityMode.Both; } catch (ThreadAbortException exc) { // Do nothing if ThreadAbort as this is caused by a redirect - Logger.Debug(exc); + Logger.SecurityRolesThreadAbortException(exc); } catch (Exception exc) { diff --git a/DNN Platform/Website/DesktopModules/Admin/Security/User.ascx.cs b/DNN Platform/Website/DesktopModules/Admin/Security/User.ascx.cs index ee0dfef0ead..8f37551ecae 100644 --- a/DNN Platform/Website/DesktopModules/Admin/Security/User.ascx.cs +++ b/DNN Platform/Website/DesktopModules/Admin/Security/User.ascx.cs @@ -25,6 +25,7 @@ namespace DotNetNuke.Modules.Admin.Users using DotNetNuke.Services.Localization; using DotNetNuke.UI.Utilities; using DotNetNuke.Web.UI.WebControls; + using DotNetNuke.Website; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -602,7 +603,7 @@ private void CmdUpdate_Click(object sender, EventArgs e) } catch (Exception exc) { - Logger.Error(exc); + Logger.UserUpdateException(exc); var args = new UserUpdateErrorArgs(this.User.UserID, this.User.Username, "EmailError"); this.OnUserUpdateError(args); diff --git a/DNN Platform/Website/DesktopModules/AuthenticationServices/DNN/Login.ascx.cs b/DNN Platform/Website/DesktopModules/AuthenticationServices/DNN/Login.ascx.cs index d42ccc7e78e..cbc836445c5 100644 --- a/DNN Platform/Website/DesktopModules/AuthenticationServices/DNN/Login.ascx.cs +++ b/DNN Platform/Website/DesktopModules/AuthenticationServices/DNN/Login.ascx.cs @@ -19,6 +19,8 @@ namespace DotNetNuke.Modules.Admin.Authentication.DNN using DotNetNuke.Services.Authentication; using DotNetNuke.Services.Localization; using DotNetNuke.UI.Skins.Controls; + using DotNetNuke.Website; + using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -218,7 +220,7 @@ protected override void OnLoad(EventArgs e) catch (Exception ex) { // control not there - Logger.Error(ex); + Logger.DnnLoginCleanUsernameException(ex); } } @@ -230,7 +232,7 @@ protected override void OnLoad(EventArgs e) { // Not sure why this Try/Catch may be necessary, logic was there in old setFormFocus location stating the following // control not there or error setting focus - Logger.Error(ex); + Logger.DnnLoginSetFormFocusException(ex); } } diff --git a/DNN Platform/Website/DotNetNuke.Website.csproj b/DNN Platform/Website/DotNetNuke.Website.csproj index ee40a377f2e..d515db1bfcc 100644 --- a/DNN Platform/Website/DotNetNuke.Website.csproj +++ b/DNN Platform/Website/DotNetNuke.Website.csproj @@ -730,6 +730,7 @@ KeepAlive.aspx + Designer diff --git a/DNN Platform/Website/Install/Install.aspx.cs b/DNN Platform/Website/Install/Install.aspx.cs index 069c2b4405b..53c5372ed83 100644 --- a/DNN Platform/Website/Install/Install.aspx.cs +++ b/DNN Platform/Website/Install/Install.aspx.cs @@ -31,6 +31,8 @@ namespace DotNetNuke.Services.Install using DotNetNuke.Services.Upgrade.Internals; using DotNetNuke.Services.Upgrade.Internals.Steps; using DotNetNuke.Web.Client.ClientResourceManagement; + using DotNetNuke.Website; + using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -302,7 +304,7 @@ private void InstallApplication() strError += Config.AddFCNMode(this.appStatus, Config.FcnMode.Single); if (!string.IsNullOrEmpty(strError)) { - Logger.Error(strError); + Logger.InstallAddFcnModeErrorMessage(strError); } this.Response.Write("

Installation Complete

"); @@ -438,7 +440,7 @@ private void UpgradeApplication() strError += Config.AddFCNMode(this.appStatus, Config.FcnMode.Single); if (!string.IsNullOrEmpty(strError)) { - Logger.Error(strError); + Logger.InstallAddFcnModeErrorMessage(strError); } HtmlUtils.WriteFeedback(HttpContext.Current.Response, 2, "Replacing Digital Assets Manager with the new Resource Manager: "); @@ -568,7 +570,7 @@ private void AddPortal() catch (Exception ex) { // error removing the file - Logger.Error(ex); + Logger.InstallDeletePortalResourcesFileException(ex); } this.Response.Write("

Installation Complete

"); @@ -659,7 +661,7 @@ private void NoUpgrade() catch (Exception ex) { // Write out Header - Logger.Error(ex); + Logger.InstallNoUpgradeException(ex); HtmlUtils.WriteHeader(this.Response, "error"); this.Response.Write("

Current Assembly Version: " + DotNetNukeContext.Current.Application.Version.ToString(3) + "

"); diff --git a/DNN Platform/Website/Install/InstallWizard.aspx.cs b/DNN Platform/Website/Install/InstallWizard.aspx.cs index 5904c97dd92..0ef29e86c69 100644 --- a/DNN Platform/Website/Install/InstallWizard.aspx.cs +++ b/DNN Platform/Website/Install/InstallWizard.aspx.cs @@ -39,6 +39,7 @@ namespace DotNetNuke.Services.Install using DotNetNuke.Services.Upgrade.Internals.Steps; using DotNetNuke.UI.Utilities; using DotNetNuke.Web.UI.WebControls; + using DotNetNuke.Website; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -771,7 +772,7 @@ private static void Install(IApplicationStatusInfo appStatus) } catch (Exception ex) { - Logger.Error("WIZARD ERROR:" + ex); + Logger.InstallWizardError(ex); CurrentStepActivity("ERROR:" + ex.Message); installerRunning = false; return; diff --git a/DNN Platform/Website/Install/UpgradeWizard.aspx.cs b/DNN Platform/Website/Install/UpgradeWizard.aspx.cs index 7d655a49424..d3a9a8b701a 100644 --- a/DNN Platform/Website/Install/UpgradeWizard.aspx.cs +++ b/DNN Platform/Website/Install/UpgradeWizard.aspx.cs @@ -34,6 +34,8 @@ namespace DotNetNuke.Services.Install using DotNetNuke.Services.Upgrade.InternalController.Steps; using DotNetNuke.Services.Upgrade.Internals.Steps; using DotNetNuke.Services.UserRequest; + using DotNetNuke.Website; + using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -731,7 +733,7 @@ private static bool TelerikAntiForgeryTokenIsValid(ICryptographyProvider cryptog } catch (Exception ex) { - Logger.Error(ex); + Logger.UpgradeWizardAntiForgeryTokenException(ex); return false; // malformed token. } diff --git a/DNN Platform/Website/LoggerMessages.cs b/DNN Platform/Website/LoggerMessages.cs new file mode 100644 index 00000000000..fa75cbb2df7 --- /dev/null +++ b/DNN Platform/Website/LoggerMessages.cs @@ -0,0 +1,86 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace DotNetNuke.Website +{ + using System; + using System.Threading; + using System.Web.Security; + + using Microsoft.Extensions.Logging; + + /// Extension methods for for pre-defined logging messages. + /// The DotNetNuke.Website project has been assigned event IDs from 1,000,000 to 1,199,999. + internal static partial class LoggerMessages + { + [LoggerMessage(EventId = 1_000_000, Level = LogLevel.Debug)] + public static partial void SecurityRolesThreadAbortException(this ILogger logger, ThreadAbortException exception); + + [LoggerMessage(EventId = 1_000_001, Level = LogLevel.Debug)] + public static partial void ModuleSettingsThreadAbortException(this ILogger logger, ThreadAbortException exception); + + [LoggerMessage(EventId = 1_000_100, Level = LogLevel.Error)] + public static partial void InstallDeletePortalResourcesFileException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_000_101, Level = LogLevel.Error)] + public static partial void InstallNoUpgradeException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_000_102, Level = LogLevel.Error, Message = "{Message}")] + public static partial void InstallAddFcnModeErrorMessage(this ILogger logger, string message); + + [LoggerMessage(EventId = 1_000_200, Level = LogLevel.Error)] + public static partial void UpgradeWizardAntiForgeryTokenException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_000_300, Level = LogLevel.Error)] + public static partial void ToastInitializeConfigException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_000_400, Level = LogLevel.Error)] + public static partial void PayPalSubscriptionUserAddressException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_000_500, Level = LogLevel.Error)] + public static partial void EditUserUpdateException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_000_600, Level = LogLevel.Error)] + public static partial void PasswordResetArgumentException(this ILogger logger, ArgumentException exception); + + [LoggerMessage(EventId = 1_000_601, Level = LogLevel.Error)] + public static partial void PasswordResetGeneralException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_000_602, Level = LogLevel.Error)] + public static partial void PasswordUserResetArgumentException(this ILogger logger, ArgumentException exception); + + [LoggerMessage(EventId = 1_000_603, Level = LogLevel.Error)] + public static partial void PasswordUserResetGeneralException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_000_604, Level = LogLevel.Error)] + public static partial void PasswordUserUpdateMembershipPasswordException(this ILogger logger, MembershipPasswordException exception); + + [LoggerMessage(EventId = 1_000_605, Level = LogLevel.Error)] + public static partial void PasswordUserUpdateGeneralException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_000_606, Level = LogLevel.Error)] + public static partial void PasswordUserAdminUpdateMembershipPasswordException(this ILogger logger, MembershipPasswordException exception); + + [LoggerMessage(EventId = 1_000_607, Level = LogLevel.Error)] + public static partial void PasswordUserAdminUpdateGeneralException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_000_700, Level = LogLevel.Error)] + public static partial void UserUpdateException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_000_800, Level = LogLevel.Error)] + public static partial void DnnLoginCleanUsernameException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_000_801, Level = LogLevel.Error)] + public static partial void DnnLoginSetFormFocusException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_000_900, Level = LogLevel.Error)] + public static partial void AuthenticationLoginPageNoException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_001_000, Level = LogLevel.Error, Message = "CSP error")] + public static partial void DefaultCspError(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 1_001_100, Level = LogLevel.Error, Message = "WIZARD ERROR:")] + public static partial void InstallWizardError(this ILogger logger, Exception exception); + } +} diff --git a/DNN Platform/Website/admin/Modules/Modulesettings.ascx.cs b/DNN Platform/Website/admin/Modules/Modulesettings.ascx.cs index 002a9172b05..c7f93ff03b3 100644 --- a/DNN Platform/Website/admin/Modules/Modulesettings.ascx.cs +++ b/DNN Platform/Website/admin/Modules/Modulesettings.ascx.cs @@ -32,6 +32,7 @@ namespace DotNetNuke.Modules.Admin.Modules using DotNetNuke.UI.Modules; using DotNetNuke.UI.Skins; using DotNetNuke.UI.Skins.Controls; + using DotNetNuke.Website; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -516,7 +517,7 @@ protected void OnUpdateClick(object sender, EventArgs e) } catch (ThreadAbortException exc) { - Logger.Debug(exc); + Logger.ModuleSettingsThreadAbortException(exc); Thread.ResetAbort(); // necessary } diff --git a/DNN Platform/Website/admin/Sales/PayPalSubscription.aspx.cs b/DNN Platform/Website/admin/Sales/PayPalSubscription.aspx.cs index 06411cda44f..0317cc95332 100644 --- a/DNN Platform/Website/admin/Sales/PayPalSubscription.aspx.cs +++ b/DNN Platform/Website/admin/Sales/PayPalSubscription.aspx.cs @@ -17,6 +17,7 @@ namespace DotNetNuke.Modules.Admin.Sales using DotNetNuke.Internal.SourceGenerators; using DotNetNuke.Security.Roles; using DotNetNuke.Services.Exceptions; + using DotNetNuke.Website; using Microsoft.Extensions.Logging; @@ -179,7 +180,7 @@ protected override void OnLoad(EventArgs e) catch (Exception ex) { // issue getting user address - Logger.Error(ex); + Logger.PayPalSubscriptionUserAddressException(ex); } // Return URL diff --git a/DNN Platform/Website/admin/Skins/Toast.ascx.cs b/DNN Platform/Website/admin/Skins/Toast.ascx.cs index 952483eafbd..d6bb8170494 100644 --- a/DNN Platform/Website/admin/Skins/Toast.ascx.cs +++ b/DNN Platform/Website/admin/Skins/Toast.ascx.cs @@ -20,6 +20,8 @@ namespace DotNetNuke.UI.Skins.Controls using DotNetNuke.Instrumentation; using DotNetNuke.Services.ClientDependency; using DotNetNuke.Services.Localization; + using DotNetNuke.Website; + using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -215,7 +217,7 @@ private void InitializeConfig() } catch (Exception ex) { - Logger.Error(ex); + Logger.ToastInitializeConfigException(ex); } } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/ConfigConsole/ConfigConsoleController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/ConfigConsole/ConfigConsoleController.cs index 9bc28be5cc9..a0605398955 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/ConfigConsole/ConfigConsoleController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/ConfigConsole/ConfigConsoleController.cs @@ -358,7 +358,7 @@ private partial string SaveNonConfig(string document, string filename) { if (retry == 0) { - Logger.Error(exc); + Logger.ConfigConsoleControllerSaveNonConfigFileIOException(exc); retMsg = exc.Message; } @@ -373,7 +373,7 @@ private partial string SaveNonConfig(string document, string filename) catch (Exception exc) { // the file permissions may not be set properly - Logger.Error(exc); + Logger.ConfigConsoleControllerSaveNonConfigFileGeneralException(exc); retMsg = exc.Message; } @@ -413,7 +413,7 @@ private async Task SaveNonConfigAsync(string document, string filename) { if (retry == 0) { - Logger.Error(exc); + Logger.ConfigConsoleControllerSaveNonConfigFileIOException(exc); retMsg = exc.Message; } @@ -428,7 +428,7 @@ private async Task SaveNonConfigAsync(string document, string filename) catch (Exception exc) { // the file permissions may not be set properly - Logger.Error(exc); + Logger.ConfigConsoleControllerSaveNonConfigFileGeneralException(exc); retMsg = exc.Message; } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/AuthSystemPackageEditor.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/AuthSystemPackageEditor.cs index 02ae69660a5..c13258da6e2 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/AuthSystemPackageEditor.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/AuthSystemPackageEditor.cs @@ -96,7 +96,7 @@ public bool SavePackageSettings(PackageSettingsDto packageSettings, out string e } catch (Exception ex) { - Logger.Error(ex); + Logger.AuthSystemPackageEditorSavePackageSettingsException(ex); errorMessage = ex.Message; return false; } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/CoreLanguagePackageEditor.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/CoreLanguagePackageEditor.cs index bb0ee739701..e4631c1ac07 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/CoreLanguagePackageEditor.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/CoreLanguagePackageEditor.cs @@ -77,7 +77,7 @@ public bool SavePackageSettings(PackageSettingsDto packageSettings, out string e } catch (Exception ex) { - Logger.Error(ex); + Logger.CoreLanguagePackageEditorSavePackageSettingsException(ex); errorMessage = ex.Message; return false; } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/ExtensionLanguagePackageEditor.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/ExtensionLanguagePackageEditor.cs index 4d0affde66f..4eeef652af2 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/ExtensionLanguagePackageEditor.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/ExtensionLanguagePackageEditor.cs @@ -86,7 +86,7 @@ public bool SavePackageSettings(PackageSettingsDto packageSettings, out string e } catch (Exception ex) { - Logger.Error(ex); + Logger.ExtensionLanguagePackageEditorSavePackageSettingsException(ex); errorMessage = ex.Message; return false; } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/JsLibraryPackageEditor.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/JsLibraryPackageEditor.cs index 3f855ac2357..69749f63965 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/JsLibraryPackageEditor.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/JsLibraryPackageEditor.cs @@ -60,8 +60,7 @@ public bool SavePackageSettings(PackageSettingsDto packageSettings, out string e try { - string value; - if (packageSettings.EditorActions.TryGetValue("customCdn", out value) + if (packageSettings.EditorActions.TryGetValue("customCdn", out var value) && !string.IsNullOrEmpty(value)) { var library = JavaScriptLibraryController.Instance.GetLibrary(l => l.PackageID == packageSettings.PackageId); @@ -72,7 +71,7 @@ public bool SavePackageSettings(PackageSettingsDto packageSettings, out string e } catch (Exception ex) { - Logger.Error(ex); + Logger.JsLibraryPackageEditorSavePackageSettingsException(ex); errorMessage = ex.Message; return false; } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/ModulePackageEditor.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/ModulePackageEditor.cs index 0a8266c9290..bb85814827c 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/ModulePackageEditor.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/ModulePackageEditor.cs @@ -97,7 +97,7 @@ public bool SavePackageSettings(PackageSettingsDto packageSettings, out string e } catch (Exception ex) { - Logger.Error(ex); + Logger.ModulePackageEditorSavePackageSettingsException(ex); errorMessage = ex.Message; return false; } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/SkinObjectPackageEditor.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/SkinObjectPackageEditor.cs index f12378c411d..5420c0c9823 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/SkinObjectPackageEditor.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/SkinObjectPackageEditor.cs @@ -70,7 +70,7 @@ public bool SavePackageSettings(PackageSettingsDto packageSettings, out string e } catch (Exception ex) { - Logger.Error(ex); + Logger.SkinObjectPackageEditorSavePackageSettingsException(ex); errorMessage = ex.Message; return false; } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/SkinPackageEditor.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/SkinPackageEditor.cs index 3b2b15c4f53..6f222370b1c 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/SkinPackageEditor.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/SkinPackageEditor.cs @@ -44,10 +44,9 @@ public bool SavePackageSettings(PackageSettingsDto packageSettings, out string e if (isHostUser) { - string value; var skin = SkinController.GetSkinByPackageID(packageSettings.PackageId); - if (packageSettings.EditorActions.TryGetValue("themePackageName", out value) + if (packageSettings.EditorActions.TryGetValue("themePackageName", out var value) && !string.IsNullOrEmpty(value)) { skin.SkinName = value; @@ -59,7 +58,7 @@ public bool SavePackageSettings(PackageSettingsDto packageSettings, out string e } catch (Exception ex) { - Logger.Error(ex); + Logger.SkinPackageEditorSavePackageSettingsException(ex); errorMessage = ex.Message; return false; } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/InstallController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/InstallController.cs index 453bd462c54..3a94805f987 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/InstallController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/InstallController.cs @@ -228,7 +228,7 @@ private static void DeleteTempInstallFiles(Installer installer) } catch (Exception ex) { - Logger.Error(ex); + Logger.InstallControllerDeleteTempInstallFilesException(ex); } } @@ -244,7 +244,7 @@ private static void DeleteInstallFile(string installerFile) } catch (Exception ex) { - Logger.Error(ex); + Logger.InstallControllerDeleteInstallFileException(ex); } } @@ -288,7 +288,7 @@ private static void DeleteInstallFile(string installerFile) } catch (Exception ex) { - Logger.Error(ex); + Logger.InstallControllerReadAzureCompatibleException(ex); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Commands/Application/RestartApplication.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Commands/Application/RestartApplication.cs index 8884c295b0a..33c38e03bbb 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Commands/Application/RestartApplication.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Commands/Application/RestartApplication.cs @@ -39,7 +39,7 @@ public override ConsoleResultModel Run() } catch (Exception ex) { - Logger.Error(ex); + Logger.RestartApplicationRunException(ex); return new ConsoleErrorResultModel(this.LocalizeString("Prompt_UserRestart_Error")); } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Commands/Commands/ListCommands.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Commands/Commands/ListCommands.cs index 37e4e6c4d24..cc5017c9b9d 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Commands/Commands/ListCommands.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Commands/Commands/ListCommands.cs @@ -51,7 +51,7 @@ public override ConsoleResultModel Run() } catch (Exception ex) { - Logger.Error(ex); + Logger.ListCommandsRunException(ex); return new ConsoleErrorResultModel(this.LocalizeString("Prompt_ListCommands_Error")); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Commands/Host/ClearCache.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Commands/Host/ClearCache.cs index 5d01fcdab06..2e64528a7af 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Commands/Host/ClearCache.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Commands/Host/ClearCache.cs @@ -33,7 +33,7 @@ public override ConsoleResultModel Run() } catch (Exception ex) { - Logger.Error(ex); + Logger.ClearCacheRunException(ex); return new ConsoleErrorResultModel(this.LocalizeString("Prompt_ClearCache_Error")); } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Commands/Portal/ClearLog.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Commands/Portal/ClearLog.cs index 20f0fc34c9c..c5027306482 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Commands/Portal/ClearLog.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/Commands/Portal/ClearLog.cs @@ -49,7 +49,7 @@ public override ConsoleResultModel Run() } catch (Exception ex) { - Logger.Error(ex); + Logger.ClearLogRunException(ex); return new ConsoleErrorResultModel(this.LocalizeString("Prompt_ClearLog_Error")); } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/ModulesController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/ModulesController.cs index 71903ec9064..7b4aa43a9aa 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/ModulesController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Prompt/ModulesController.cs @@ -150,7 +150,7 @@ public ModuleInfo CopyModule(PortalSettings portalSettings, int moduleId, int so } catch (Exception ex) { - Logger.Error(ex); + Logger.ModulesControllerCopyModuleException(ex); message = new KeyValuePair(HttpStatusCode.InternalServerError, Localization.GetString(moveBahaviour ? "Prompt_ErrorWhileMoving" : "Prompt_ErrorWhileCopying")); } @@ -177,7 +177,7 @@ public void DeleteModule(PortalSettings portalSettings, int moduleId, int pageId } catch (Exception ex) { - Logger.Error(ex); + Logger.ModulesControllerDeleteModuleException(ex); message = new KeyValuePair(HttpStatusCode.InternalServerError, string.Format(CultureInfo.CurrentCulture, Localization.GetString("Prompt_FailedtoDeleteModule", Constants.LocalResourcesFile), moduleId)); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Recyclebin/RecyclebinController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Recyclebin/RecyclebinController.cs index d267599787a..4cdc9485594 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Recyclebin/RecyclebinController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Recyclebin/RecyclebinController.cs @@ -377,7 +377,7 @@ private void HardDeleteTab(TabInfo tab, bool deleteDescendants, StringBuilder er } catch (Exception exc) { - Logger.Error(exc); + Logger.RecyclebinControllerDeleteModuleForTabException(exc); } } } @@ -409,7 +409,7 @@ private void HardDeleteModule(ModuleInfo module, StringBuilder errors) } catch (Exception exc) { - Logger.Error(exc); + Logger.RecyclebinControllerHardDeleteModuleException(exc); } // hard-delete Tab Module Instance diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Roles/Prompt/Commands/DeleteRole.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Roles/Prompt/Commands/DeleteRole.cs index 6d6975ac7e9..3f5d9630f5b 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Roles/Prompt/Commands/DeleteRole.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Roles/Prompt/Commands/DeleteRole.cs @@ -44,15 +44,14 @@ public override ConsoleResultModel Run() { try { - KeyValuePair message; - var roleName = RolesController.Instance.DeleteRole(this.PortalSettings, this.RoleId, out message); + var roleName = RolesController.Instance.DeleteRole(this.PortalSettings, this.RoleId, out var message); return !string.IsNullOrEmpty(roleName) ? new ConsoleResultModel($"{this.LocalizeString("DeleteRole.Message")} '{roleName}' ({this.RoleId})") { Records = 1 } : new ConsoleErrorResultModel(message.Value); } catch (Exception ex) { - Logger.Error(ex); + Logger.DeleteRoleRunException(ex); return new ConsoleErrorResultModel(this.LocalizeString("DeleteRole.Error")); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Roles/Prompt/Commands/ListRoles.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Roles/Prompt/Commands/ListRoles.cs index a617f560d5b..97773dc4ee4 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Roles/Prompt/Commands/ListRoles.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Roles/Prompt/Commands/ListRoles.cs @@ -77,7 +77,7 @@ public override ConsoleResultModel Run() } catch (Exception ex) { - Logger.Error(ex); + Logger.ListRolesRunException(ex); return new ConsoleErrorResultModel(this.LocalizeString("Prompt_ListRolesFailed")); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Roles/Prompt/Commands/NewRole.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Roles/Prompt/Commands/NewRole.cs index ce83ff21e5b..193acd90753 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Roles/Prompt/Commands/NewRole.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Roles/Prompt/Commands/NewRole.cs @@ -110,7 +110,7 @@ public override ConsoleResultModel Run() } catch (Exception ex) { - Logger.Error(ex); + Logger.NewRoleRunException(ex); return new ConsoleErrorResultModel(this.LocalizeString("RoleAdded.Error")); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Roles/Prompt/Commands/SetRole.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Roles/Prompt/Commands/SetRole.cs index 97c96f96432..7da8a554687 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Roles/Prompt/Commands/SetRole.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Roles/Prompt/Commands/SetRole.cs @@ -128,12 +128,12 @@ public override ConsoleResultModel Run() } catch (SetRoleException se) { - Logger.Error(se); + Logger.SetRoleRunSetRoleException(se); return new ConsoleErrorResultModel(this.LocalizeString("RoleUpdated.SystemRoleError")); } catch (Exception ex) { - Logger.Error(ex); + Logger.SetRoleRunGeneralException(ex); return new ConsoleErrorResultModel(this.LocalizeString("RoleUpdated.Error")); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Security/Checks/BaseCheck.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Security/Checks/BaseCheck.cs index 522df53eaf8..3cf076a3cad 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Security/Checks/BaseCheck.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Security/Checks/BaseCheck.cs @@ -55,7 +55,7 @@ public virtual CheckResult Execute() } catch (Exception ex) { - this.logger.Error($"{this.Id} failed.", ex); + this.logger.BaseCheckFailed(ex, this.Id); return this.Unverified("An internal error occurred. See logs for details."); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/SiteSettings/LanguagesControllerTasks.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/SiteSettings/LanguagesControllerTasks.cs index d812e4028c3..763af70ba3a 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/SiteSettings/LanguagesControllerTasks.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/SiteSettings/LanguagesControllerTasks.cs @@ -86,7 +86,7 @@ public static void LocalizeSitePages(LocalizationProgress progress, int portalId { try { - Logger.Error(ex); + Logger.LanguageControllerTasksLocalizeSitePagesException(ex); progress.Reset().Error = ex.ToString(); SaveProgressToFile(progress); } @@ -125,7 +125,7 @@ public static void LocalizeLanguagePages(LocalizationProgress progress, int port { try { - Logger.Error(ex); + Logger.LanguageControllerTasksLocalizeLanguagePagesException(ex); progress.Reset().Error = ex.ToString(); SaveProgressToFile(progress); } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Sites/SitesController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Sites/SitesController.cs index 6f1a7fcebb2..967c1695a19 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Sites/SitesController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Sites/SitesController.cs @@ -405,7 +405,7 @@ public int CreatePortal(List errors, string domainName, string serverPat } catch (Exception ex) { - Logger.Error(ex); + Logger.ComponentsSitesControllerCreatePortalException(ex); intPortalId = Null.NullInteger; message = ex.Message; @@ -454,7 +454,7 @@ public int CreatePortal(List errors, string domainName, string serverPat } catch (Exception exc) { - Logger.Error(exc); + Logger.ComponentsSitesControllerSendMailException(exc); message = string.Format(CultureInfo.CurrentCulture, Localization.GetString("UnknownSendMail.Error", this.LocalResourcesFile), webUrl, closePopUpStr); } @@ -506,7 +506,7 @@ private static void TryDeleteCreatingPortal(string serverPath, string childPath) } catch (Exception ex) { - Logger.Error(ex); + Logger.ComponentsSitesControllerTryDeleteCreatingPortalException(ex); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/TaskScheduler/Prompt/Commands/GetTask.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/TaskScheduler/Prompt/Commands/GetTask.cs index 0a791ba6465..8fe0474a2f9 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/TaskScheduler/Prompt/Commands/GetTask.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/TaskScheduler/Prompt/Commands/GetTask.cs @@ -66,7 +66,7 @@ public override ConsoleResultModel Run() } catch (Exception exc) { - Logger.Error(exc); + Logger.GetTaskRunException(exc); return new ConsoleErrorResultModel(this.LocalizeString("Prompt_FetchTaskFailed")); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/TaskScheduler/Prompt/Commands/SetTask.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/TaskScheduler/Prompt/Commands/SetTask.cs index 969167a4c8a..a1209af0af9 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/TaskScheduler/Prompt/Commands/SetTask.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/TaskScheduler/Prompt/Commands/SetTask.cs @@ -70,7 +70,7 @@ public override ConsoleResultModel Run() } catch (Exception exc) { - Logger.Error(exc); + Logger.SetTaskRunException(exc); return new ConsoleErrorResultModel(this.LocalizeString("Prompt_TaskUpdateFailed")); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/TaskScheduler/TaskSchedulerController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/TaskScheduler/TaskSchedulerController.cs index a915050417a..2d49c4737b7 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/TaskScheduler/TaskSchedulerController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/TaskScheduler/TaskSchedulerController.cs @@ -154,7 +154,7 @@ public IEnumerable GetScheduleItems(bool? enabled, string serverNa } catch (Exception exc) { - Logger.Error(exc); + Logger.ComponentsTaskSchedulerControllerGetScheduleItemsException(exc); return null; } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Themes/ThemesController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Themes/ThemesController.cs index 660a1336901..675df3c7275 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Themes/ThemesController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Themes/ThemesController.cs @@ -435,7 +435,7 @@ internal static string CreateThumbnail(string strImage) catch (Exception ex) { // problem creating thumbnail - Logger.Error(ex); + Logger.ComponentsThemesControllerCreateThumbnailException(ex); } } } @@ -664,7 +664,7 @@ private static void UpdateManifest(PortalSettings portalSettings, UpdateThemeInf } catch (Exception ex) { - Logger.Error(ex); + Logger.ComponentsThemesControllerUpdateManifestException(ex); } } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Users/UsersController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Users/UsersController.cs index 338bd2ddd62..43e3eaf6d6e 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Users/UsersController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Users/UsersController.cs @@ -165,7 +165,7 @@ public bool ChangePassword(int portalId, int userId, string newPassword) catch (MembershipPasswordException exc) { // Password Answer missing - Logger.Error(exc); + Logger.ComponentsUsersControllerChangePasswordMembershipPasswordException(exc); throw new InvalidPasswordException(Localization.GetString("PasswordInvalid", Constants.LocalResourcesFile), exc); } catch (ThreadAbortException) @@ -175,13 +175,13 @@ public bool ChangePassword(int portalId, int userId, string newPassword) catch (InvalidPasswordException exc) { // Password validation has failed - Logger.Error(exc); + Logger.ComponentsUsersControllerChangePasswordInvalidPasswordException(exc); throw new InvalidPasswordException(Localization.GetString("PasswordResetFailed", Constants.LocalResourcesFile), exc); } catch (Exception exc) { // Fail - Logger.Error(exc); + Logger.ComponentsUsersControllerChangePasswordGeneralException(exc); throw new InvalidPasswordException(Localization.GetString("PasswordResetFailed", Constants.LocalResourcesFile), exc); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/LoggerMessages.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/LoggerMessages.cs new file mode 100644 index 00000000000..2f5c2490e52 --- /dev/null +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/LoggerMessages.cs @@ -0,0 +1,1235 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.PersonaBar; + +using System; +using System.Data.SqlClient; +using System.IO; +using System.Web.Security; + +using Dnn.PersonaBar.Roles.Components.Prompt.Exceptions; + +using DotNetNuke.Entities.Users; +using DotNetNuke.Services.Connections; + +using Microsoft.Extensions.Logging; + +/// Extension methods for for pre-defined logging messages. +/// The Dnn.PersonaBar.Extensions project has been assigned event IDs from 7,000,000 to 7,999,999. +internal static partial class LoggerMessages +{ + /* + # Event IDs + - 7,000,000 to 7,999,999 + - Dnn.PersonaBar.Extensions project + - 7,000,000 to 7,099,999 + - Dnn.PersonaBar.Extensions namespace + - 7,200,000 to 7,204,999 + - Dnn.PersonaBar.AdminLogs.Components namespace + - Dnn.PersonaBar.AdminLogs.MenuControllers namespace + - 7,205,000 to 7,209,999 + - Dnn.PersonaBar.AdminLogs.Services namespace + - Dnn.PersonaBar.AdminLogs.Services.Dto namespace + - 7,210,000 to 7,214,999 + - Dnn.PersonaBar.ConfigConsole.Components namespace + - Dnn.PersonaBar.ConfigConsole.MenuControllers namespace + - 7,215,000 to 7,219,999 + - Dnn.PersonaBar.ConfigConsole.Services namespace + - Dnn.PersonaBar.ConfigConsole.Services.Dto namespace + - 7,220,000 to 7,224,999 + - Dnn.PersonaBar.Connectors.Components namespace + - 7,225,000 to 7,229,999 + - Dnn.PersonaBar.Connectors.Services namespace + - 7,230,000 to 7,234,999 + - Dnn.PersonaBar.CssEditor.MenuControllers namespace + - 7,235,000 to 7,239,999 + - Dnn.PersonaBar.CssEditor.Services namespace + - Dnn.PersonaBar.CssEditor.Services.Dto namespace + - 7,240,000 to 7,244,999 + - Dnn.PersonaBar.CssEditor.Components namespace + - Dnn.PersonaBar.CssEditor.MenuControllers namespace + - 7,245,000 to 7,249,999 + - Dnn.PersonaBar.CssEditor.Services namespace + - Dnn.PersonaBar.CssEditor.Services.Dto namespace + - 7,250,000 to 7,254,999 + - Dnn.PersonaBar.Extensions.Components namespace + - Dnn.PersonaBar.Extensions.Components.Dto namespace + - Dnn.PersonaBar.Extensions.Components.Dto.Editors namespace + - Dnn.PersonaBar.Extensions.Components.Editors namespace + - Dnn.PersonaBar.Extensions.MenuControllers namespace + - 7,255,000 to 7,259,999 + - Dnn.PersonaBar.Extensions.Services namespace + - Dnn.PersonaBar.Extensions.Services.Dto namespace + - 7,260,000 to 7,264,999 + - Dnn.PersonaBar.Licensing.MenuControllers namespace + - 7,265,000 to 7,269,999 + - Dnn.PersonaBar.Licensing.Services namespace + - 7,270,000 to 7,274,999 + - Dnn.PersonaBar.Pages.Components namespace + - Dnn.PersonaBar.Pages.Components.Dto namespace + - Dnn.PersonaBar.Pages.Components.Exceptions namespace + - Dnn.PersonaBar.Pages.Components.Prompt.Commands namespace + - Dnn.PersonaBar.Pages.Components.Prompt.Models namespace + - Dnn.PersonaBar.Pages.Components.Security namespace + - Dnn.PersonaBar.Pages.MenuControllers namespace + - 7,275,000 to 7,279,999 + - Dnn.PersonaBar.Pages.Services namespace + - Dnn.PersonaBar.Pages.Services.Dto namespace + - 7,280,000 to 7,284,999 + - Dnn.PersonaBar.Prompt.Common namespace + - Dnn.PersonaBar.Prompt.Components namespace + - Dnn.PersonaBar.Prompt.Components.Commands.Application namespace + - Dnn.PersonaBar.Prompt.Components.Commands.Client namespace + - Dnn.PersonaBar.Prompt.Components.Commands.Commands namespace + - Dnn.PersonaBar.Prompt.Components.Commands.Host namespace + - Dnn.PersonaBar.Prompt.Components.Commands.Module namespace + - Dnn.PersonaBar.Prompt.Components.Commands.Portal namespace + - Dnn.PersonaBar.Prompt.Components.Commands.Utilities namespace + - Dnn.PersonaBar.Prompt.Components.Models namespace + - Dnn.PersonaBar.Prompt.Components.Repositories namespace + - Dnn.PersonaBar.Prompt.MenuControllers namespace + - 7,285,000 to 7,289,999 + - Dnn.PersonaBar.Prompt.Services namespace + - 7,290,000 to 7,294,999 + - Dnn.PersonaBar.Recyclebin.Components namespace + - Dnn.PersonaBar.Recyclebin.Components.Dto namespace + - Dnn.PersonaBar.Recyclebin.Components.Prompt.Commands namespace + - 7,295,000 to 7,299,999 + - Dnn.PersonaBar.Recyclebin.Services namespace + - 7,300,000 to 7,304,999 + - Dnn.PersonaBar.Roles.Components namespace + - Dnn.PersonaBar.Roles.Components.Prompt.Commands namespace + - Dnn.PersonaBar.Roles.Components.Prompt.Exceptions namespace + - Dnn.PersonaBar.Roles.Components.Prompt.Models namespace + - 7,305,000 to 7,309,999 + - Dnn.PersonaBar.Roles.Services namespace + - Dnn.PersonaBar.Roles.Services.DTO namespace + - 7,310,000 to 7,314,999 + - Dnn.PersonaBar.Extensions.Components.Security.Ssl namespace + - Dnn.PersonaBar.Security.Attributes namespace + - Dnn.PersonaBar.Security.Components namespace + - Dnn.PersonaBar.Security.Components.Checks namespace + - Dnn.PersonaBar.Security.Helper namespace + - Dnn.PersonaBar.Security.MenuControllers namespace + - 7,315,000 to 7,319,999 + - Dnn.PersonaBar.Security.Services namespace + - Dnn.PersonaBar.Security.Services.Dto namespace + - 7,320,000 to 7,324,999 + - Dnn.PersonaBar.Seo.Components namespace + - 7,325,000 to 7,329,999 + - Dnn.PersonaBar.Seo.Services namespace + - Dnn.PersonaBar.Seo.Services.Dto namespace + - 7,330,000 to 7,334,999 + - Dnn.PersonaBar.Servers.Components namespace + - Dnn.PersonaBar.Servers.Components.DatabaseServer namespace + - Dnn.PersonaBar.Servers.Components.Log namespace + - Dnn.PersonaBar.Servers.Components.PerformanceSettings namespace + - Dnn.PersonaBar.Servers.Components.WebServer namespace + - Dnn.PersonaBar.Servers.MenuControllers namespace + - 7,335,000 to 7,339,999 + - Dnn.PersonaBar.Servers.Services namespace + - Dnn.PersonaBar.Servers.Services.Dto namespace + - 7,340,000 to 7,344,999 + - Dnn.PersonaBar.SiteGroups namespace + - Dnn.PersonaBar.SiteGroups.Models namespace + - 7,345,000 to 7,349,999 + - Dnn.PersonaBar.SiteGroups.Services namespace + - 7,350,000 to 7,354,999 + - Dnn.PersonaBar.SiteImportExport.Components namespace + - Dnn.PersonaBar.SiteImportExport.MenuControllers namespace + - 7,355,000 to 7,354,999 + - Dnn.PersonaBar.SiteImportExport.Services namespace + - 7,360,000 to 7,364,999 + - Dnn.PersonaBar.Sites.Components namespace + - Dnn.PersonaBar.Sites.Components.Dto namespace + - Dnn.PersonaBar.Sites.MenuControllers namespace + - 7,365,000 to 7,369,999 + - Dnn.PersonaBar.Sites.Services namespace + - Dnn.PersonaBar.Sites.Services.Dto namespace + - 7,370,000 to 7,374,999 + - Dnn.PersonaBar.SiteSettings.Components namespace + - Dnn.PersonaBar.SiteSettings.Components.Constants namespace + - Dnn.PersonaBar.SiteSettings.MenuControllers namespace + - 7,375,000 to 7,379,999 + - Dnn.PersonaBar.SiteSettings.Services namespace + - Dnn.PersonaBar.SiteSettings.Services.Dto namespace + - 7,380,000 to 7,384,999 + - Dnn.PersonaBar.SqlConsole.Components namespace + - Dnn.PersonaBar.SqlConsole.MenuControllers namespace + - 7,385,000 to 7,389,999 + - Dnn.PersonaBar.SqlConsole.Services namespace + - 7,390,000 to 7,394,999 + - Dnn.PersonaBar.Styles.Components namespace + - Dnn.PersonaBar.Styles.MenuControllers namespace + - 7,395,000 to 7,399,999 + - Dnn.PersonaBar.Styles.Services namespace + - 7,400,000 to 7,404,999 + - Dnn.PersonaBar.TaskScheduler.Components namespace + - Dnn.PersonaBar.TaskScheduler.Components.Prompt.Commands namespace + - Dnn.PersonaBar.TaskScheduler.Components.Prompt.Models namespace + - Dnn.PersonaBar.TaskScheduler.MenuControllers namespace + - 7,405,000 to 7,409,999 + - Dnn.PersonaBar.TaskScheduler.Services namespace + - Dnn.PersonaBar.TaskScheduler.Services.Dto namespace + - 7,410,000 to 7,414,999 + - Dnn.PersonaBar.Themes.Components namespace + - Dnn.PersonaBar.Themes.Components.DTO namespace + - Dnn.PersonaBar.Themes.MenuControllers namespace + - 7,415,000 to 7,419,999 + - Dnn.PersonaBar.Themes.Services namespace + - 7,420,000 to 7,424,999 + - Dnn.PersonaBar.Users.Components namespace + - Dnn.PersonaBar.Users.Components.Contracts namespace + - Dnn.PersonaBar.Users.Components.Dto namespace + - Dnn.PersonaBar.Users.Components.Helpers namespace + - Dnn.PersonaBar.Users.Components.Prompt namespace + - Dnn.PersonaBar.Users.Components.Prompt.Commands namespace + - Dnn.PersonaBar.Users.Components.Prompt.Models namespace + - Dnn.PersonaBar.Users.Data namespace + - 7,425,000 to 7,429,999 + - Dnn.PersonaBar.Users.Services namespace + - 7,430,000 to 7,434,999 + - Dnn.PersonaBar.Vocabularies.Components namespace + - Dnn.PersonaBar.Vocabularies.Exceptions namespace + - 7,435,000 to 7,439,999 + - Dnn.PersonaBar.Vocabularies.Services namespace + - Dnn.PersonaBar.Vocabularies.Services.Dto namespace + - Dnn.PersonaBar.Vocabularies.Validators namespace + */ + + // Dnn.PersonaBar.AdminLogs.Services.AdminLogsController (7,205,000 to 7,205,099) + [LoggerMessage(EventId = 7_205_000, Level = LogLevel.Error)] + public static partial void AdminLogsControllerGetLogTypesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_205_001, Level = LogLevel.Error)] + public static partial void AdminLogsControllerGetLogItemsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_205_002, Level = LogLevel.Error)] + public static partial void AdminLogsControllerDeleteLogItemsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_205_003, Level = LogLevel.Error)] + public static partial void AdminLogsControllerEmailLogItemsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_205_004, Level = LogLevel.Error)] + public static partial void AdminLogsControllerClearLogException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_205_005, Level = LogLevel.Error)] + public static partial void AdminLogsControllerGetKeepMostRecentOptionsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_205_006, Level = LogLevel.Error)] + public static partial void AdminLogsControllerGetOccurrenceOptionsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_205_007, Level = LogLevel.Error)] + public static partial void AdminLogsControllerGetLogSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_205_008, Level = LogLevel.Error)] + public static partial void AdminLogsControllerGetLogSettingException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_205_008, Level = LogLevel.Error)] + public static partial void AdminLogsControllerAddLogSettingException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_205_009, Level = LogLevel.Error)] + public static partial void AdminLogsControllerUpdateLogSettingException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_205_010, Level = LogLevel.Error)] + public static partial void AdminLogsControllerDeleteLogSettingException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_205_011, Level = LogLevel.Error)] + public static partial void AdminLogsControllerGetLatestLogSettingException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.ConfigConsole.Services.ConfigConsoleController (7,215,000 to 7,215,099) + [LoggerMessage(EventId = 7_215_000, Level = LogLevel.Error)] + public static partial void ConfigConsoleControllerGetConfigFilesListException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_215_001, Level = LogLevel.Error)] + public static partial void ConfigConsoleControllerGetConfigFileException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_215_002, Level = LogLevel.Error)] + public static partial void ConfigConsoleControllerValidateConfigFileException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_215_003, Level = LogLevel.Error)] + public static partial void ConfigConsoleControllerUpdateConfigFileException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_215_004, Level = LogLevel.Error)] + public static partial void ConfigConsoleControllerMergeConfigFileException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_215_005, Level = LogLevel.Error)] + public static partial void ConfigConsoleControllerSaveNonConfigFileIOException(this ILogger logger, IOException exception); + + [LoggerMessage(EventId = 7_215_005, Level = LogLevel.Error)] + public static partial void ConfigConsoleControllerSaveNonConfigFileGeneralException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Connectors.Services.ConnectorsController (7,225,000 to 7,225,099) + [LoggerMessage(EventId = 7_225_100, Level = LogLevel.Warning)] + public static partial void ConnectorsControllerSaveConnectionConnectorArgumentException(this ILogger logger, ConnectorArgumentException exception); + + [LoggerMessage(EventId = 7_225_101, Level = LogLevel.Error)] + public static partial void ConnectorsControllerSaveConnectionGeneralException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_225_102, Level = LogLevel.Error)] + public static partial void ConnectorsControllerDeleteConnectionException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_225_103, Level = LogLevel.Error)] + public static partial void ConnectorsControllerGetConnectionLocalizedStringException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.CssEditor.Services.CssEditorController (7,245,000 to 7,245,099) + [LoggerMessage(EventId = 7_245_000, Level = LogLevel.Error)] + public static partial void CssEditorControllerGetStyleSheetException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_245_001, Level = LogLevel.Error)] + public static partial void CssEditorControllerUpdateStyleSheetException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_245_002, Level = LogLevel.Error)] + public static partial void CssEditorControllerRestoreStyleSheetException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Extensions.Components.Editors.SkinPackageEditor (7,250,000 to 7,250,099) + [LoggerMessage(EventId = 7_250_000, Level = LogLevel.Error)] + public static partial void SkinPackageEditorSavePackageSettingsException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Extensions.Components.InstallController (7,250,100 to 7,250,199) + [LoggerMessage(EventId = 7_250_100, Level = LogLevel.Error)] + public static partial void InstallControllerDeleteTempInstallFilesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_250_100, Level = LogLevel.Error)] + public static partial void InstallControllerDeleteInstallFileException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_250_101, Level = LogLevel.Error)] + public static partial void InstallControllerReadAzureCompatibleException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Extensions.Components.Editors.SkinObjectPackageEditor (7,250,200 to 7,250,299) + [LoggerMessage(EventId = 7_250_200, Level = LogLevel.Error)] + public static partial void SkinObjectPackageEditorSavePackageSettingsException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Extensions.Components.Editors.ModulePackageEditor (7,250,300 to 7,250,399) + [LoggerMessage(EventId = 7_250_300, Level = LogLevel.Error)] + public static partial void ModulePackageEditorSavePackageSettingsException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Extensions.Components.Editors.JsLibraryPackageEditor (7,250,400 to 7,250,499) + [LoggerMessage(EventId = 7_250_400, Level = LogLevel.Error)] + public static partial void JsLibraryPackageEditorSavePackageSettingsException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Extensions.Components.Editors.ExtensionLanguagePackageEditor (7,250,500 to 7,250,599) + [LoggerMessage(EventId = 7_250_500, Level = LogLevel.Error)] + public static partial void ExtensionLanguagePackageEditorSavePackageSettingsException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Extensions.Components.Editors.AuthSystemPackageEditor (7,250,600 to 7,250,699) + [LoggerMessage(EventId = 7_250_600, Level = LogLevel.Error)] + public static partial void AuthSystemPackageEditorSavePackageSettingsException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Extensions.Components.Editors.CoreLanguagePackageEditor (7,250,700 to 7,250,799) + [LoggerMessage(EventId = 7_250_700, Level = LogLevel.Error)] + public static partial void CoreLanguagePackageEditorSavePackageSettingsException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Extensions.Services.UpgradesController (7,255,000 to 7,255,099) + [LoggerMessage(EventId = 7_255_000, Level = LogLevel.Error)] + public static partial void UpgradesControllerDeleteException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_255_001, Level = LogLevel.Error)] + public static partial void UpgradesControllerUploadException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Extensions.Services.ExtensionsController (7,255,100 to 7,255,199) + [LoggerMessage(EventId = 7_255_100, Level = LogLevel.Error)] + public static partial void ExtensionsControllerGetPackageTypesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_255_101, Level = LogLevel.Error)] + public static partial void ExtensionsControllerGetAllPackagesListExceptLangPacksException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_255_102, Level = LogLevel.Error)] + public static partial void ExtensionsControllerGetInstalledPackagesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_255_103, Level = LogLevel.Error)] + public static partial void ExtensionsControllerGetAvailablePackagesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_255_104, Level = LogLevel.Error)] + public static partial void ExtensionsControllerGetPackageSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_255_105, Level = LogLevel.Error)] + public static partial void ExtensionsControllerSavePackageSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_255_106, Level = LogLevel.Error)] + public static partial void ExtensionsControllerGetAvailableControlsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_255_107, Level = LogLevel.Error)] + public static partial void ExtensionsControllerDeletePackageException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_255_108, Level = LogLevel.Error)] + public static partial void ExtensionsControllerInstallPackageException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_255_109, Level = LogLevel.Error)] + public static partial void ExtensionsControllerParsePackageException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_255_110, Level = LogLevel.Error)] + public static partial void ExtensionsControllerParsePackageFileException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_255_111, Level = LogLevel.Error)] + public static partial void ExtensionsControllerParseLanguagePackageException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_255_112, Level = LogLevel.Error)] + public static partial void ExtensionsControllerInstallAvailablePackageException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_255_113, Level = LogLevel.Error)] + public static partial void ExtensionsControllerDownloadPackageException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_255_114, Level = LogLevel.Error)] + public static partial void ExtensionsControllerDownloadLanguagePackageException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_255_115, Level = LogLevel.Error)] + public static partial void ExtensionsControllerGetPackageUsageFilterException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_255_116, Level = LogLevel.Error)] + public static partial void ExtensionsControllerGetPackageUsageException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_255_117, Level = LogLevel.Error)] + public static partial void ExtensionsControllerCreateExtensionException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_255_118, Level = LogLevel.Error)] + public static partial void ExtensionsControllerGetOwnerFoldersException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_255_119, Level = LogLevel.Error)] + public static partial void ExtensionsControllerGetModuleFoldersException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_255_120, Level = LogLevel.Error)] + public static partial void ExtensionsControllerGetModuleFilesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_255_121, Level = LogLevel.Error)] + public static partial void ExtensionsControllerCreateFolderException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_255_122, Level = LogLevel.Error)] + public static partial void ExtensionsControllerCreateModuleException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_255_123, Level = LogLevel.Error)] + public static partial void ExtensionsControllerGetPackageManifestException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_255_124, Level = LogLevel.Error)] + public static partial void ExtensionsControllerCreateManifestException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_255_125, Level = LogLevel.Error)] + public static partial void ExtensionsControllerCreateNewManifestException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_255_126, Level = LogLevel.Error)] + public static partial void ExtensionsControllerCreatePackageException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_255_127, Level = LogLevel.Error)] + public static partial void ExtensionsControllerRefreshPackageFilesException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Licensing.Services.LicensingController (7,265,000 to 7,265,099) + [LoggerMessage(EventId = 7_265_000, Level = LogLevel.Error)] + public static partial void LicensingControllerGetProductException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Pages.Services.PagesController (7,275,000 to 7,275,099) + [LoggerMessage(EventId = 7_275_000, Level = LogLevel.Error, Message = "An unexpected error occurred while trying to make this page neutral, please consult the logs for more details.")] + public static partial void PagesControllerUnexpectedErrorMakingPageNeutral(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_275_001, Level = LogLevel.Error, Message = "An unexpected error occurred while trying to make this page translatable.")] + public static partial void PagesControllerUnexpectedErrorMakingPageTranslatable(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_275_002, Level = LogLevel.Error, Message = "An unexpected error occurred while trying to add missing languages to this page, consult the logs for more details.")] + public static partial void PagesControllerUnexpectedErrorAddingMissingLanguagesToPage(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_275_003, Level = LogLevel.Error, Message = "An unexpected error occurred while trying to notify the translators, please consult the logs for more details.")] + public static partial void PagesControllerUnexpectedErrorNotifyingTranslators(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_275_004, Level = LogLevel.Error, Message = "An unexpected error occurred trying to get this page localization, consult the logs for more details.")] + public static partial void PagesControllerUnexpectedErrorGettingPageLocalization(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_275_005, Level = LogLevel.Error, Message = "An unexpected error occurred trying to update the page localization, please consult the logs for more details.")] + public static partial void PagesControllerUnexpectedErrorUpdatingPageLocalization(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_275_006, Level = LogLevel.Error, Message = "An unexpected error occurred while trying to restore the module onto that page.")] + public static partial void PagesControllerUnexpectedErrorRestoringModuleOntoPage(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_275_007, Level = LogLevel.Error, Message = "An unexpected error occurred while trying to delete the module, consult the logs for more details.")] + public static partial void PagesControllerUnexpectedErrorDeletingModule(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_275_008, Level = LogLevel.Error, Message = "An unexpected error occurred while trying to find if content localization is enabled")] + public static partial void PagesControllerUnexpectedErrorGettingContentLocalizationEnabled(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_275_009, Level = LogLevel.Error, Message = "An unexpected error occurred trying to get the cached items count, please consult the logs for more details.")] + public static partial void PagesControllerUnexpectedErrorGettingCachedItemsCount(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_275_010, Level = LogLevel.Error, Message = "An unexpected error occurred while trying to clear the cache for this page, see logs for more details.")] + public static partial void PagesControllerUnexpectedErrorClearingCacheForPage(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Prompt.Components.Commands.Portal.ClearLog (7,280,000 to 7,280,099) + [LoggerMessage(EventId = 7_280_000, Level = LogLevel.Error)] + public static partial void ClearLogRunException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Prompt.Components.Commands.Host.ClearCache (7,280,100 to 7,280,199) + [LoggerMessage(EventId = 7_280_100, Level = LogLevel.Error)] + public static partial void ClearCacheRunException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Prompt.Components.Commands.Commands.ListCommands (7,280,200 to 7,280,299) + [LoggerMessage(EventId = 7_280_200, Level = LogLevel.Error)] + public static partial void ListCommandsRunException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Prompt.Components.Commands.Application.RestartApplication (7,280,300 to 7,280,399) + [LoggerMessage(EventId = 7_280_300, Level = LogLevel.Error)] + public static partial void RestartApplicationRunException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Roles.Components.Prompt.Commands.SetRole (7,280,400 to 7,280,499) + [LoggerMessage(EventId = 7_280_400, Level = LogLevel.Error)] + public static partial void SetRoleRunSetRoleException(this ILogger logger, SetRoleException exception); + + [LoggerMessage(EventId = 7_280_401, Level = LogLevel.Error)] + public static partial void SetRoleRunGeneralException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Roles.Components.Prompt.Commands.NewRole (7,280,500 to 7,280,599) + [LoggerMessage(EventId = 7_280_500, Level = LogLevel.Error)] + public static partial void NewRoleRunException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Roles.Components.Prompt.Commands.ListRoles (7,280,600 to 7,280,699) + [LoggerMessage(EventId = 7_280_600, Level = LogLevel.Error)] + public static partial void ListRolesRunException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Roles.Components.Prompt.Commands.DeleteRole (7,280,700 to 7,280,799) + [LoggerMessage(EventId = 7_280_700, Level = LogLevel.Error)] + public static partial void DeleteRoleRunException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.TaskScheduler.Components.Prompt.Commands.SetTask (7,280,800 to 7,280,899) + [LoggerMessage(EventId = 7_280_800, Level = LogLevel.Error)] + public static partial void SetTaskRunException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.TaskScheduler.Components.Prompt.Commands.GetTask (7,280,900 to 7,280,999) + [LoggerMessage(EventId = 7_280_900, Level = LogLevel.Error)] + public static partial void GetTaskRunException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Prompt.Components.ModulesController (7,281,000 to 7,281,099) + [LoggerMessage(EventId = 7_281_000, Level = LogLevel.Error)] + public static partial void ModulesControllerCopyModuleException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_281_001, Level = LogLevel.Error)] + public static partial void ModulesControllerDeleteModuleException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Prompt.Services.CommandController (7,285,000 to 7,285,099) + [LoggerMessage(EventId = 7_285_000, Level = LogLevel.Error)] + public static partial void CommandControllerCmdException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_285_001, Level = LogLevel.Error)] + public static partial void CommandControllerTryRunOldCommandException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_285_002, Level = LogLevel.Error)] + public static partial void CommandControllerTryRunNewCommandException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_285_003, Level = LogLevel.Error, Message = "{Message}")] + public static partial void CommandControllerCmdPortalNotFound(this ILogger logger, string message); + + // Dnn.PersonaBar.Recyclebin.Components.RecyclebinController (7,290,000 to 7,290,099) + [LoggerMessage(EventId = 7_290_000, Level = LogLevel.Error)] + public static partial void RecyclebinControllerDeleteModuleForTabException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_290_001, Level = LogLevel.Error)] + public static partial void RecyclebinControllerHardDeleteModuleException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Roles.Services.RolesController (7,305,000 to 7,305,099) + [LoggerMessage(EventId = 7_305_000, Level = LogLevel.Error)] + public static partial void RolesControllerGetRolesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_305_001, Level = LogLevel.Error)] + public static partial void RolesControllerSaveRoleException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_305_002, Level = LogLevel.Error)] + public static partial void RolesControllerGetRoleGroupsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_305_003, Level = LogLevel.Error)] + public static partial void RolesControllerSaveRoleGroupException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_305_004, Level = LogLevel.Error)] + public static partial void RolesControllerDeleteRoleGroupException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_305_005, Level = LogLevel.Error)] + public static partial void RolesControllerGetRoleUsersException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_305_006, Level = LogLevel.Error)] + public static partial void RolesControllerAddUserToRoleException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_305_007, Level = LogLevel.Error)] + public static partial void RolesControllerRemoveUserFromRoleException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Security.Components.Checks.BaseCheck (7,310,000 to 7,310,099) + [LoggerMessage(EventId = 7_310_000, Level = LogLevel.Error, Message = "{ID} failed")] + public static partial void BaseCheckFailed(this ILogger logger, Exception exception, string id); + + // Dnn.PersonaBar.Security.Services.SecurityController (7,315,000 to 7,315,099) + [LoggerMessage(EventId = 7_315_000, Level = LogLevel.Information)] + public static partial void SecurityControllerUpdateIpFilterArgumentException(this ILogger logger, ArgumentException exception); + + [LoggerMessage(EventId = 7_315_001, Level = LogLevel.Error)] + public static partial void SecurityControllerGetBasicLoginSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_315_002, Level = LogLevel.Error)] + public static partial void SecurityControllerUpdateBasicLoginSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_315_003, Level = LogLevel.Error)] + public static partial void SecurityControllerGetIpFiltersException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_315_004, Level = LogLevel.Error)] + public static partial void SecurityControllerGetIpFilterException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_315_005, Level = LogLevel.Error)] + public static partial void SecurityControllerUpdateIpFilterException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_315_006, Level = LogLevel.Error)] + public static partial void SecurityControllerDeleteIpFilterException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_315_007, Level = LogLevel.Error)] + public static partial void SecurityControllerGetMemberSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_315_008, Level = LogLevel.Error)] + public static partial void SecurityControllerUpdateMemberSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_315_009, Level = LogLevel.Error)] + public static partial void SecurityControllerGetRegistrationSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_315_010, Level = LogLevel.Error)] + public static partial void SecurityControllerGetSslSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_315_011, Level = LogLevel.Error)] + public static partial void SecurityControllerUpdateRegistrationSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_315_012, Level = LogLevel.Error)] + public static partial void SecurityControllerUpdateSslSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_315_012, Level = LogLevel.Error)] + public static partial void SecurityControllerSetAllPagesSecureException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_315_013, Level = LogLevel.Error)] + public static partial void SecurityControllerGetSecurityBulletinsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_315_014, Level = LogLevel.Error)] + public static partial void SecurityControllerGetOtherSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_315_015, Level = LogLevel.Error)] + public static partial void SecurityControllerUpdateOtherSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_315_015, Level = LogLevel.Error)] + public static partial void SecurityControllerGetAuditCheckResultsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_315_016, Level = LogLevel.Error)] + public static partial void SecurityControllerGetAuditCheckResultException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_315_017, Level = LogLevel.Error)] + public static partial void SecurityControllerGetSuperuserActivitiesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_315_018, Level = LogLevel.Error)] + public static partial void SecurityControllerSearchFileSystemAndDatabaseException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_315_019, Level = LogLevel.Error)] + public static partial void SecurityControllerGetLastModifiedFilesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_315_020, Level = LogLevel.Error)] + public static partial void SecurityControllerGetLastModifiedSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_315_021, Level = LogLevel.Error)] + public static partial void SecurityControllerGetApiTokenSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_315_022, Level = LogLevel.Error)] + public static partial void SecurityControllerUpdateApiTokenSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_315_023, Level = LogLevel.Error)] + public static partial void SecurityControllerGetCspSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_315_024, Level = LogLevel.Error)] + public static partial void SecurityControllerUpdateCspSettingsException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Seo.Services.SeoController (7,325,000 to 7,325,099) + [LoggerMessage(EventId = 7_325_000, Level = LogLevel.Error)] + public static partial void SeoControllerGetGeneralSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_325_001, Level = LogLevel.Error)] + public static partial void SeoControllerUpdateGeneralSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_325_002, Level = LogLevel.Error)] + public static partial void SeoControllerGetRegexSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_325_003, Level = LogLevel.Error)] + public static partial void SeoControllerUpdateRegexSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_325_004, Level = LogLevel.Error)] + public static partial void SeoControllerGetSitemapSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_325_005, Level = LogLevel.Error)] + public static partial void SeoControllerCreateVerificationException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_325_006, Level = LogLevel.Error)] + public static partial void SeoControllerUpdateSitemapSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_325_007, Level = LogLevel.Error)] + public static partial void SeoControllerResetCacheException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_325_008, Level = LogLevel.Error)] + public static partial void SeoControllerGetSitemapProvidersException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_325_009, Level = LogLevel.Error)] + public static partial void SeoControllerUpdateSitemapProviderException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_325_010, Level = LogLevel.Error)] + public static partial void SeoControllerGetExtensionUrlProvidersException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_325_011, Level = LogLevel.Error)] + public static partial void SeoControllerUpdateExtensionUrlProviderStatusException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_325_012, Level = LogLevel.Error)] + public static partial void SeoControllerTestUrlException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_325_013, Level = LogLevel.Error)] + public static partial void SeoControllerTestUrlRewriteException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Servers.Services.SystemInfoWebController (7,335,000 to 7,335,099) + [LoggerMessage(EventId = 7_335_000, Level = LogLevel.Error)] + public static partial void SystemInfoWebControllerGetWebServerInfoException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Servers.Services.SystemInfoServersController (7,335,100 to 7,335,199) + [LoggerMessage(EventId = 7_335_100, Level = LogLevel.Error)] + public static partial void SystemInfoServersControllerGetServersException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_335_101, Level = LogLevel.Error)] + public static partial void SystemInfoServersControllerDeleteServerException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_335_102, Level = LogLevel.Error)] + public static partial void SystemInfoServersControllerEditServerUrlException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_335_103, Level = LogLevel.Error)] + public static partial void SystemInfoServersControllerDeleteNonActiveServersException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Servers.Services.SystemInfoDatabaseController (7,335,200 to 7,335,299) + [LoggerMessage(EventId = 7_335_200, Level = LogLevel.Error)] + public static partial void SystemInfoDatabaseControllerGetDatabaseServerInfoException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Servers.Services.SystemInfoApplicationHostController (7,335,300 to 7,335,399) + [LoggerMessage(EventId = 7_335_300, Level = LogLevel.Error)] + public static partial void SystemInfoApplicationHostControllerGetApplicationInfoException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Servers.Services.SystemInfoApplicationAdminController (7,335,400 to 7,335,499) + [LoggerMessage(EventId = 7_335_400, Level = LogLevel.Error)] + public static partial void SystemInfoApplicationAdminControllerGetApplicationInfoException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Servers.Services.ServerController (7,335,500 to 7,335,599) + [LoggerMessage(EventId = 7_335_500, Level = LogLevel.Error)] + public static partial void ServerControllerRestartApplicationException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_335_501, Level = LogLevel.Error)] + public static partial void ServerControllerClearCacheException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Servers.Services.ServerSettingsLogsController (7,335,600 to 7,335,699) + [LoggerMessage(EventId = 7_335_600, Level = LogLevel.Error)] + public static partial void ServerSettingsLogsControllerGetLogsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_335_601, Level = LogLevel.Error)] + public static partial void ServerSettingsLogsControllerGetLogFileException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_335_602, Level = LogLevel.Error)] + public static partial void ServerSettingsLogsControllerGetUpgradeLogFileException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Servers.Services.ServerSettingsPerformanceController (7,335,700 to 7,335,799) + [LoggerMessage(EventId = 7_335_700, Level = LogLevel.Error)] + public static partial void ServerSettingsPerformanceControllerGetPerformanceSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_335_701, Level = LogLevel.Error)] + public static partial void ServerSettingsPerformanceControllerIncrementPortalVersionException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_335_702, Level = LogLevel.Error)] + public static partial void ServerSettingsPerformanceControllerIncrementHostVersionException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_335_703, Level = LogLevel.Error)] + public static partial void ServerSettingsPerformanceControllerUpdatePerformanceSettingsException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Servers.Services.ServerSettingsSmtpAdminController (7,335,800 to 7,335,899) + [LoggerMessage(EventId = 7_335_800, Level = LogLevel.Error)] + public static partial void ServerSettingsSmtpAdminControllerGetSmtpSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_335_801, Level = LogLevel.Error)] + public static partial void ServerSettingsSmtpAdminControllerUpdateSmtpSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_335_802, Level = LogLevel.Error)] + public static partial void ServerSettingsSmtpAdminControllerSendTestEmailException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_335_803, Level = LogLevel.Error)] + public static partial void ServerSettingsSmtpAdminControllerGetSmtpOAuthProvidersException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Servers.Services.ServerSettingsSmtpHostController (7,335,900 to 7,335,999) + [LoggerMessage(EventId = 7_335_900, Level = LogLevel.Error)] + public static partial void ServerSettingsSmtpHostControllerGetSmtpSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_335_901, Level = LogLevel.Error)] + public static partial void ServerSettingsSmtpHostControllerUpdateSmtpSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_335_902, Level = LogLevel.Error)] + public static partial void ServerSettingsSmtpHostControllerSendTestEmailException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_335_903, Level = LogLevel.Error)] + public static partial void ServerSettingsSmtpHostControllerGetSmtpOAuthProvidersException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.SiteGroups.Services.SiteGroupsController (7,340,000 to 7,340,099) + [LoggerMessage(EventId = 7_340_000, Level = LogLevel.Error)] + public static partial void SiteGroupsControllerSaveException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_340_001, Level = LogLevel.Error)] + public static partial void SiteGroupsControllerDeleteException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Sites.Components.SitesController (7,360,000 to 7,360,099) + [LoggerMessage(EventId = 7_360_000, Level = LogLevel.Error)] + public static partial void ComponentsSitesControllerCreatePortalException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_360_001, Level = LogLevel.Error)] + public static partial void ComponentsSitesControllerSendMailException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_360_002, Level = LogLevel.Error)] + public static partial void ComponentsSitesControllerTryDeleteCreatingPortalException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Sites.Services.SitesController (7,365,000 to 7,365,099) + [LoggerMessage(EventId = 7_365_000, Level = LogLevel.Error)] + public static partial void SitesControllerGetPortalsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_365_001, Level = LogLevel.Error)] + public static partial void SitesControllerCreatePortalException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_365_002, Level = LogLevel.Error)] + public static partial void SitesControllerDeletePortalException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_365_003, Level = LogLevel.Error)] + public static partial void SitesControllerExportPortalTemplateException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_365_004, Level = LogLevel.Error)] + public static partial void SitesControllerGetPortalLocalesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_365_005, Level = LogLevel.Error)] + public static partial void SitesControllerDeleteExpiredPortalsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_365_006, Level = LogLevel.Error)] + public static partial void SitesControllerGetPortalTemplatesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_365_007, Level = LogLevel.Error)] + public static partial void SitesControllerRequiresQuestionAndAnswerException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.SiteSettings.Components.LanguagesControllerTasks (7,370,000 to 7,370,099) + [LoggerMessage(EventId = 7_370_000, Level = LogLevel.Error)] + public static partial void LanguageControllerTasksLocalizeSitePagesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_370_001, Level = LogLevel.Error)] + public static partial void LanguageControllerTasksLocalizeLanguagePagesException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.SiteSettings.Services.LanguagesController (7,375,000 to 7,375,099) + [LoggerMessage(EventId = 7_375_000, Level = LogLevel.Warning, Message = "{Message}")] + public static partial void LanguagesControllerObsolete(this ILogger logger, string message); + + [LoggerMessage(EventId = 7_375_001, Level = LogLevel.Error)] + public static partial void LanguagesControllerGetRootResourcesFoldersException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_002, Level = LogLevel.Error)] + public static partial void LanguagesControllerGetSubRootResourcesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_003, Level = LogLevel.Error)] + public static partial void LanguagesControllerGetResxEntriesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_004, Level = LogLevel.Error)] + public static partial void LanguagesControllerSaveResxEntriesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_005, Level = LogLevel.Error)] + public static partial void LanguagesControllerEnableLocalizedContentException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_006, Level = LogLevel.Error)] + public static partial void LanguagesControllerLocalizedContentException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_007, Level = LogLevel.Error)] + public static partial void LanguagesControllerGetLocalizationProgressException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_008, Level = LogLevel.Error)] + public static partial void LanguagesControllerDisableLocalizedContentException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_009, Level = LogLevel.Error)] + public static partial void LanguagesControllerMarkAllPagesTranslatedException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_010, Level = LogLevel.Error)] + public static partial void LanguagesControllerActivateLanguageException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_011, Level = LogLevel.Error)] + public static partial void LanguagesControllerPublishAllPagesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_012, Level = LogLevel.Error)] + public static partial void LanguagesControllerDeleteLanguagePagesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_013, Level = LogLevel.Error, Message = "{Message}")] + public static partial void LanguagesControllerLoadResourceException(this ILogger logger, Exception exception, string message); + + [LoggerMessage(EventId = 7_375_014, Level = LogLevel.Error)] + public static partial void LanguagesControllerGetTabsForTranslationException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.SiteSettings.Services.SiteSettingsController (7,375,100 to 7,375,199) + [LoggerMessage(EventId = 7_375_100, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerGetPortalSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_101, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerGetCultureListException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_102, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerUpdatePortalSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_103, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerGetDefaultPagesSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_104, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerUpdateDefaultPagesSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_105, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerGetMessagingSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_106, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerUpdateMessagingSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_107, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerGetProfileSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_108, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerUpdateProfileSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_109, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerGetProfilePropertiesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_110, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerGetProfilePropertyException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_111, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerGetProfilePropertyLocalizationException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_112, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerUpdateProfilePropertyLocalizationException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_113, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerAddProfilePropertyException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_114, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerUpdateProfilePropertyException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_115, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerUpdateProfilePropertyOrdersException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_116, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerDeleteProfilePropertyException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_117, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerGetUrlMappingSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_118, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerUpdateUrlMappingSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_119, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerGetSiteAliasesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_120, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerGetSiteAliasException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_121, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerAddSiteAliasException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_122, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerUpdateSiteAliasException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_123, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerDeleteSiteAliasException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_124, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerSetPrimarySiteAliasException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_125, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerGetListInfoException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_126, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerUpdateListEntryException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_127, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerDeleteListEntryException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_128, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerUpdateListEntryOrdersException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_129, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerGetPrivacySettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_130, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerUpdatePrivacySettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_131, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerResetTermsAgreementException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_132, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerGetBasicSearchSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_133, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerUpdateBasicSearchSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_134, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerCompactSearchIndexException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_135, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerHostSearchReindexException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_136, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerPortalSearchReindexException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_137, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerGetPortalsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_138, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerGetSynonymsGroupsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_139, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerAddSynonymsGroupException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_140, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerUpdateSynonymsGroupException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_141, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerDeleteSynonymsGroupException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_142, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerGetIgnoreWordsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_143, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerAddIgnoreWordsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_144, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerUpdateIgnoreWordsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_145, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerDeleteIgnoreWordsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_146, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerGetLanguageSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_147, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerUpdateLanguageSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_148, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerGetLanguagesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_149, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerGetLanguageException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_150, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerGetAllLanguagesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_151, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerAddLanguageException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_152, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerUpdateLanguageRolesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_153, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerUpdateLanguageException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_154, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerVerifyLanguageResourceFilesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_155, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerGetModuleListException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_156, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerCreateLanguagePackException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_157, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerGetTranslatorRolesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_158, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerGetTranslatorRoleGroupsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_159, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerGetOtherSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_375_160, Level = LogLevel.Error)] + public static partial void SiteSettingsControllerUpdateOtherSettingsException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.TaskScheduler.Components.TaskSchedulerController (7,400,000 to 7,400,099) + [LoggerMessage(EventId = 7_400_000, Level = LogLevel.Error)] + public static partial void ComponentsTaskSchedulerControllerGetScheduleItemsException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.TaskScheduler.Services.TaskSchedulerController (7,405,000 to 7,405,099) + [LoggerMessage(EventId = 7_405_000, Level = LogLevel.Error)] + public static partial void TaskSchedulerControllerGetServersException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_405_001, Level = LogLevel.Error)] + public static partial void TaskSchedulerControllerGetScheduleItemsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_405_002, Level = LogLevel.Error)] + public static partial void TaskSchedulerControllerGetSchedulerSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_405_003, Level = LogLevel.Error)] + public static partial void TaskSchedulerControllerUpdateSchedulerSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_405_004, Level = LogLevel.Error)] + public static partial void TaskSchedulerControllerGetScheduleItemHistoryException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_405_005, Level = LogLevel.Error)] + public static partial void TaskSchedulerControllerGetScheduleItemException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_405_006, Level = LogLevel.Error)] + public static partial void TaskSchedulerControllerCreateScheduleItemException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_405_007, Level = LogLevel.Error)] + public static partial void TaskSchedulerControllerUpdateScheduleItemException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_405_008, Level = LogLevel.Error)] + public static partial void TaskSchedulerControllerGetScheduleStatusException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_405_009, Level = LogLevel.Error)] + public static partial void TaskSchedulerControllerStartScheduleException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_405_010, Level = LogLevel.Error)] + public static partial void TaskSchedulerControllerStopScheduleException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_405_011, Level = LogLevel.Error)] + public static partial void TaskSchedulerControllerRunScheduleException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_405_012, Level = LogLevel.Error)] + public static partial void TaskSchedulerControllerDeleteScheduleException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Themes.Components.ThemesController (7,410,000 to 7,410,099) + [LoggerMessage(EventId = 7_410_000, Level = LogLevel.Error)] + public static partial void ComponentsThemesControllerUpdateManifestException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_410_001, Level = LogLevel.Error)] + public static partial void ComponentsThemesControllerCreateThumbnailException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Themes.Services.ThemesController (7,415,000 to 7,415,099) + [LoggerMessage(EventId = 7_415_000, Level = LogLevel.Error)] + public static partial void ThemesControllerGetCurrentThemeException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_415_001, Level = LogLevel.Error)] + public static partial void ThemesControllerGetThemesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_415_002, Level = LogLevel.Error)] + public static partial void ThemesControllerGetThemeFilesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_415_003, Level = LogLevel.Error)] + public static partial void ThemesControllerApplyThemeException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_415_004, Level = LogLevel.Error)] + public static partial void ThemesControllerApplyDefaultThemeException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_415_005, Level = LogLevel.Error)] + public static partial void ThemesControllerDeleteThemePackageException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_415_006, Level = LogLevel.Error)] + public static partial void ThemesControllerGetEditableTokensException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_415_007, Level = LogLevel.Error)] + public static partial void ThemesControllerGetEditableSettingsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_415_008, Level = LogLevel.Error)] + public static partial void ThemesControllerGetEditableValuesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_415_009, Level = LogLevel.Error)] + public static partial void ThemesControllerUpdateThemeException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_415_010, Level = LogLevel.Error)] + public static partial void ThemesControllerParseThemeException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_415_011, Level = LogLevel.Error)] + public static partial void ThemesControllerRestoreThemeException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Users.Components.UsersController (7,420,000 to 7,420,099) + [LoggerMessage(EventId = 7_420_000, Level = LogLevel.Error)] + public static partial void ComponentsUsersControllerChangePasswordMembershipPasswordException(this ILogger logger, MembershipPasswordException exception); + + [LoggerMessage(EventId = 7_420_001, Level = LogLevel.Error)] + public static partial void ComponentsUsersControllerChangePasswordInvalidPasswordException(this ILogger logger, InvalidPasswordException exception); + + [LoggerMessage(EventId = 7_420_002, Level = LogLevel.Error)] + public static partial void ComponentsUsersControllerChangePasswordGeneralException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Users.Services.UsersController (7,425,000 to 7,425,099) + [LoggerMessage(EventId = 7_425_000, Level = LogLevel.Error)] + public static partial void UsersControllerCreateUserException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_425_001, Level = LogLevel.Error)] + public static partial void UsersControllerGetUsersException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_425_002, Level = LogLevel.Error)] + public static partial void UsersControllerGetUserFiltersException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_425_003, Level = LogLevel.Error)] + public static partial void UsersControllerGetUserDetailException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_425_004, Level = LogLevel.Error)] + public static partial void UsersControllerChangePasswordInvalidPasswordException(this ILogger logger, InvalidPasswordException exception); + + [LoggerMessage(EventId = 7_425_005, Level = LogLevel.Error)] + public static partial void UsersControllerChangePasswordGeneralException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_425_006, Level = LogLevel.Error)] + public static partial void UsersControllerForceChangePasswordException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_425_007, Level = LogLevel.Error)] + public static partial void UsersControllerCreateResetTokenArgumentException(this ILogger logger, ArgumentException exception); + + [LoggerMessage(EventId = 7_425_008, Level = LogLevel.Error)] + public static partial void UsersControllerCreateResetTokenGeneralException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_425_009, Level = LogLevel.Error)] + public static partial void UsersControllerSendPasswordResetLinkException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_425_010, Level = LogLevel.Error)] + public static partial void UsersControllerUpdateAuthorizeStatusException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_425_011, Level = LogLevel.Error)] + public static partial void UsersControllerSoftDeleteUserException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_425_012, Level = LogLevel.Error)] + public static partial void UsersControllerHardDeleteUserException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_425_013, Level = LogLevel.Error)] + public static partial void UsersControllerRestoreDeletedUserException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_425_014, Level = LogLevel.Error)] + public static partial void UsersControllerUpdateSuperUserStatusException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_425_015, Level = LogLevel.Error)] + public static partial void UsersControllerUpdateUserBasicInfoSqlException(this ILogger logger, SqlException exception); + + [LoggerMessage(EventId = 7_425_016, Level = LogLevel.Error)] + public static partial void UsersControllerUpdateUserBasicInfoGeneralException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_425_017, Level = LogLevel.Error)] + public static partial void UsersControllerUnlockUserException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_425_018, Level = LogLevel.Error)] + public static partial void UsersControllerGetSuggestRolesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_425_019, Level = LogLevel.Error)] + public static partial void UsersControllerGetUserRolesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_425_020, Level = LogLevel.Error)] + public static partial void UsersControllerSaveUserRoleException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_425_021, Level = LogLevel.Error)] + public static partial void UsersControllerRemoveUserRoleException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Vocabularies.Services.VocabulariesController (7,435,000 to 7,435,099) + [LoggerMessage(EventId = 7_435_000, Level = LogLevel.Error)] + public static partial void VocabulariesControllerGetVocabulariesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_435_001, Level = LogLevel.Error)] + public static partial void VocabulariesControllerCreateVocabularyException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_435_002, Level = LogLevel.Error)] + public static partial void VocabulariesControllerUpdateVocabularyException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_435_003, Level = LogLevel.Error)] + public static partial void VocabulariesControllerDeleteVocabularyException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_435_004, Level = LogLevel.Error)] + public static partial void VocabulariesControllerGetTermsByVocabularyIdException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_435_005, Level = LogLevel.Error)] + public static partial void VocabulariesControllerGetTermException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_435_006, Level = LogLevel.Error)] + public static partial void VocabulariesControllerCreateTermException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_435_007, Level = LogLevel.Error)] + public static partial void VocabulariesControllerUpdateTermException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 7_435_008, Level = LogLevel.Error)] + public static partial void VocabulariesControllerDeleteTermException(this ILogger logger, Exception exception); +} diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/AdminLogsController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/AdminLogsController.cs index 96b036e286d..0127431b1b4 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/AdminLogsController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/AdminLogsController.cs @@ -67,7 +67,7 @@ public HttpResponseMessage GetLogTypes() } catch (Exception exc) { - Logger.Error(exc); + Logger.AdminLogsControllerGetLogTypesException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -117,7 +117,7 @@ public HttpResponseMessage GetLogItems(string logType, int pageSize, int pageInd } catch (Exception exc) { - Logger.Error(exc); + Logger.AdminLogsControllerGetLogItemsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -135,7 +135,7 @@ public HttpResponseMessage DeleteLogItems(IEnumerable logIds) { foreach (var logId in logIds) { - var objLogInfo = new LogInfo { LogGUID = logId }; + var objLogInfo = new LogInfo { LogGUID = logId, }; LogController.Instance.DeleteLog(objLogInfo); } @@ -143,7 +143,7 @@ public HttpResponseMessage DeleteLogItems(IEnumerable logIds) } catch (Exception exc) { - Logger.Error(exc); + Logger.AdminLogsControllerDeleteLogItemsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -166,7 +166,6 @@ public HttpResponseMessage EmailLogItems(EmailLogItemsRequest request) Localization.GetString("UnAuthorizedToSendLog", Components.Constants.LocalResourcesFile)); } - string error; var subject = request.Subject; var strFromEmailAddress = !string.IsNullOrEmpty(this.UserInfo.Email) ? this.UserInfo.Email : this.PortalSettings.Email; @@ -175,7 +174,7 @@ public HttpResponseMessage EmailLogItems(EmailLogItemsRequest request) subject = this.PortalSettings.PortalName + @" Exceptions"; } - string returnMsg = this.controller.EmailLogItems(subject, strFromEmailAddress, request.Email, request.Message, request.LogIds, out error); + string returnMsg = this.controller.EmailLogItems(subject, strFromEmailAddress, request.Email, request.Message, request.LogIds, out var error); return this.Request.CreateResponse(HttpStatusCode.OK, new { Success = string.IsNullOrEmpty(returnMsg) ? true : false, @@ -185,7 +184,7 @@ public HttpResponseMessage EmailLogItems(EmailLogItemsRequest request) } catch (Exception exc) { - Logger.Error(exc); + Logger.AdminLogsControllerEmailLogItemsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -205,7 +204,7 @@ public HttpResponseMessage ClearLog() } catch (Exception exc) { - Logger.Error(exc); + Logger.AdminLogsControllerClearLogException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -232,7 +231,7 @@ public HttpResponseMessage GetKeepMostRecentOptions() } catch (Exception exc) { - Logger.Error(exc); + Logger.AdminLogsControllerGetKeepMostRecentOptionsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -262,7 +261,7 @@ public HttpResponseMessage GetOccurrenceOptions() } catch (Exception exc) { - Logger.Error(exc); + Logger.AdminLogsControllerGetOccurrenceOptionsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -306,12 +305,12 @@ public HttpResponseMessage GetLogSettings() } catch (Exception exc) { - Logger.Error(exc); + Logger.AdminLogsControllerGetLogSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } - /// GET: api/AdminLogs/GetLogSettings + /// GET: api/AdminLogs/GetLogSetting /// Gets log type settings. /// The log type config ID. /// A response with the log setting info. @@ -322,8 +321,7 @@ public HttpResponseMessage GetLogSetting(string logTypeConfigId) try { var configInfo = this.controller.GetLogTypeConfig(logTypeConfigId); - int portalId; - if (!this.UserInfo.IsSuperUser && (!int.TryParse(configInfo.LogTypePortalID, out portalId) || portalId != this.PortalId)) + if (!this.UserInfo.IsSuperUser && (!int.TryParse(configInfo.LogTypePortalID, out var portalId) || portalId != this.PortalId)) { return this.Request.CreateResponse(HttpStatusCode.Unauthorized); } @@ -351,7 +349,7 @@ public HttpResponseMessage GetLogSetting(string logTypeConfigId) } catch (Exception exc) { - Logger.Error(exc); + Logger.AdminLogsControllerGetLogSettingException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -378,7 +376,7 @@ public HttpResponseMessage AddLogSetting([FromBody] UpdateLogSettingsRequest req } catch (Exception exc) { - Logger.Error(exc); + Logger.AdminLogsControllerAddLogSettingException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -396,12 +394,10 @@ public HttpResponseMessage UpdateLogSetting([FromBody] UpdateLogSettingsRequest { request.LogTypePortalID = this.UserInfo.IsSuperUser ? request.LogTypePortalID : this.PortalId.ToString(CultureInfo.InvariantCulture); - int requestPortalId; - int settingPortalId; var configInfo = this.controller.GetLogTypeConfig(request.ID); if (!this.UserInfo.IsSuperUser && - (!int.TryParse(configInfo.LogTypePortalID, out settingPortalId) || - !int.TryParse(request.LogTypePortalID, out requestPortalId) || requestPortalId != settingPortalId)) + (!int.TryParse(configInfo.LogTypePortalID, out var settingPortalId) || + !int.TryParse(request.LogTypePortalID, out var requestPortalId) || requestPortalId != settingPortalId)) { return this.Request.CreateResponse(HttpStatusCode.Unauthorized); } @@ -412,7 +408,7 @@ public HttpResponseMessage UpdateLogSetting([FromBody] UpdateLogSettingsRequest } catch (Exception exc) { - Logger.Error(exc); + Logger.AdminLogsControllerUpdateLogSettingException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -429,8 +425,7 @@ public HttpResponseMessage DeleteLogSetting(DeleteLogSettingsRequest request) try { var configInfo = this.controller.GetLogTypeConfig(request.LogTypeConfigId); - int portalId; - if (!this.UserInfo.IsSuperUser && (!int.TryParse(configInfo.LogTypePortalID, out portalId) || portalId != this.PortalId)) + if (!this.UserInfo.IsSuperUser && (!int.TryParse(configInfo.LogTypePortalID, out var portalId) || portalId != this.PortalId)) { return this.Request.CreateResponse(HttpStatusCode.Unauthorized); } @@ -438,11 +433,11 @@ public HttpResponseMessage DeleteLogSetting(DeleteLogSettingsRequest request) this.controller.DeleteLogTypeConfig(request.LogTypeConfigId); return this.Request.CreateResponse( HttpStatusCode.OK, - new { Success = true, LogSettingId = request.LogTypeConfigId }); + new { Success = true, LogSettingId = request.LogTypeConfigId, }); } catch (Exception exc) { - Logger.Error(exc); + Logger.AdminLogsControllerDeleteLogSettingException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -460,7 +455,6 @@ private HttpResponseMessage GetLatestLogSetting() if (configInfo != null) { - int portalId; return this.Request.CreateResponse(HttpStatusCode.OK, new { configInfo.ID, @@ -468,7 +462,7 @@ private HttpResponseMessage GetLatestLogSetting() configInfo.LogTypeFriendlyName, configInfo.LogTypeKey, LogTypePortalID = - int.TryParse(configInfo.LogTypePortalID, out portalId) ? portalId.ToString(CultureInfo.InvariantCulture) : "*", + int.TryParse(configInfo.LogTypePortalID, out var portalId) ? portalId.ToString(CultureInfo.InvariantCulture) : "*", LogTypePortalName = int.TryParse(configInfo.LogTypePortalID, out portalId) ? PortalController.Instance.GetPortal(portalId).PortalName @@ -487,7 +481,7 @@ private HttpResponseMessage GetLatestLogSetting() } catch (Exception exc) { - Logger.Error(exc); + Logger.AdminLogsControllerGetLatestLogSettingException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/CommandController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/CommandController.cs index 37eeb6390f5..3cbf0f0c0c3 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/CommandController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/CommandController.cs @@ -105,7 +105,7 @@ public HttpResponseMessage Cmd(int portalId, [FromBody] CommandInputModel comman if (portal == null) { var errorMessage = string.Format(CultureInfo.CurrentCulture, Localization.GetString("Prompt_GetPortal_NotFound", Constants.LocalResourcesFile), portalId); - Logger.Error(errorMessage); + Logger.CommandControllerCmdPortalNotFound(errorMessage); return this.AddLogAndReturnResponse(null, null, command, DateTime.Now, errorMessage); } @@ -183,7 +183,7 @@ public HttpResponseMessage Cmd([FromBody] CommandInputModel command) } catch (Exception ex) { - Logger.Error(ex); + Logger.CommandControllerCmdException(ex); return this.AddLogAndReturnResponse(null, null, command, startTime, ex.Message); } } @@ -239,7 +239,7 @@ private HttpResponseMessage TryRunOldCommand(CommandInputModel command, Type cmd } catch (Exception ex) { - Logger.Error(ex); + Logger.CommandControllerTryRunOldCommandException(ex); return this.AddLogAndReturnResponse(null, null, command, startTime, ex.Message); } } @@ -260,7 +260,7 @@ private HttpResponseMessage TryRunNewCommand(CommandInputModel command, IConsole } catch (Exception ex) { - Logger.Error(ex); + Logger.CommandControllerTryRunNewCommandException(ex); return this.AddLogAndReturnResponse(null, null, command, startTime, ex.Message); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ConfigConsoleController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ConfigConsoleController.cs index 88d2ab1713b..0fa804bcf21 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ConfigConsoleController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ConfigConsoleController.cs @@ -64,7 +64,7 @@ public async Task GetConfigFilesList() } catch (Exception exc) { - Logger.Error(exc); + Logger.ConfigConsoleControllerGetConfigFilesListException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -92,7 +92,7 @@ public async Task GetConfigFile(string fileName) } catch (Exception exc) { - Logger.Error(exc); + Logger.ConfigConsoleControllerGetConfigFileException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -119,7 +119,7 @@ public async Task ValidateConfigFile(ConfigFileDto configFi } catch (Exception exc) { - Logger.Error(exc); + Logger.ConfigConsoleControllerValidateConfigFileException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -143,7 +143,7 @@ public async Task UpdateConfigFile(ConfigFileDto configFile } catch (Exception exc) { - Logger.Error(exc); + Logger.ConfigConsoleControllerUpdateConfigFileException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -163,7 +163,7 @@ public HttpResponseMessage MergeConfigFile(ConfigFileDto configFileDto) } catch (Exception exc) { - Logger.Error(exc); + Logger.ConfigConsoleControllerMergeConfigFileException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ConnectorsController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ConnectorsController.cs index 2313a3264d7..48a719bbbf7 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ConnectorsController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ConnectorsController.cs @@ -139,13 +139,13 @@ public HttpResponseMessage SaveConnection(object postData) } catch (Exception ex) { - if (ex is ConnectorArgumentException) + if (ex is ConnectorArgumentException connectorArgumentException) { - Logger.Warn(ex); + Logger.ConnectorsControllerSaveConnectionConnectorArgumentException(connectorArgumentException); } else { - Logger.Error(ex); + Logger.ConnectorsControllerSaveConnectionGeneralException(ex); } return this.Request.CreateResponse( @@ -202,7 +202,7 @@ public HttpResponseMessage DeleteConnection(object postData) } catch (Exception ex) { - Logger.Error(ex); + Logger.ConnectorsControllerDeleteConnectionException(ex); return this.Request.CreateResponse( HttpStatusCode.InternalServerError, new { Success = false, Message = ex.Message }); @@ -233,7 +233,7 @@ public HttpResponseMessage GetConnectionLocalizedString(string name, string cult } catch (Exception ex) { - Logger.Error(ex); + Logger.ConnectorsControllerGetConnectionLocalizedStringException(ex); localizedStrings = new Dictionary(); } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/CssEditorController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/CssEditorController.cs index 2272b005c93..5b5c45fffe9 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/CssEditorController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/CssEditorController.cs @@ -31,7 +31,7 @@ public class CssEditorController : PersonaBarApiController /// GET: api/CssEditor/GetStyleSheet /// Gets portal.css of specific portal. - /// Id of portal. + /// ID of portal. /// Content of portal.css. [HttpGet] public HttpResponseMessage GetStyleSheet(int portalId) @@ -42,40 +42,36 @@ public HttpResponseMessage GetStyleSheet(int portalId) { throw new SecurityException("No Permission"); } - else - { - var activeLanguage = LocaleController.Instance.GetDefaultLocale(portalId).Code; - var portal = PortalController.Instance.GetPortal(portalId, activeLanguage); - string uploadDirectory = string.Empty; - string styleSheetContent = string.Empty; - if (portal != null) - { - uploadDirectory = portal.HomeDirectoryMapPath; - } + var activeLanguage = LocaleController.Instance.GetDefaultLocale(portalId).Code; + var portal = PortalController.Instance.GetPortal(portalId, activeLanguage); - // read CSS file - if (File.Exists(uploadDirectory + "portal.css")) - { - using (var text = File.OpenText(uploadDirectory + "portal.css")) - { - styleSheetContent = text.ReadToEnd(); - } - } + string uploadDirectory = string.Empty; + string styleSheetContent = string.Empty; + if (portal != null) + { + uploadDirectory = portal.HomeDirectoryMapPath; + } - return this.Request.CreateResponse(HttpStatusCode.OK, new { Content = styleSheetContent }); + // read CSS file + if (File.Exists(uploadDirectory + "portal.css")) + { + using var text = File.OpenText(uploadDirectory + "portal.css"); + styleSheetContent = text.ReadToEnd(); } + + return this.Request.CreateResponse(HttpStatusCode.OK, new { Content = styleSheetContent }); } catch (Exception exc) { - Logger.Error(exc); + Logger.CssEditorControllerGetStyleSheetException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } /// POST: api/CssEditor/UpdateStyleSheet /// Updates portal.css of specific portal. - /// Content of portal css. + /// Content of portal CSS. /// A response indicating success. [HttpPost] [ValidateAntiForgeryToken] @@ -85,109 +81,99 @@ public HttpResponseMessage UpdateStyleSheet(UpdateCssRequest request) { throw new SecurityException("No Permission"); } - else + + try { - try + string strUploadDirectory = string.Empty; + var relativePath = string.Empty; + + PortalInfo objPortal = PortalController.Instance.GetPortal(request.PortalId); + if (objPortal != null) { - string strUploadDirectory = string.Empty; - var relativePath = string.Empty; + strUploadDirectory = objPortal.HomeDirectoryMapPath; + relativePath = $"{Globals.ApplicationPath}/{objPortal.HomeDirectory}/portal.css"; + } - PortalInfo objPortal = PortalController.Instance.GetPortal(request.PortalId); - if (objPortal != null) - { - strUploadDirectory = objPortal.HomeDirectoryMapPath; - relativePath = $"{Globals.ApplicationPath}/{objPortal.HomeDirectory}/portal.css"; - } + // reset attributes + if (File.Exists(strUploadDirectory + "portal.css")) + { + File.SetAttributes(strUploadDirectory + "portal.css", FileAttributes.Normal); + } - // reset attributes - if (File.Exists(strUploadDirectory + "portal.css")) - { - File.SetAttributes(strUploadDirectory + "portal.css", FileAttributes.Normal); - } + // write CSS file + using (var writer = File.CreateText(strUploadDirectory + "portal.css")) + { + writer.WriteLine(request.StyleSheetContent); + } - // write CSS file - using (var writer = File.CreateText(strUploadDirectory + "portal.css")) + // Clear client resource cache + var overrideSetting = PortalController.GetPortalSetting(ClientResourceSettings.OverrideDefaultSettingsKey, request.PortalId, "False"); + if (bool.TryParse(overrideSetting, out var overridePortal)) + { + if (overridePortal) { - writer.WriteLine(request.StyleSheetContent); + // increment this portal version only + PortalController.IncrementCrmVersion(request.PortalId); } - - // Clear client resource cache - var overrideSetting = - PortalController.GetPortalSetting( - ClientResourceSettings.OverrideDefaultSettingsKey, - request.PortalId, - "False"); - bool overridePortal; - if (bool.TryParse(overrideSetting, out overridePortal)) + else { - if (overridePortal) - { - // increment this portal version only - PortalController.IncrementCrmVersion(request.PortalId); - } - else - { - // increment host version, do not increment other portal versions though. - HostController.Instance.IncrementCrmVersion(false); - } + // increment host version, do not increment other portal versions though. + HostController.Instance.IncrementCrmVersion(false); } + } - ClientResourceManager.ClearFileExistsCache(relativePath); + ClientResourceManager.ClearFileExistsCache(relativePath); - return this.Request.CreateResponse(HttpStatusCode.OK, new { Success = true, }); - } - catch (Exception exc) - { - Logger.Error(exc); - return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); - } + return this.Request.CreateResponse(HttpStatusCode.OK, new { Success = true, }); + } + catch (Exception exc) + { + Logger.CssEditorControllerUpdateStyleSheetException(exc); + return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } /// POST: api/CssEditor/RestoreStyleSheet /// Restores portal.css of specific portal. - /// Id of portal. + /// ID of portal. /// Content of portal.css. [HttpPost] [ValidateAntiForgeryToken] public HttpResponseMessage RestoreStyleSheet(RestoreCssRequest request) { - if (!PortalSettings.Current.UserInfo.IsSuperUser && - PortalSettings.Current.UserInfo.PortalID != request.PortalId) + if (!PortalSettings.Current.UserInfo.IsSuperUser && PortalSettings.Current.UserInfo.PortalID != request.PortalId) { throw new SecurityException("No Permission"); } - else + + try { - try + PortalInfo portal = PortalController.Instance.GetPortal(request.PortalId); + if (portal != null) { - PortalInfo portal = PortalController.Instance.GetPortal(request.PortalId); - if (portal != null) + if (File.Exists(portal.HomeDirectoryMapPath + "portal.css")) { - if (File.Exists(portal.HomeDirectoryMapPath + "portal.css")) - { - // delete existing style sheet - File.Delete(portal.HomeDirectoryMapPath + "portal.css"); - } - - // copy file from Host - if (File.Exists(Globals.HostMapPath + "portal.css")) - { - File.Copy(Globals.HostMapPath + "portal.css", portal.HomeDirectoryMapPath + "portal.css"); - } - - ClientResourceManager.ClearFileExistsCache($"{Globals.ApplicationPath}/{portal.HomeDirectory}/portal.css"); + // delete existing style sheet + File.Delete(portal.HomeDirectoryMapPath + "portal.css"); } - var content = LoadStyleSheet(request.PortalId); + // copy file from Host + if (File.Exists(Globals.HostMapPath + "portal.css")) + { + File.Copy(Globals.HostMapPath + "portal.css", portal.HomeDirectoryMapPath + "portal.css"); + } - return this.Request.CreateResponse(HttpStatusCode.OK, new { Success = true, StyleSheetContent = content }); - } - catch (Exception exc) - { - Logger.Error(exc); - return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); + ClientResourceManager.ClearFileExistsCache($"{Globals.ApplicationPath}/{portal.HomeDirectory}/portal.css"); } + + var content = LoadStyleSheet(request.PortalId); + + return this.Request.CreateResponse(HttpStatusCode.OK, new { Success = true, StyleSheetContent = content }); + } + catch (Exception exc) + { + Logger.CssEditorControllerRestoreStyleSheetException(exc); + return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ExtensionsController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ExtensionsController.cs index af13c41c532..cec1c1a3af0 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ExtensionsController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ExtensionsController.cs @@ -88,7 +88,7 @@ public HttpResponseMessage GetPackageTypes() } catch (Exception ex) { - Logger.Error(ex); + Logger.ExtensionsControllerGetPackageTypesException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -106,7 +106,7 @@ public HttpResponseMessage GetAllPackagesListExceptLangPacks() } catch (Exception ex) { - Logger.Error(ex); + Logger.ExtensionsControllerGetAllPackagesListExceptLangPacksException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -131,7 +131,7 @@ public HttpResponseMessage GetInstalledPackages(string packageType) } catch (Exception ex) { - Logger.Error(ex); + Logger.ExtensionsControllerGetInstalledPackagesException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -157,7 +157,7 @@ public HttpResponseMessage GetAvailablePackages(string packageType) } catch (Exception ex) { - Logger.Error(ex); + Logger.ExtensionsControllerGetAvailablePackagesException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -334,7 +334,7 @@ public HttpResponseMessage GetPackageSettings(int siteId, int packageId) } catch (Exception ex) { - Logger.Error(ex); + Logger.ExtensionsControllerGetPackageSettingsException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -406,7 +406,7 @@ public HttpResponseMessage SavePackageSettings(PackageSettingsDto packageSetting } catch (Exception ex) { - Logger.Error(ex); + Logger.ExtensionsControllerSavePackageSettingsException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -433,7 +433,7 @@ public HttpResponseMessage GetAvailableControls(int packageId) } catch (Exception ex) { - Logger.Error(ex); + Logger.ExtensionsControllerGetAvailableControlsException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -458,7 +458,7 @@ public HttpResponseMessage DeletePackage(DeletePackageDto deletePackage) } catch (Exception ex) { - Logger.Error(ex); + Logger.ExtensionsControllerDeletePackageException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -476,7 +476,7 @@ public Task InstallPackage([FromUri] string legacySkin = nu } catch (Exception ex) { - Logger.Error(ex); + Logger.ExtensionsControllerInstallPackageException(ex); return Task.FromResult(this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message)); } } @@ -494,7 +494,7 @@ public Task ParsePackage() } catch (Exception ex) { - Logger.Error(ex); + Logger.ExtensionsControllerParsePackageException(ex); return Task.FromResult(this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message)); } } @@ -523,7 +523,7 @@ public HttpResponseMessage ParsePackageFile(DownloadPackageDto package) } catch (Exception ex) { - Logger.Error(ex); + Logger.ExtensionsControllerParsePackageFileException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -543,7 +543,7 @@ public HttpResponseMessage ParseLanguagePackage([FromUri] string cultureCode) } catch (Exception ex) { - Logger.Error(ex); + Logger.ExtensionsControllerParseLanguagePackageException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -575,7 +575,7 @@ public HttpResponseMessage InstallAvailablePackage(DownloadPackageDto package) } catch (Exception ex) { - Logger.Error(ex); + Logger.ExtensionsControllerInstallAvailablePackageException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -617,7 +617,7 @@ public HttpResponseMessage DownloadPackage(string packageType, string fileName) } catch (Exception ex) { - Logger.Error(ex); + Logger.ExtensionsControllerDownloadPackageException(ex); return this.Request.CreateResponse(HttpStatusCode.InternalServerError, new { Error = ex.Message }); } } @@ -645,7 +645,7 @@ public HttpResponseMessage DownloadLanguagePackage([FromUri] string cultureCode) } catch (Exception ex) { - Logger.Error(ex); + Logger.ExtensionsControllerDownloadLanguagePackageException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -684,7 +684,7 @@ public HttpResponseMessage GetPackageUsageFilter() } catch (Exception exc) { - Logger.Error(exc); + Logger.ExtensionsControllerGetPackageUsageFilterException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -723,7 +723,7 @@ public HttpResponseMessage GetPackageUsage(int portalId, int packageId) } catch (Exception exc) { - Logger.Error(exc); + Logger.ExtensionsControllerGetPackageUsageException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -851,7 +851,7 @@ public HttpResponseMessage CreateExtension(PackageSettingsDto packageSettings) } catch (Exception ex) { - Logger.Error(ex); + Logger.ExtensionsControllerCreateExtensionException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -879,7 +879,7 @@ public HttpResponseMessage GetOwnerFolders() } catch (Exception ex) { - Logger.Error(ex); + Logger.ExtensionsControllerGetOwnerFoldersException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -908,7 +908,7 @@ public HttpResponseMessage GetModuleFolders(string ownerFolder) } catch (Exception ex) { - Logger.Error(ex); + Logger.ExtensionsControllerGetModuleFoldersException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -947,7 +947,7 @@ public HttpResponseMessage GetModuleFiles(string ownerFolder, string moduleFolde } catch (Exception ex) { - Logger.Error(ex); + Logger.ExtensionsControllerGetModuleFilesException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -990,7 +990,7 @@ public HttpResponseMessage CreateFolder([FromUri] string ownerFolder, [FromUri] } catch (Exception ex) { - Logger.Error(ex); + Logger.ExtensionsControllerCreateFolderException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -1022,7 +1022,7 @@ public HttpResponseMessage CreateModule(CreateModuleDto createModuleDto) } catch (Exception ex) { - Logger.Error(ex); + Logger.ExtensionsControllerCreateModuleException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -1128,7 +1128,7 @@ public HttpResponseMessage GetPackageManifest(int packageId) } catch (Exception ex) { - Logger.Error(ex); + Logger.ExtensionsControllerGetPackageManifestException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -1151,7 +1151,7 @@ public HttpResponseMessage CreateManifest(PackageManifestDto packageManifestDto) } catch (Exception ex) { - Logger.Error(ex); + Logger.ExtensionsControllerCreateManifestException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -1168,7 +1168,7 @@ public HttpResponseMessage CreateNewManifest(PackageManifestDto packageManifestD } catch (Exception ex) { - Logger.Error(ex); + Logger.ExtensionsControllerCreateNewManifestException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -1264,7 +1264,7 @@ public HttpResponseMessage CreatePackage(PackageManifestDto packageManifestDto) } catch (Exception ex) { - Logger.Error(ex); + Logger.ExtensionsControllerCreatePackageException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -1305,7 +1305,7 @@ public HttpResponseMessage RefreshPackageFiles(PackageFilesQueryDto packageData) } catch (Exception ex) { - Logger.Error(ex); + Logger.ExtensionsControllerRefreshPackageFilesException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/LanguagesController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/LanguagesController.cs index db632e7a548..54987d80174 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/LanguagesController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/LanguagesController.cs @@ -101,7 +101,7 @@ public HttpResponseMessage GetTabsForTranslation(int? portalId, string cultureCo } catch (Exception ex) { - Logger.Error(ex); + Logger.LanguagesControllerGetTabsForTranslationException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.ToString()); } } @@ -128,7 +128,7 @@ public HttpResponseMessage GetRootResourcesFolders() } catch (Exception ex) { - Logger.Error(ex); + Logger.LanguagesControllerGetRootResourcesFoldersException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.ToString()); } } @@ -198,7 +198,7 @@ public HttpResponseMessage GetSubRootResources(string currentFolder = null) } catch (Exception ex) { - Logger.Error(ex); + Logger.LanguagesControllerGetSubRootResourcesException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.ToString()); } } @@ -274,7 +274,7 @@ public HttpResponseMessage GetResxEntries(int? portalId, string mode, string loc if (toBeDeleted.Count > 0) { - Logger.Warn(LocalizeString("Obsolete")); + Logger.LanguagesControllerObsolete(LocalizeString("Obsolete")); foreach (string key in toBeDeleted) { editTable.Remove(key); @@ -308,7 +308,7 @@ public HttpResponseMessage GetResxEntries(int? portalId, string mode, string loc } catch (Exception ex) { - Logger.Error(ex); + Logger.LanguagesControllerGetResxEntriesException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.ToString()); } } @@ -366,7 +366,7 @@ public HttpResponseMessage SaveResxEntries(UpdateTransaltionsRequest request) } catch (Exception ex) { - Logger.Error(ex); + Logger.LanguagesControllerSaveResxEntriesException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.ToString()); } } @@ -393,7 +393,7 @@ public HttpResponseMessage EnableLocalizedContent([FromUri] int? portalId, [From } catch (Exception ex) { - Logger.Error(ex); + Logger.LanguagesControllerEnableLocalizedContentException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.ToString()); } } @@ -420,7 +420,7 @@ public HttpResponseMessage LocalizedContent([FromUri] int? portalId, [FromUri] s } catch (Exception ex) { - Logger.Error(ex); + Logger.LanguagesControllerLocalizedContentException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.ToString()); } } @@ -436,7 +436,7 @@ public HttpResponseMessage GetLocalizationProgress() } catch (Exception ex) { - Logger.Error(ex); + Logger.LanguagesControllerGetLocalizationProgressException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.ToString()); } } @@ -473,7 +473,7 @@ public HttpResponseMessage DisableLocalizedContent([FromUri] int? portalId) } catch (Exception ex) { - Logger.Error(ex); + Logger.LanguagesControllerDisableLocalizedContentException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.ToString()); } } @@ -517,7 +517,7 @@ from t in this.tabController.GetTabsByPortal(pid).WithCulture(locale.Code, false } catch (Exception ex) { - Logger.Error(ex); + Logger.LanguagesControllerMarkAllPagesTranslatedException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.ToString()); } } @@ -551,7 +551,7 @@ public HttpResponseMessage ActivateLanguage([FromUri] int? portalId, [FromUri] s } catch (Exception ex) { - Logger.Error(ex); + Logger.LanguagesControllerActivateLanguageException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.ToString()); } } @@ -585,7 +585,7 @@ public HttpResponseMessage PublishAllPages([FromUri] int? portalId, [FromUri] st } catch (Exception ex) { - Logger.Error(ex); + Logger.LanguagesControllerPublishAllPagesException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.ToString()); } } @@ -623,7 +623,7 @@ public HttpResponseMessage DeleteLanguagePages(int? portalId, string cultureCode } catch (Exception ex) { - Logger.Error(ex); + Logger.LanguagesControllerDeleteLanguagePagesException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.ToString()); } } @@ -707,7 +707,7 @@ private static void LoadResource(Hashtable ht, string filepath) } catch (Exception ex) { - Logger.Error(ex.Message); + Logger.LanguagesControllerLoadResourceException(ex, ex.Message); xmlLoaded = false; } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/LicensingController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/LicensingController.cs index 93108501b9e..7166f3452bc 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/LicensingController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/LicensingController.cs @@ -44,7 +44,7 @@ public HttpResponseMessage GetProduct() } catch (Exception exc) { - Logger.Error(exc); + Logger.LicensingControllerGetProductException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/PagesController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/PagesController.cs index 5be2bab1c5e..b25cbb08e17 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/PagesController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/PagesController.cs @@ -634,9 +634,8 @@ public HttpResponseMessage MakePageNeutral([FromUri] int pageId) } catch (Exception ex) { - var errorMessage = "An unexpected error occurred while trying to make this page neutral, please consult the logs for more details."; - Logger.Error(errorMessage, ex); - return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, errorMessage); + Logger.PagesControllerUnexpectedErrorMakingPageNeutral(ex); + return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "An unexpected error occurred while trying to make this page neutral, please consult the logs for more details."); } } @@ -670,9 +669,8 @@ public HttpResponseMessage MakePageTranslatable([FromUri] int pageId) } catch (Exception ex) { - var errorMessage = "An unexpected error occurred while trying to make this page translatable."; - Logger.Error(errorMessage, ex); - return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, errorMessage); + Logger.PagesControllerUnexpectedErrorMakingPageTranslatable(ex); + return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "An unexpected error occurred while trying to make this page translatable."); } } @@ -698,9 +696,8 @@ public HttpResponseMessage AddMissingLanguages([FromUri] int pageId) } catch (Exception ex) { - var errorMessage = "An unexpected error occurred while trying to add missing languages to this page, consult the logs for more details."; - Logger.Error(errorMessage, ex); - return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, errorMessage); + Logger.PagesControllerUnexpectedErrorAddingMissingLanguagesToPage(ex); + return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "An unexpected error occurred while trying to add missing languages to this page, consult the logs for more details."); } } @@ -741,9 +738,8 @@ public HttpResponseMessage NotifyTranslators(TranslatorsComment comment) } catch (Exception ex) { - var errorMessage = "An unexpected error occurred while trying to notify the translators, please consult the logs for more details."; - Logger.Error(errorMessage, ex); - return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, errorMessage); + Logger.PagesControllerUnexpectedErrorNotifyingTranslators(ex); + return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "An unexpected error occurred while trying to notify the translators, please consult the logs for more details."); } } @@ -776,9 +772,8 @@ public HttpResponseMessage GetTabLocalization(int pageId) } catch (Exception ex) { - var errorMessage = "An unexpected error occurrfed trying to get this page localization, consult the logs for more details."; - Logger.Error(errorMessage, ex); - return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, errorMessage); + Logger.PagesControllerUnexpectedErrorGettingPageLocalization(ex); + return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "An unexpected error occurred trying to get this page localization, consult the logs for more details."); } } @@ -803,9 +798,8 @@ public HttpResponseMessage UpdateTabLocalization(DnnPagesRequest request) } catch (Exception ex) { - var errorMessage = "An unexpected error occurred trying to update the page localization, please consult the logs for more details."; - Logger.Error(errorMessage, ex); - return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, errorMessage); + Logger.PagesControllerUnexpectedErrorUpdatingPageLocalization(ex); + return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "An unexpected error occurred trying to update the page localization, please consult the logs for more details."); } } @@ -838,9 +832,8 @@ public HttpResponseMessage RestoreModule(int tabModuleId) } catch (Exception ex) { - var errorMessage = "An unexpected error occurred while trying to restore the module onto that page."; - Logger.Error(errorMessage, ex); - return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, errorMessage); + Logger.PagesControllerUnexpectedErrorRestoringModuleOntoPage(ex); + return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "An unexpected error occurred while trying to restore the module onto that page."); } } @@ -873,9 +866,8 @@ public HttpResponseMessage DeleteModule(int tabModuleId) } catch (Exception ex) { - var errorMessage = "An unexpected error occurred while trying to delete the module, consult the logs for more details."; - Logger.Error(errorMessage, ex); - return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, errorMessage); + Logger.PagesControllerUnexpectedErrorDeletingModule(ex); + return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "An unexpected error occurred while trying to delete the module, consult the logs for more details."); } } @@ -896,9 +888,8 @@ public HttpResponseMessage GetContentLocalizationEnabled() } catch (Exception ex) { - var errorMessage = "An unexpected error occurred while trying to find if content localization is enabled"; - Logger.Error(errorMessage, ex); - return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, errorMessage); + Logger.PagesControllerUnexpectedErrorGettingContentLocalizationEnabled(ex); + return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "An unexpected error occurred while trying to find if content localization is enabled"); } } @@ -921,9 +912,8 @@ public HttpResponseMessage GetCachedItemCount(string cacheProvider, int pageId) } catch (Exception ex) { - var errorMessage = "An unexpected error occurred trying to get the cached items count, please consult the logs for more details."; - Logger.Error(errorMessage, ex); - return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, errorMessage); + Logger.PagesControllerUnexpectedErrorGettingCachedItemsCount(ex); + return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "An unexpected error occurred trying to get the cached items count, please consult the logs for more details."); } } @@ -949,9 +939,8 @@ public HttpResponseMessage ClearCache([FromUri] string cacheProvider, [FromUri] } catch (Exception ex) { - var message = "An unexpected error occurred while trying to clear the cache for this page, see logs for more details."; - Logger.Error(message, ex); - return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, message); + Logger.PagesControllerUnexpectedErrorClearingCacheForPage(ex); + return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "An unexpected error occurred while trying to clear the cache for this page, see logs for more details."); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/RolesController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/RolesController.cs index 52e479223b5..87cbdfac1e4 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/RolesController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/RolesController.cs @@ -38,8 +38,7 @@ public HttpResponseMessage GetRoles(int groupId, string keyword, int startIndex, { try { - int total; - var roles = Components.RolesController.Instance.GetRoles(this.PortalSettings, groupId, keyword, out total, startIndex, pageSize) + var roles = Components.RolesController.Instance.GetRoles(this.PortalSettings, groupId, keyword, out var total, startIndex, pageSize) .Select(RoleDto.FromRoleInfo); var loadMore = total > startIndex + pageSize; var rsvpLink = Globals.AddHTTP(Globals.GetDomainName(HttpContext.Current.Request)) + "/" + Globals.glbDefaultPage + "?portalid=" + this.PortalId; @@ -47,7 +46,7 @@ public HttpResponseMessage GetRoles(int groupId, string keyword, int startIndex, } catch (Exception ex) { - Logger.Error(ex); + Logger.RolesControllerGetRolesException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -75,7 +74,7 @@ public HttpResponseMessage SaveRole(RoleDto roleDto, [FromUri] bool assignExistU } catch (Exception ex) { - Logger.Error(ex); + Logger.RolesControllerSaveRoleException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -108,7 +107,7 @@ public HttpResponseMessage GetRoleGroups(bool reload = false) } catch (Exception ex) { - Logger.Error(ex); + Logger.RolesControllerGetRoleGroupsException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -163,7 +162,7 @@ public HttpResponseMessage SaveRoleGroup(RoleGroupDto roleGroupDto) } catch (Exception ex) { - Logger.Error(ex); + Logger.RolesControllerSaveRoleGroupException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -218,7 +217,7 @@ public HttpResponseMessage GetSuggestUsers(string keyword, int roleId, int count } catch (Exception ex) { - Logger.Error(ex); + Logger.RolesControllerDeleteRoleGroupException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -267,7 +266,7 @@ public HttpResponseMessage GetRoleUsers(string keyword, int roleId, int pageInde } catch (Exception ex) { - Logger.Error(ex); + Logger.RolesControllerGetRoleUsersException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -286,8 +285,7 @@ public HttpResponseMessage AddUserToRole(UserRoleDto userRoleDto, bool notifyUse userRoleDto.StartTime = userRoleDto.ExpiresTime = Null.NullDate; } - HttpResponseMessage response; - var user = this.GetUser(userRoleDto.UserId, out response); + var user = this.GetUser(userRoleDto.UserId, out var response); if (user == null) { return response; @@ -344,7 +342,7 @@ public HttpResponseMessage AddUserToRole(UserRoleDto userRoleDto, bool notifyUse } catch (Exception ex) { - Logger.Error(ex); + Logger.RolesControllerAddUserToRoleException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -384,7 +382,7 @@ public HttpResponseMessage RemoveUserFromRole(UserRoleDto userRoleDto) } catch (Exception ex) { - Logger.Error(ex); + Logger.RolesControllerRemoveUserFromRoleException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SecurityController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SecurityController.cs index 7cbfb1a3d20..b425cf6ea8e 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SecurityController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SecurityController.cs @@ -54,7 +54,7 @@ namespace Dnn.PersonaBar.Security.Services /// Provides REST APIs to manage security settings. [MenuPermission(MenuName = Components.Constants.MenuName)] - public class SecurityController : PersonaBarApiController + public partial class SecurityController : PersonaBarApiController { private const string BULLETINXMLNODEPATH = "//channel/item"; private const string UserRequestIPHeaderSettingName = "UserRequestIPHeader"; @@ -174,7 +174,7 @@ public HttpResponseMessage GetBasicLoginSettings(string cultureCode) } catch (Exception exc) { - Logger.Error(exc); + Logger.SecurityControllerGetBasicLoginSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -220,7 +220,7 @@ public HttpResponseMessage UpdateBasicLoginSettings(UpdateBasicLoginSettingsRequ } catch (Exception exc) { - Logger.Error(exc); + Logger.SecurityControllerUpdateBasicLoginSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -255,7 +255,7 @@ public HttpResponseMessage GetIpFilters() } catch (Exception exc) { - Logger.Error(exc); + Logger.SecurityControllerGetIpFiltersException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -288,7 +288,7 @@ public HttpResponseMessage GetIpFilter(int filterId) } catch (Exception exc) { - Logger.Error(exc); + Logger.SecurityControllerGetIpFilterException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -304,18 +304,20 @@ public HttpResponseMessage UpdateIpFilter(UpdateIpFilterRequest request) { try { - var ipf = new IPFilterInfo(); - ipf.IPAddress = request.IPAddress; - ipf.SubnetMask = request.SubnetMask; - ipf.RuleType = request.RuleType; - ipf.Notes = request.Notes; + var ipf = new IPFilterInfo + { + IPAddress = request.IPAddress, + SubnetMask = request.SubnetMask, + RuleType = request.RuleType, + Notes = request.Notes, + }; - if ((ipf.IPAddress == "127.0.0.1" || ipf.IPAddress == "localhost" || ipf.IPAddress == "::1" || ipf.IPAddress == "*") && ipf.RuleType == 2) + if (ipf.IPAddress is "127.0.0.1" or "localhost" or "::1" or "*" && ipf.RuleType == 2) { return this.Request.CreateErrorResponse(HttpStatusCode.BadRequest, Localization.GetString("CannotDeleteLocalhost.Text", Components.Constants.LocalResourcesFile)); } - if (IPFilterController.Instance.IsAllowableDeny(HttpContext.Current.Request.UserHostAddress, ipf) == false) + if (!IPFilterController.Instance.IsAllowableDeny(HttpContext.Current.Request.UserHostAddress, ipf)) { return this.Request.CreateErrorResponse(HttpStatusCode.BadRequest, Localization.GetString("CannotDeleteIPInUse.Text", Components.Constants.LocalResourcesFile)); } @@ -334,12 +336,12 @@ public HttpResponseMessage UpdateIpFilter(UpdateIpFilterRequest request) } catch (ArgumentException exc) { - Logger.Info(exc); + Logger.SecurityControllerUpdateIpFilterArgumentException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.BadRequest, exc.Message); } catch (Exception exc) { - Logger.Error(exc); + Logger.SecurityControllerUpdateIpFilterException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -356,23 +358,19 @@ public HttpResponseMessage DeleteIpFilter(int filterId) try { IList currentRules = IPFilterController.Instance.GetIPFilters(); - List currentWithDeleteRemoved = (from p in currentRules where p.IPFilterID != filterId select p).ToList(); + List currentWithDeleteRemoved = currentRules.Where(p => p.IPFilterID != filterId).ToList(); - if (IPFilterController.Instance.CanIPStillAccess(HttpContext.Current.Request.UserHostAddress, currentWithDeleteRemoved) == false) + if (!IPFilterController.Instance.CanIPStillAccess(HttpContext.Current.Request.UserHostAddress, currentWithDeleteRemoved)) { return this.Request.CreateErrorResponse(HttpStatusCode.BadRequest, Localization.GetString("CannotDelete.Text", Components.Constants.LocalResourcesFile)); } - else - { - var ipf = new IPFilterInfo(); - ipf.IPFilterID = filterId; - IPFilterController.Instance.DeleteIPFilter(ipf); - return this.Request.CreateResponse(HttpStatusCode.OK, new { Success = true, }); - } + + IPFilterController.Instance.DeleteIPFilter(new IPFilterInfo { IPFilterID = filterId, }); + return this.Request.CreateResponse(HttpStatusCode.OK, new { Success = true, }); } catch (Exception exc) { - Logger.Error(exc); + Logger.SecurityControllerDeleteIpFilterException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -412,7 +410,7 @@ public HttpResponseMessage GetMemberSettings() } catch (Exception exc) { - Logger.Error(exc); + Logger.SecurityControllerGetMemberSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -444,7 +442,7 @@ public HttpResponseMessage UpdateMemberSettings(UpdateMemberSettingsRequest requ } catch (Exception exc) { - Logger.Error(exc); + Logger.SecurityControllerUpdateMemberSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -509,7 +507,7 @@ public HttpResponseMessage GetRegistrationSettings() } catch (Exception exc) { - Logger.Error(exc); + Logger.SecurityControllerGetRegistrationSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -551,7 +549,7 @@ public HttpResponseMessage GetSslSettings() } catch (Exception exc) { - Logger.Error(exc); + Logger.SecurityControllerGetSslSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -600,7 +598,7 @@ public HttpResponseMessage UpdateRegistrationSettings(UpdateRegistrationSettings } catch (Exception exc) { - Logger.Error(exc); + Logger.SecurityControllerUpdateRegistrationSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -647,7 +645,7 @@ public HttpResponseMessage UpdateSslSettings(UpdateSslSettingsRequest request) } catch (Exception exc) { - Logger.Error(exc); + Logger.SecurityControllerUpdateSslSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -667,7 +665,7 @@ public HttpResponseMessage SetAllPagesSecure() } catch (Exception exc) { - Logger.Error(exc); + Logger.SecurityControllerSetAllPagesSecureException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -744,7 +742,7 @@ public HttpResponseMessage GetSecurityBulletins() } catch (Exception exc) { - Logger.Error(exc); + Logger.SecurityControllerGetSecurityBulletinsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -784,7 +782,7 @@ public HttpResponseMessage GetOtherSettings() } catch (Exception exc) { - Logger.Error(exc); + Logger.SecurityControllerGetOtherSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -833,7 +831,7 @@ public HttpResponseMessage UpdateOtherSettings(UpdateOtherSettingsRequest reques } catch (Exception exc) { - Logger.Error(exc); + Logger.SecurityControllerUpdateOtherSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -860,7 +858,7 @@ public HttpResponseMessage GetAuditCheckResults([FromUri] bool checkAll = false) } catch (Exception exc) { - Logger.Error(exc); + Logger.SecurityControllerGetAuditCheckResultsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -887,14 +885,14 @@ public HttpResponseMessage GetAuditCheckResult([FromUri] string id) } catch (Exception exc) { - Logger.Error(exc); + Logger.SecurityControllerGetAuditCheckResultException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } /// GET: api/Security/GetSuperuserActivities - /// Gets super user activities. - /// super user activities. + /// Gets superuser activities. + /// superuser activities. [HttpGet] [RequireHost] public HttpResponseMessage GetSuperuserActivities() @@ -926,7 +924,7 @@ public HttpResponseMessage GetSuperuserActivities() } catch (Exception exc) { - Logger.Error(exc); + Logger.SecurityControllerGetSuperuserActivitiesException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -962,7 +960,7 @@ public HttpResponseMessage SearchFileSystemAndDatabase(string term) } catch (Exception exc) { - Logger.Error(exc); + Logger.SecurityControllerSearchFileSystemAndDatabaseException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -1000,7 +998,7 @@ public HttpResponseMessage GetLastModifiedFiles() } catch (Exception exc) { - Logger.Error(exc); + Logger.SecurityControllerGetLastModifiedFilesException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -1073,7 +1071,7 @@ public HttpResponseMessage GetLastModifiedSettings() } catch (Exception exc) { - Logger.Error(exc); + Logger.SecurityControllerGetLastModifiedSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -1100,7 +1098,7 @@ public HttpResponseMessage GetApiTokenSettings() } catch (Exception exc) { - Logger.Error(exc); + Logger.SecurityControllerGetApiTokenSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -1148,7 +1146,7 @@ public HttpResponseMessage UpdateApiTokenSettings(UpdateApiTokenSettingsRequest } catch (Exception exc) { - Logger.Error(exc); + Logger.SecurityControllerUpdateApiTokenSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -1445,7 +1443,7 @@ public HttpResponseMessage GetCspSettings() } catch (Exception exc) { - Logger.Error(exc); + Logger.SecurityControllerGetCspSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -1515,7 +1513,7 @@ public HttpResponseMessage UpdateCspSettings(UpdateCspSettingsRequest request) } catch (Exception exc) { - Logger.Error(exc); + Logger.SecurityControllerUpdateCspSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SeoController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SeoController.cs index d3900e229a9..4c0ae52faf0 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SeoController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SeoController.cs @@ -92,7 +92,7 @@ public HttpResponseMessage GetGeneralSettings() } catch (Exception exc) { - Logger.Error(exc); + Logger.SeoControllerGetGeneralSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -128,7 +128,7 @@ public HttpResponseMessage UpdateGeneralSettings(UpdateGeneralSettingsRequest re } catch (Exception exc) { - Logger.Error(exc); + Logger.SeoControllerUpdateGeneralSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -166,7 +166,7 @@ public HttpResponseMessage GetRegexSettings() } catch (Exception exc) { - Logger.Error(exc); + Logger.SeoControllerGetRegexSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -250,7 +250,7 @@ public HttpResponseMessage UpdateRegexSettings(UpdateRegexSettingsRequest reques } catch (Exception exc) { - Logger.Error(exc); + Logger.SeoControllerUpdateRegexSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -307,7 +307,7 @@ public HttpResponseMessage GetSitemapSettings() } catch (Exception exc) { - Logger.Error(exc); + Logger.SeoControllerGetSitemapSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -327,7 +327,7 @@ public HttpResponseMessage CreateVerification(string verification) } catch (Exception exc) { - Logger.Error(exc); + Logger.SeoControllerCreateVerificationException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -370,7 +370,7 @@ public HttpResponseMessage UpdateSitemapSettings(SitemapSettingsRequest request) } catch (Exception exc) { - Logger.Error(exc); + Logger.SeoControllerUpdateSitemapSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -389,7 +389,7 @@ public HttpResponseMessage ResetCache() } catch (Exception exc) { - Logger.Error(exc); + Logger.SeoControllerResetCacheException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -419,7 +419,7 @@ public HttpResponseMessage GetSitemapProviders() } catch (Exception exc) { - Logger.Error(exc); + Logger.SeoControllerGetSitemapProvidersException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -452,7 +452,7 @@ public HttpResponseMessage UpdateSitemapProvider(UpdateSitemapProviderRequest re } catch (Exception exc) { - Logger.Error(exc); + Logger.SeoControllerUpdateSitemapProviderException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -482,7 +482,7 @@ public HttpResponseMessage GetExtensionUrlProviders() } catch (Exception exc) { - Logger.Error(exc); + Logger.SeoControllerGetExtensionUrlProvidersException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -510,7 +510,7 @@ public HttpResponseMessage UpdateExtensionUrlProviderStatus(UpdateExtensionUrlPr } catch (Exception exc) { - Logger.Error(exc); + Logger.SeoControllerUpdateExtensionUrlProviderStatusException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -539,7 +539,7 @@ public HttpResponseMessage TestUrl(int pageId, string queryString, string custom } catch (Exception exc) { - Logger.Error(exc); + Logger.SeoControllerTestUrlException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -567,7 +567,7 @@ public HttpResponseMessage TestUrlRewrite(string uri) } catch (Exception exc) { - Logger.Error(exc); + Logger.SeoControllerTestUrlRewriteException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerController.cs index 0d31712b7ab..7ae2e06db0f 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerController.cs @@ -52,7 +52,7 @@ public HttpResponseMessage RestartApplication() } catch (Exception exc) { - Logger.Error(exc); + Logger.ServerControllerRestartApplicationException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -69,7 +69,7 @@ public HttpResponseMessage ClearCache() } catch (Exception exc) { - Logger.Error(exc); + Logger.ServerControllerClearCacheException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerSettingsLogsController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerSettingsLogsController.cs index ae1dffa4b22..ef1760a8f73 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerSettingsLogsController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerSettingsLogsController.cs @@ -44,7 +44,7 @@ public HttpResponseMessage GetLogs() } catch (Exception exc) { - Logger.Error(exc); + Logger.ServerSettingsLogsControllerGetLogsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -64,7 +64,7 @@ public HttpResponseMessage GetLogFile(string fileName) } catch (Exception exc) { - Logger.Error(exc); + Logger.ServerSettingsLogsControllerGetLogFileException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -85,7 +85,7 @@ public HttpResponseMessage GetUpgradeLogFile(string logName) } catch (Exception exc) { - Logger.Error(exc); + Logger.ServerSettingsLogsControllerGetUpgradeLogFileException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerSettingsPerformanceController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerSettingsPerformanceController.cs index 27e96fc2b6f..9beec288f6d 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerSettingsPerformanceController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerSettingsPerformanceController.cs @@ -95,7 +95,7 @@ public HttpResponseMessage GetPerformanceSettings() } catch (Exception exc) { - Logger.Error(exc); + Logger.ServerSettingsPerformanceControllerGetPerformanceSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -116,7 +116,7 @@ public HttpResponseMessage IncrementPortalVersion() } catch (Exception exc) { - Logger.Error(exc); + Logger.ServerSettingsPerformanceControllerIncrementPortalVersionException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -137,7 +137,7 @@ public HttpResponseMessage IncrementHostVersion() } catch (Exception exc) { - Logger.Error(exc); + Logger.ServerSettingsPerformanceControllerIncrementHostVersionException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -182,7 +182,7 @@ public HttpResponseMessage UpdatePerformanceSettings(UpdatePerfSettingsRequest r } catch (Exception exc) { - Logger.Error(exc); + Logger.ServerSettingsPerformanceControllerUpdatePerformanceSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerSettingsSmtpAdminController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerSettingsSmtpAdminController.cs index 541a4455652..4260d672cb2 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerSettingsSmtpAdminController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerSettingsSmtpAdminController.cs @@ -81,7 +81,7 @@ public HttpResponseMessage GetSmtpSettings() } catch (Exception exc) { - Logger.Error(exc); + Logger.ServerSettingsSmtpAdminControllerGetSmtpSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -155,7 +155,7 @@ public HttpResponseMessage UpdateSmtpSettings(UpdateSmtpSettingsRequest request) } catch (Exception exc) { - Logger.Error(exc); + Logger.ServerSettingsSmtpAdminControllerUpdateSmtpSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -211,7 +211,7 @@ public HttpResponseMessage SendTestEmail(SendTestEmailRequest request) } catch (Exception exc) { - Logger.Error(exc); + Logger.ServerSettingsSmtpAdminControllerSendTestEmailException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -240,7 +240,7 @@ public HttpResponseMessage GetSmtpOAuthProviders() } catch (Exception exc) { - Logger.Error(exc); + Logger.ServerSettingsSmtpAdminControllerGetSmtpOAuthProvidersException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerSettingsSmtpHostController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerSettingsSmtpHostController.cs index 5738d4457db..2292f10b2cf 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerSettingsSmtpHostController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ServerSettingsSmtpHostController.cs @@ -92,7 +92,7 @@ public HttpResponseMessage GetSmtpSettings() } catch (Exception exc) { - Logger.Error(exc); + Logger.ServerSettingsSmtpHostControllerGetSmtpSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -199,7 +199,7 @@ public HttpResponseMessage UpdateSmtpSettings(UpdateSmtpSettingsRequest request) } catch (Exception exc) { - Logger.Error(exc); + Logger.ServerSettingsSmtpHostControllerUpdateSmtpSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -257,7 +257,7 @@ public HttpResponseMessage SendTestEmail(SendTestEmailRequest request) } catch (Exception exc) { - Logger.Error(exc); + Logger.ServerSettingsSmtpHostControllerSendTestEmailException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -298,7 +298,7 @@ public HttpResponseMessage GetSmtpOAuthProviders() } catch (Exception exc) { - Logger.Error(exc); + Logger.ServerSettingsSmtpHostControllerGetSmtpOAuthProvidersException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SiteGroupsController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SiteGroupsController.cs index ed0a82e00b8..6839fb49b0f 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SiteGroupsController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SiteGroupsController.cs @@ -49,7 +49,7 @@ public HttpResponseMessage Save(PortalGroupInfo portalGroup) } catch (Exception ex) { - Logger.Error(ex); + Logger.SiteGroupsControllerSaveException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -65,7 +65,7 @@ public HttpResponseMessage Delete(int groupId) } catch (Exception ex) { - Logger.Error(ex); + Logger.SiteGroupsControllerDeleteException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SiteSettingsController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SiteSettingsController.cs index 2279505a093..656a00382c1 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SiteSettingsController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SiteSettingsController.cs @@ -213,7 +213,7 @@ public HttpResponseMessage GetPortalSettings(int? portalId, string cultureCode) } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerGetPortalSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -258,7 +258,7 @@ public HttpResponseMessage GetCultureList(int? portalId) } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerGetCultureListException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -320,7 +320,7 @@ public HttpResponseMessage UpdatePortalSettings(UpdateSiteSettingsRequest reques } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerUpdatePortalSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -399,7 +399,7 @@ public HttpResponseMessage GetDefaultPagesSettings(int? portalId, string culture } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerGetDefaultPagesSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -452,7 +452,7 @@ public HttpResponseMessage UpdateDefaultPagesSettings(UpdateDefaultPagesSettings } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerUpdateDefaultPagesSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -494,7 +494,7 @@ public HttpResponseMessage GetMessagingSettings(int? portalId) } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerGetMessagingSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -531,7 +531,7 @@ public HttpResponseMessage UpdateMessagingSettings(UpdateMessagingSettingsReques } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerUpdateMessagingSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -575,7 +575,7 @@ public HttpResponseMessage GetProfileSettings(int? portalId) } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerGetProfileSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -612,7 +612,7 @@ public HttpResponseMessage UpdateProfileSettings(UpdateProfileSettingsRequest re } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerUpdateProfileSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -656,7 +656,7 @@ orderby v.ViewOrder } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerGetProfilePropertiesException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -727,7 +727,7 @@ public HttpResponseMessage GetProfileProperty(int? propertyId, int? portalId) } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerGetProfilePropertyException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -779,7 +779,7 @@ public HttpResponseMessage GetProfilePropertyLocalization(int? portalId, string } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerGetProfilePropertyLocalizationException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -825,7 +825,7 @@ public HttpResponseMessage UpdateProfilePropertyLocalization(UpdateProfileProper } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerUpdateProfilePropertyLocalizationException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -884,7 +884,7 @@ public HttpResponseMessage AddProfileProperty(UpdateProfilePropertyRequest reque } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerAddProfilePropertyException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -946,7 +946,7 @@ public HttpResponseMessage UpdateProfileProperty(UpdateProfilePropertyRequest re } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerUpdateProfilePropertyException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -983,7 +983,7 @@ public HttpResponseMessage UpdateProfilePropertyOrders(UpdateProfilePropertyOrde } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerUpdateProfilePropertyOrdersException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -1019,7 +1019,7 @@ public HttpResponseMessage DeleteProfileProperty(int propertyId, int? portalId) } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerDeleteProfilePropertyException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -1079,7 +1079,7 @@ public HttpResponseMessage GetUrlMappingSettings(int? portalId) } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerGetUrlMappingSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -1110,7 +1110,7 @@ public HttpResponseMessage UpdateUrlMappingSettings(UpdateUrlMappingSettingsRequ } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerUpdateUrlMappingSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -1161,7 +1161,7 @@ public HttpResponseMessage GetSiteAliases(int? portalId) } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerGetSiteAliasesException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -1200,7 +1200,7 @@ public HttpResponseMessage GetSiteAlias(int portalAliasId) } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerGetSiteAliasException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -1266,7 +1266,7 @@ public HttpResponseMessage AddSiteAlias(UpdateSiteAliasRequest request) } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerAddSiteAliasException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -1334,7 +1334,7 @@ public HttpResponseMessage UpdateSiteAlias(UpdateSiteAliasRequest request) } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerUpdateSiteAliasException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -1362,7 +1362,7 @@ public HttpResponseMessage DeleteSiteAlias(int portalAliasId) } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerDeleteSiteAliasException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -1394,7 +1394,7 @@ public HttpResponseMessage SetPrimarySiteAlias(int portalAliasId) } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerSetPrimarySiteAliasException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -1433,7 +1433,7 @@ public HttpResponseMessage GetListInfo(string listName, int? portalId) } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerGetListInfoException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -1479,7 +1479,7 @@ public HttpResponseMessage UpdateListEntry(UpdateListEntryRequest request) } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerUpdateListEntryException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -1508,7 +1508,7 @@ public HttpResponseMessage DeleteListEntry([FromUri] int entryId, [FromUri] int? } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerDeleteListEntryException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -1566,7 +1566,7 @@ public HttpResponseMessage UpdateListEntryOrders(UpdateListEntryOrdersRequest re } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerUpdateListEntryOrdersException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -1611,7 +1611,7 @@ public HttpResponseMessage GetPrivacySettings(int? portalId) } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerGetPrivacySettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -1651,7 +1651,7 @@ public HttpResponseMessage UpdatePrivacySettings(UpdatePrivacySettingsRequest re } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerUpdatePrivacySettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -1679,7 +1679,7 @@ public HttpResponseMessage ResetTermsAgreement(ResetTermsAgreementRequest reques } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerResetTermsAgreementException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -1725,7 +1725,7 @@ public HttpResponseMessage GetBasicSearchSettings() } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerGetBasicSearchSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -1806,7 +1806,7 @@ public HttpResponseMessage UpdateBasicSearchSettings(UpdateBasicSearchSettingsRe } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerUpdateBasicSearchSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -1826,7 +1826,7 @@ public HttpResponseMessage CompactSearchIndex() } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerCompactSearchIndexException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -1846,7 +1846,7 @@ public HttpResponseMessage HostSearchReindex() } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerHostSearchReindexException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -1873,7 +1873,7 @@ public HttpResponseMessage PortalSearchReindex(int? portalId) } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerPortalSearchReindexException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -1906,7 +1906,7 @@ public HttpResponseMessage GetPortals() } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerGetPortalsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -1952,7 +1952,7 @@ public HttpResponseMessage GetSynonymsGroups(int? portalId, string cultureCode) } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerGetSynonymsGroupsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -2002,7 +2002,7 @@ public HttpResponseMessage AddSynonymsGroup(UpdateSynonymsGroupRequest request) } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerAddSynonymsGroupException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -2062,7 +2062,7 @@ public HttpResponseMessage UpdateSynonymsGroup(UpdateSynonymsGroupRequest reques } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerUpdateSynonymsGroupException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -2096,7 +2096,7 @@ public HttpResponseMessage DeleteSynonymsGroup(UpdateSynonymsGroupRequest reques } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerDeleteSynonymsGroupException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -2139,7 +2139,7 @@ public HttpResponseMessage GetIgnoreWords(int? portalId, string cultureCode) } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerGetIgnoreWordsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -2178,7 +2178,7 @@ public HttpResponseMessage AddIgnoreWords(UpdateIgnoreWordsRequest request) } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerAddIgnoreWordsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -2217,7 +2217,7 @@ public HttpResponseMessage UpdateIgnoreWords(UpdateIgnoreWordsRequest request) } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerUpdateIgnoreWordsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -2247,7 +2247,7 @@ public HttpResponseMessage DeleteIgnoreWords(UpdateIgnoreWordsRequest request) } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerDeleteIgnoreWordsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -2313,7 +2313,7 @@ public HttpResponseMessage GetLanguageSettings(int? portalId) } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerGetLanguageSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -2386,7 +2386,7 @@ public HttpResponseMessage UpdateLanguageSettings(UpdateLanguageSettingsRequest } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerUpdateLanguageSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -2458,7 +2458,7 @@ public HttpResponseMessage GetLanguages(int? portalId) } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerGetLanguagesException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -2548,7 +2548,7 @@ public HttpResponseMessage GetLanguage(int? portalId, int? languageId) } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerGetLanguageException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -2591,7 +2591,7 @@ public HttpResponseMessage GetAllLanguages() } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerGetAllLanguagesException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -2631,7 +2631,7 @@ public HttpResponseMessage AddLanguage(UpdateLanguageRequest request) } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerAddLanguageException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -2659,7 +2659,7 @@ public HttpResponseMessage UpdateLanguageRoles(UpdateLanguageRequest request) } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerUpdateLanguageRolesException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -2759,7 +2759,7 @@ public HttpResponseMessage UpdateLanguage(UpdateLanguageRequest request) } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerUpdateLanguageException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -2910,7 +2910,7 @@ public HttpResponseMessage VerifyLanguageResourceFiles() } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerVerifyLanguageResourceFilesException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -2963,7 +2963,7 @@ public HttpResponseMessage GetModuleList(string type) } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerGetModuleListException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -3033,7 +3033,7 @@ public HttpResponseMessage CreateLanguagePack(CreateLanguagePackRequest request) } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerCreateLanguagePackException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -3084,7 +3084,7 @@ public HttpResponseMessage GetTranslatorRoles(int? portalId, int groupId, string } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerGetTranslatorRolesException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -3120,7 +3120,7 @@ public HttpResponseMessage GetTranslatorRoleGroups(int? portalId) } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerGetTranslatorRoleGroupsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -3167,7 +3167,7 @@ public HttpResponseMessage GetOtherSettings(int? portalId) } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerGetOtherSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -3226,7 +3226,7 @@ public HttpResponseMessage UpdateOtherSettings(UpdateOtherSettingsRequest reques } catch (Exception exc) { - Logger.Error(exc); + Logger.SiteSettingsControllerUpdateOtherSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SitesController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SitesController.cs index 7a2219dcb58..c78888d60a6 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SitesController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SitesController.cs @@ -78,7 +78,7 @@ public HttpResponseMessage GetPortals(int portalGroupId, string filter, int page } catch (Exception exc) { - Logger.Error(exc); + Logger.SitesControllerGetPortalsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -130,7 +130,7 @@ public HttpResponseMessage CreatePortal(CreatePortalRequest request) } catch (Exception exc) { - Logger.Error(exc); + Logger.SitesControllerCreatePortalException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -171,7 +171,7 @@ public HttpResponseMessage DeletePortal(int portalId) } catch (Exception exc) { - Logger.Error(exc); + Logger.SitesControllerDeletePortalException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -186,9 +186,7 @@ public HttpResponseMessage ExportPortalTemplate(ExportTemplateRequest request) { try { - bool success; - var message = this.controller.ExportPortalTemplate(request, this.UserInfo, out success); - + var message = this.controller.ExportPortalTemplate(request, this.UserInfo, out var success); if (!success) { return this.Request.CreateErrorResponse(HttpStatusCode.BadRequest, message); @@ -208,7 +206,7 @@ public HttpResponseMessage ExportPortalTemplate(ExportTemplateRequest request) } catch (Exception exc) { - Logger.Error(exc); + Logger.SitesControllerExportPortalTemplateException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -239,7 +237,7 @@ public HttpResponseMessage GetPortalLocales(int portalId) } catch (Exception exc) { - Logger.Error(exc); + Logger.SitesControllerGetPortalLocalesException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -258,7 +256,7 @@ public HttpResponseMessage DeleteExpiredPortals() } catch (Exception exc) { - Logger.Error(exc); + Logger.SitesControllerDeleteExpiredPortalsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -303,7 +301,7 @@ public HttpResponseMessage GetPortalTemplates() } catch (Exception exc) { - Logger.Error(exc); + Logger.SitesControllerGetPortalTemplatesException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -323,7 +321,7 @@ public HttpResponseMessage RequiresQuestionAndAnswer() } catch (Exception exc) { - Logger.Error(exc); + Logger.SitesControllerRequiresQuestionAndAnswerException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoApplicationAdminController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoApplicationAdminController.cs index be4ca54823d..bc2619f66da 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoApplicationAdminController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoApplicationAdminController.cs @@ -26,7 +26,7 @@ public class SystemInfoApplicationAdminController : PersonaBarApiController private static readonly ILogger Logger = DnnLoggingController.GetLogger(); public static string FirstCharToUpper(string input) - => FirstCharToUpper(input, CultureInfo.CurrentCulture); + => FirstCharToUpper(input, CultureInfo.CurrentCulture); public static string FirstCharToUpper(string input, CultureInfo culture) { @@ -62,7 +62,7 @@ public HttpResponseMessage GetApplicationInfo() } catch (Exception exc) { - Logger.Error(exc); + Logger.SystemInfoApplicationAdminControllerGetApplicationInfoException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoApplicationHostController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoApplicationHostController.cs index 2d4b3afb34b..037d2841d44 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoApplicationHostController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoApplicationHostController.cs @@ -26,7 +26,7 @@ public class SystemInfoApplicationHostController : PersonaBarApiController private static readonly ILogger Logger = DnnLoggingController.GetLogger(); public static string FirstCharToUpper(string input) - => FirstCharToUpper(input, CultureInfo.CurrentCulture); + => FirstCharToUpper(input, CultureInfo.CurrentCulture); public static string FirstCharToUpper(string input, CultureInfo culture) { @@ -63,7 +63,7 @@ public HttpResponseMessage GetApplicationInfo() } catch (Exception exc) { - Logger.Error(exc); + Logger.SystemInfoApplicationHostControllerGetApplicationInfoException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoDatabaseController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoDatabaseController.cs index 8233d819875..185b7df42aa 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoDatabaseController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoDatabaseController.cs @@ -57,7 +57,7 @@ public HttpResponseMessage GetDatabaseServerInfo() } catch (Exception exc) { - Logger.Error(exc); + Logger.SystemInfoDatabaseControllerGetDatabaseServerInfoException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoServersController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoServersController.cs index c46612ed263..a0e90ed1b9a 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoServersController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoServersController.cs @@ -32,7 +32,7 @@ public HttpResponseMessage GetServers() } catch (Exception exc) { - Logger.Error(exc); + Logger.SystemInfoServersControllerGetServersException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -48,7 +48,7 @@ public HttpResponseMessage DeleteServer(DeleteServerDTO data) } catch (Exception exc) { - Logger.Error(exc); + Logger.SystemInfoServersControllerDeleteServerException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -66,7 +66,7 @@ public HttpResponseMessage EditServerUrl(EditServerUrlDTO data) } catch (Exception exc) { - Logger.Error(exc); + Logger.SystemInfoServersControllerEditServerUrlException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -85,7 +85,7 @@ public HttpResponseMessage DeleteNonActiveServers() } catch (Exception exc) { - Logger.Error(exc); + Logger.SystemInfoServersControllerDeleteNonActiveServersException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoWebController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoWebController.cs index 298a4376aac..1bfc7454fcd 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoWebController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/SystemInfoWebController.cs @@ -43,7 +43,7 @@ public HttpResponseMessage GetWebServerInfo() } catch (Exception exc) { - Logger.Error(exc); + Logger.SystemInfoWebControllerGetWebServerInfoException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/TaskSchedulerController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/TaskSchedulerController.cs index 0df220b1d05..9d1bfb1d8ee 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/TaskSchedulerController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/TaskSchedulerController.cs @@ -68,7 +68,7 @@ public HttpResponseMessage GetServers() } catch (Exception exc) { - Logger.Error(exc); + Logger.TaskSchedulerControllerGetServersException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -102,7 +102,7 @@ public HttpResponseMessage GetScheduleItems(string serverName = "") } catch (Exception exc) { - Logger.Error(exc); + Logger.TaskSchedulerControllerGetScheduleItemsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -136,7 +136,7 @@ public HttpResponseMessage GetSchedulerSettings() } catch (Exception exc) { - Logger.Error(exc); + Logger.TaskSchedulerControllerGetSchedulerSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -179,7 +179,7 @@ public HttpResponseMessage UpdateSchedulerSettings(UpdateSettingsRequest request } catch (Exception exc) { - Logger.Error(exc); + Logger.TaskSchedulerControllerUpdateSchedulerSettingsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -227,7 +227,7 @@ from ScheduleHistoryItem history in SchedulingProvider.Instance().GetScheduleHis } catch (Exception exc) { - Logger.Error(exc); + Logger.TaskSchedulerControllerGetScheduleItemHistoryException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -273,7 +273,7 @@ public HttpResponseMessage GetScheduleItem(int scheduleId) } catch (Exception exc) { - Logger.Error(exc); + Logger.TaskSchedulerControllerGetScheduleItemException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -318,7 +318,7 @@ public HttpResponseMessage CreateScheduleItem(ScheduleDto scheduleDto) } catch (Exception exc) { - Logger.Error(exc); + Logger.TaskSchedulerControllerCreateScheduleItemException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -380,7 +380,7 @@ public HttpResponseMessage UpdateScheduleItem(ScheduleDto scheduleDto) } catch (Exception exc) { - Logger.Error(exc); + Logger.TaskSchedulerControllerUpdateScheduleItemException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -465,7 +465,7 @@ from ScheduleHistoryItem item in SchedulingProvider.Instance().GetScheduleQueue( } catch (Exception exc) { - Logger.Error(exc); + Logger.TaskSchedulerControllerGetScheduleStatusException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -484,7 +484,7 @@ public HttpResponseMessage StartSchedule() } catch (Exception exc) { - Logger.Error(exc); + Logger.TaskSchedulerControllerStartScheduleException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -503,7 +503,7 @@ public HttpResponseMessage StopSchedule() } catch (Exception exc) { - Logger.Error(exc); + Logger.TaskSchedulerControllerStopScheduleException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -544,7 +544,7 @@ public HttpResponseMessage RunSchedule(ScheduleDto scheduleDto) } catch (Exception exc) { - Logger.Error(exc); + Logger.TaskSchedulerControllerRunScheduleException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -565,7 +565,7 @@ public HttpResponseMessage DeleteSchedule(ScheduleDto scheduleDto) } catch (Exception exc) { - Logger.Error(exc); + Logger.TaskSchedulerControllerDeleteScheduleException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ThemesController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ThemesController.cs index 8b08a21becb..95f4b2ae700 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ThemesController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ThemesController.cs @@ -69,7 +69,7 @@ public HttpResponseMessage GetCurrentTheme(string language) } catch (Exception ex) { - Logger.Error(ex); + Logger.ThemesControllerGetCurrentThemeException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -87,7 +87,7 @@ public HttpResponseMessage GetThemes(ThemeLevel level) } catch (Exception ex) { - Logger.Error(ex); + Logger.ThemesControllerGetThemesException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -110,7 +110,7 @@ public HttpResponseMessage GetThemeFiles(string themeName, ThemeType type, Theme } catch (Exception ex) { - Logger.Error(ex); + Logger.ThemesControllerGetThemeFilesException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -127,7 +127,7 @@ public HttpResponseMessage ApplyTheme(ApplyThemeInfo applyTheme, string language } catch (Exception ex) { - Logger.Error(ex); + Logger.ThemesControllerApplyThemeException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -160,7 +160,7 @@ public HttpResponseMessage ApplyDefaultTheme(ApplyDefaultThemeInfo defaultTheme, } catch (Exception ex) { - Logger.Error(ex); + Logger.ThemesControllerApplyDefaultThemeException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -186,7 +186,7 @@ public HttpResponseMessage DeleteThemePackage(ThemeInfo theme) } catch (Exception ex) { - Logger.Error(ex); + Logger.ThemesControllerDeleteThemePackageException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -205,7 +205,7 @@ public HttpResponseMessage GetEditableTokens() } catch (Exception ex) { - Logger.Error(ex); + Logger.ThemesControllerGetEditableTokensException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -235,7 +235,7 @@ public HttpResponseMessage GetEditableSettings(string token) } catch (Exception ex) { - Logger.Error(ex); + Logger.ThemesControllerGetEditableSettingsException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -279,7 +279,7 @@ public HttpResponseMessage GetEditableValues(string token, string setting) } catch (Exception ex) { - Logger.Error(ex); + Logger.ThemesControllerGetEditableValuesException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -310,7 +310,7 @@ public HttpResponseMessage UpdateTheme(UpdateThemeInfo updateTheme) } catch (Exception ex) { - Logger.Error(ex); + Logger.ThemesControllerUpdateThemeException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -344,7 +344,7 @@ public HttpResponseMessage ParseTheme(ParseThemeInfo parseTheme) } catch (Exception ex) { - Logger.Error(ex); + Logger.ThemesControllerParseThemeException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -366,7 +366,7 @@ public HttpResponseMessage RestoreTheme(string language) } catch (Exception ex) { - Logger.Error(ex); + Logger.ThemesControllerRestoreThemeException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/UpgradesController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/UpgradesController.cs index 0df605a33e7..fd77cedde80 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/UpgradesController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/UpgradesController.cs @@ -143,7 +143,7 @@ public async Task Delete(UpgradePackageRequestDto data, Can } catch (Exception ex) { - Logger.Error(ex); + Logger.UpgradesControllerDeleteException(ex); return this.Request.CreateResponse(HttpStatusCode.InternalServerError, new { message = ex.Message, }); } @@ -173,7 +173,7 @@ public Task Upload(CancellationToken cancellationToken) } catch (Exception ex) { - Logger.Error(ex); + Logger.UpgradesControllerUploadException(ex); return Task.FromResult(this.Request.CreateResponse(HttpStatusCode.InternalServerError, new { message = ex.Message, })); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/UsersController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/UsersController.cs index 2560e8c88e7..2e927608a28 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/UsersController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/UsersController.cs @@ -74,7 +74,7 @@ public HttpResponseMessage CreateUser(CreateUserContract contract) } catch (Exception ex) { - Logger.Error(ex); + Logger.UsersControllerCreateUserException(ex); if (ex.GetType() == typeof(InvalidUserRegisterException)) { return this.Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message); @@ -122,7 +122,7 @@ public HttpResponseMessage GetUsers(string searchText, UserFilters filter, int p } catch (Exception ex) { - Logger.Error(ex); + Logger.UsersControllerGetUsersException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -138,7 +138,7 @@ public HttpResponseMessage GetUserFilters() } catch (Exception exc) { - Logger.Error(exc); + Logger.UsersControllerGetUserFiltersException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -175,7 +175,7 @@ public HttpResponseMessage GetUserDetail(int userId) } catch (Exception ex) { - Logger.Error(ex); + Logger.UsersControllerGetUserDetailException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -189,8 +189,7 @@ public HttpResponseMessage ChangePassword(ChangePasswordDto changePasswordDto) { var userId = changePasswordDto.UserId; var password = changePasswordDto.Password; - KeyValuePair response; - var user = Components.UsersController.GetUser(userId, this.PortalSettings, this.UserInfo, out response); + var user = Components.UsersController.GetUser(userId, this.PortalSettings, this.UserInfo, out var response); if (user == null) { return this.Request.CreateErrorResponse(response.Key, response.Value); @@ -203,12 +202,12 @@ public HttpResponseMessage ChangePassword(ChangePasswordDto changePasswordDto) } catch (InvalidPasswordException exc) { - Logger.Error(exc); + Logger.UsersControllerChangePasswordInvalidPasswordException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.BadRequest, exc.Message); } catch (Exception ex) { - Logger.Error(ex); + Logger.UsersControllerChangePasswordGeneralException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -220,15 +219,13 @@ public HttpResponseMessage ForceChangePassword([FromUri] int userId) { try { - KeyValuePair response; - var user = Components.UsersController.GetUser(userId, this.PortalSettings, this.UserInfo, out response); + var user = Components.UsersController.GetUser(userId, this.PortalSettings, this.UserInfo, out var response); if (user == null) { return this.Request.CreateErrorResponse(response.Key, response.Value); } - HttpResponseMessage httpResponseMessage; - if (this.IsCurrentUser(userId, out httpResponseMessage)) + if (this.IsCurrentUser(userId, out var httpResponseMessage)) { return httpResponseMessage; } @@ -241,7 +238,7 @@ public HttpResponseMessage ForceChangePassword([FromUri] int userId) } catch (Exception ex) { - Logger.Error(ex); + Logger.UsersControllerForceChangePasswordException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -284,12 +281,12 @@ public HttpResponseMessage SendPasswordResetLink([FromUri] int userId) } catch (ArgumentException exc) { - Logger.Error(exc); + Logger.UsersControllerCreateResetTokenArgumentException(exc); errorMessage = Localization.GetString("InvalidPasswordAnswer", Components.Constants.LocalResourcesFile); } catch (Exception exc) { - Logger.Error(exc); + Logger.UsersControllerCreateResetTokenGeneralException(exc); errorMessage = Localization.GetString("PasswordResetFailed", Components.Constants.LocalResourcesFile); } } @@ -298,7 +295,7 @@ public HttpResponseMessage SendPasswordResetLink([FromUri] int userId) } catch (Exception ex) { - Logger.Error(ex); + Logger.UsersControllerSendPasswordResetLinkException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -310,15 +307,13 @@ public HttpResponseMessage UpdateAuthorizeStatus([FromUri] int userId, [FromUri] { try { - KeyValuePair response; - var user = Components.UsersController.GetUser(userId, this.PortalSettings, this.UserInfo, out response); + var user = Components.UsersController.GetUser(userId, this.PortalSettings, this.UserInfo, out var response); if (user == null) { return this.Request.CreateErrorResponse(response.Key, response.Value); } - HttpResponseMessage httpResponseMessage; - if (this.IsCurrentUser(userId, out httpResponseMessage)) + if (this.IsCurrentUser(userId, out var httpResponseMessage)) { return httpResponseMessage; } @@ -334,7 +329,7 @@ public HttpResponseMessage UpdateAuthorizeStatus([FromUri] int userId, [FromUri] } catch (Exception ex) { - Logger.Error(ex); + Logger.UsersControllerUpdateAuthorizeStatusException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -363,7 +358,7 @@ public HttpResponseMessage SoftDeleteUser([FromUri] int userId) } catch (Exception ex) { - Logger.Error(ex); + Logger.UsersControllerSoftDeleteUserException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -375,8 +370,7 @@ public HttpResponseMessage HardDeleteUser([FromUri] int userId) { try { - KeyValuePair response; - var user = Components.UsersController.GetUser(userId, this.PortalSettings, this.UserInfo, out response); + var user = Components.UsersController.GetUser(userId, this.PortalSettings, this.UserInfo, out var response); if (user == null) { return this.Request.CreateErrorResponse(response.Key, response.Value); @@ -391,7 +385,7 @@ public HttpResponseMessage HardDeleteUser([FromUri] int userId) } catch (Exception ex) { - Logger.Error(ex); + Logger.UsersControllerHardDeleteUserException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -425,8 +419,7 @@ public HttpResponseMessage RestoreDeletedUser([FromUri] int userId) { try { - KeyValuePair response; - var user = Components.UsersController.GetUser(userId, this.PortalSettings, this.UserInfo, out response); + var user = Components.UsersController.GetUser(userId, this.PortalSettings, this.UserInfo, out var response); if (user == null) { return this.Request.CreateErrorResponse(response.Key, response.Value); @@ -441,7 +434,7 @@ public HttpResponseMessage RestoreDeletedUser([FromUri] int userId) } catch (Exception ex) { - Logger.Error(ex); + Logger.UsersControllerRestoreDeletedUserException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -453,8 +446,7 @@ public HttpResponseMessage UpdateSuperUserStatus([FromUri] int userId, [FromUri] { try { - KeyValuePair response; - var user = Components.UsersController.GetUser(userId, this.PortalSettings, this.UserInfo, out response); + var user = Components.UsersController.GetUser(userId, this.PortalSettings, this.UserInfo, out var response); if (user == null) { return this.Request.CreateErrorResponse(response.Key, response.Value); @@ -470,7 +462,7 @@ public HttpResponseMessage UpdateSuperUserStatus([FromUri] int userId, [FromUri] } catch (Exception ex) { - Logger.Error(ex); + Logger.UsersControllerUpdateSuperUserStatusException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -483,27 +475,26 @@ public HttpResponseMessage UpdateUserBasicInfo(UserBasicDto userBasicDto) try { Validate(userBasicDto); - KeyValuePair response; - var user = Components.UsersController.GetUser(userBasicDto.UserId, this.PortalSettings, this.UserInfo, out response); + var user = Components.UsersController.GetUser(userBasicDto.UserId, this.PortalSettings, this.UserInfo, out var response); if (user == null) { return this.Request.CreateErrorResponse(response.Key, response.Value); } - var upadtedUser = Components.UsersController.Instance.UpdateUserBasicInfo(userBasicDto); + var updatedUser = Components.UsersController.Instance.UpdateUserBasicInfo(userBasicDto); - return this.Request.CreateResponse(HttpStatusCode.OK, upadtedUser); + return this.Request.CreateResponse(HttpStatusCode.OK, updatedUser); } catch (SqlException ex) { - Logger.Error(ex); + Logger.UsersControllerUpdateUserBasicInfoSqlException(ex); return this.Request.CreateErrorResponse( HttpStatusCode.BadRequest, Localization.GetString("UsernameNotUnique", Components.Constants.LocalResourcesFile)); } catch (Exception ex) { - Logger.Error(ex); + Logger.UsersControllerUpdateUserBasicInfoGeneralException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -515,15 +506,13 @@ public HttpResponseMessage UnlockUser([FromUri] int userId) { try { - KeyValuePair response; - var user = Components.UsersController.GetUser(userId, this.PortalSettings, this.UserInfo, out response); + var user = Components.UsersController.GetUser(userId, this.PortalSettings, this.UserInfo, out var response); if (user == null) { return this.Request.CreateErrorResponse(response.Key, response.Value); } - HttpResponseMessage httpResponseMessage; - if (this.IsCurrentUser(userId, out httpResponseMessage)) + if (this.IsCurrentUser(userId, out var httpResponseMessage)) { return httpResponseMessage; } @@ -537,7 +526,7 @@ public HttpResponseMessage UnlockUser([FromUri] int userId) } catch (Exception ex) { - Logger.Error(ex); + Logger.UsersControllerUnlockUserException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -576,7 +565,7 @@ public HttpResponseMessage GetSuggestRoles(string keyword, int count) } catch (Exception ex) { - Logger.Error(ex); + Logger.UsersControllerGetSuggestRolesException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -587,22 +576,20 @@ public HttpResponseMessage GetUserRoles(string keyword, int userId, int pageInde { try { - KeyValuePair response; - var user = Components.UsersController.GetUser(userId, this.PortalSettings, this.UserInfo, out response); + var user = Components.UsersController.GetUser(userId, this.PortalSettings, this.UserInfo, out var response); if (user == null) { return this.Request.CreateErrorResponse(response.Key, response.Value); } - int totalRoles; - var userRoles = Components.UsersController.Instance.GetUserRoles(user, keyword, out totalRoles, pageIndex, pageSize) + var userRoles = Components.UsersController.Instance.GetUserRoles(user, keyword, out var totalRoles, pageIndex, pageSize) .Select(r => UserRoleDto.FromRoleInfo(this.PortalSettings, r)); return this.Request.CreateResponse(HttpStatusCode.OK, new { UserRoles = userRoles, TotalRecords = totalRoles }); } catch (Exception ex) { - Logger.Error(ex); + Logger.UsersControllerGetUserRolesException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -615,8 +602,7 @@ public HttpResponseMessage SaveUserRole(UserRoleDto userRoleDto, [FromUri] bool try { Validate(userRoleDto); - KeyValuePair response; - var user = Components.UsersController.GetUser(userRoleDto.UserId, this.PortalSettings, this.UserInfo, out response); + var user = Components.UsersController.GetUser(userRoleDto.UserId, this.PortalSettings, this.UserInfo, out var response); if (user == null) { return this.Request.CreateErrorResponse(response.Key, response.Value); @@ -633,7 +619,7 @@ public HttpResponseMessage SaveUserRole(UserRoleDto userRoleDto, [FromUri] bool } catch (Exception ex) { - Logger.Error(ex); + Logger.UsersControllerSaveUserRoleException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } @@ -646,8 +632,7 @@ public HttpResponseMessage RemoveUserRole(UserRoleDto userRoleDto) try { Validate(userRoleDto); - KeyValuePair response; - var user = Components.UsersController.GetUser(userRoleDto.UserId, this.PortalSettings, this.UserInfo, out response); + var user = Components.UsersController.GetUser(userRoleDto.UserId, this.PortalSettings, this.UserInfo, out var response); if (user == null) { return this.Request.CreateErrorResponse(response.Key, response.Value); @@ -665,7 +650,7 @@ public HttpResponseMessage RemoveUserRole(UserRoleDto userRoleDto) } catch (Exception ex) { - Logger.Error(ex); + Logger.UsersControllerRemoveUserRoleException(ex); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/VocabulariesController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/VocabulariesController.cs index 8f0b1bd6987..1b5586648f8 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/VocabulariesController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/VocabulariesController.cs @@ -45,8 +45,7 @@ public HttpResponseMessage GetVocabularies(int pageIndex, int pageSize, int scop { try { - int total = 0; - var vocabularies = this.controller.GetVocabularies(this.PortalId, pageIndex, pageSize, scopeTypeId, out total).Select(v => new + var vocabularies = this.controller.GetVocabularies(this.PortalId, pageIndex, pageSize, scopeTypeId, out var total).Select(v => new { v.VocabularyId, v.Name, @@ -68,7 +67,7 @@ public HttpResponseMessage GetVocabularies(int pageIndex, int pageSize, int scop } catch (Exception exc) { - Logger.Error(exc); + Logger.VocabulariesControllerGetVocabulariesException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc.Message); } } @@ -99,7 +98,7 @@ public HttpResponseMessage CreateVocabulary(VocabularyDto vocabularyDto) } catch (Exception exc) { - Logger.Error(exc); + Logger.VocabulariesControllerCreateVocabularyException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc.Message); } } @@ -134,14 +133,14 @@ public HttpResponseMessage UpdateVocabulary(VocabularyDto vocabularyDto) } catch (Exception exc) { - Logger.Error(exc); + Logger.VocabulariesControllerUpdateVocabularyException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc.Message); } } /// POST: api/Vocabularies/DeleteVocabulary /// Removes an existing vocabulary. - /// Id of an existing vocabulary that will be deleted. + /// ID of an existing vocabulary that will be deleted. /// A response indicating success. [HttpPost] [ValidateAntiForgeryToken] @@ -160,14 +159,14 @@ public HttpResponseMessage DeleteVocabulary(int vocabularyId) } catch (Exception exc) { - Logger.Error(exc); + Logger.VocabulariesControllerDeleteVocabularyException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc.Message); } } /// GET: api/Vocabularies/GetTermsByVocabularyId /// Gets a list of terms belonging to a specific vocabulary. - /// Id of an existing vocabulary. + /// ID of an existing vocabulary. /// List of terms. [HttpGet] public HttpResponseMessage GetTermsByVocabularyId(int vocabularyId) @@ -193,14 +192,14 @@ public HttpResponseMessage GetTermsByVocabularyId(int vocabularyId) } catch (Exception exc) { - Logger.Error(exc); + Logger.VocabulariesControllerGetTermsByVocabularyIdException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc.Message); } } /// GET: api/Vocabularies/GetTerm /// Gets a term. - /// Id of an existing term. + /// ID of an existing term. /// Data of a term. [HttpGet] public HttpResponseMessage GetTerm(int termId) @@ -221,7 +220,7 @@ public HttpResponseMessage GetTerm(int termId) } catch (Exception exc) { - Logger.Error(exc); + Logger.VocabulariesControllerGetTermException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc.Message); } } @@ -257,7 +256,7 @@ public HttpResponseMessage CreateTerm(TermDto termDto) } catch (Exception exc) { - Logger.Error(exc); + Logger.VocabulariesControllerCreateTermException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -294,14 +293,14 @@ public HttpResponseMessage UpdateTerm(TermDto termDto) } catch (Exception exc) { - Logger.Error(exc); + Logger.VocabulariesControllerUpdateTermException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc.Message); } } /// POST: api/Vocabularies/DeleteTerm /// Removes an existing term. - /// Id of an existing term. + /// ID of an existing term. /// A response indicating success. [HttpPost] [ValidateAntiForgeryToken] @@ -321,7 +320,7 @@ public HttpResponseMessage DeleteTerm(int termId) } catch (Exception exc) { - Logger.Error(exc); + Logger.VocabulariesControllerDeleteTermException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc.Message); } } diff --git a/Dnn.AdminExperience/EditBar/Dnn.EditBar.UI/Controllers/EditBarController.cs b/Dnn.AdminExperience/EditBar/Dnn.EditBar.UI/Controllers/EditBarController.cs index c869dd095be..08107357d5c 100644 --- a/Dnn.AdminExperience/EditBar/Dnn.EditBar.UI/Controllers/EditBarController.cs +++ b/Dnn.AdminExperience/EditBar/Dnn.EditBar.UI/Controllers/EditBarController.cs @@ -108,11 +108,7 @@ private static IEnumerable GetMenuItemInstances() } catch (Exception e) { - Logger.ErrorFormat( - CultureInfo.InvariantCulture, - "Unable to create {0} while getting all edit bar menu items. {1}", - type.FullName, - e.Message); + Logger.EditBarControllerUnableToCreateMenuItem(e, type.FullName); menuItem = null; } diff --git a/Dnn.AdminExperience/EditBar/Dnn.EditBar.UI/LoggerMessages.cs b/Dnn.AdminExperience/EditBar/Dnn.EditBar.UI/LoggerMessages.cs new file mode 100644 index 00000000000..955a005ca9f --- /dev/null +++ b/Dnn.AdminExperience/EditBar/Dnn.EditBar.UI/LoggerMessages.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.EditBar.UI; + +using System; + +using Microsoft.Extensions.Logging; + +/// Extension methods for for pre-defined logging messages. +/// The Dnn.EditBar.UI project has been assigned event IDs from 6,000,000 to 6,099,999. +internal static partial class LoggerMessages +{ + [LoggerMessage(EventId = 6_000_000, Level = LogLevel.Error, Message = "Unable to create {TypeFullName} while getting all edit bar menu items.")] + public static partial void EditBarControllerUnableToCreateMenuItem(this ILogger logger, Exception exception, string typeFullName); +} diff --git a/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/AppEvents/EventsController.cs b/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/AppEvents/EventsController.cs index abe7cf3e3ae..c5f3d4b0e44 100644 --- a/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/AppEvents/EventsController.cs +++ b/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/AppEvents/EventsController.cs @@ -19,7 +19,8 @@ namespace Dnn.PersonaBar.Library.AppEvents using Microsoft.Extensions.Logging; - public class EventsController : ServiceLocator, IEventsController + /// The default implementation. + public partial class EventsController : ServiceLocator, IEventsController { private static readonly ILogger Logger = DnnLoggingController.GetLogger(); @@ -47,12 +48,7 @@ public void ApplicationStartEvent() } catch (Exception e) { - Logger.ErrorFormat( - CultureInfo.InvariantCulture, - "{0}.ApplicationStart threw an exception. {1}\r\n{2}", - instance.GetType().FullName, - e.Message, - e.StackTrace); + Logger.EventsControllerApplicationStartThrewAnException(e, instance.GetType().FullName); } }); } @@ -68,12 +64,7 @@ public void ApplicationEndEvent() } catch (Exception e) { - Logger.ErrorFormat( - CultureInfo.InvariantCulture, - "{0}.ApplicationEnd threw an exception. {1}\r\n{2}", - instance.GetType().FullName, - e.Message, - e.StackTrace); + Logger.EventsControllerApplicationEndThrewAnException(e, instance.GetType().FullName); } }); } @@ -98,11 +89,7 @@ private static IEnumerable GetEventsImplements() } catch (Exception e) { - Logger.ErrorFormat( - CultureInfo.InvariantCulture, - "Unable to create {0} while calling Application start implementors. {1}", - type.FullName, - e.Message); + Logger.EventsControllerUnableToCreateAppEventHandler(e, type.FullName); appEventHandler = null; } @@ -139,12 +126,7 @@ private static bool VersionMatched(Type t) if (!matched) { - Logger.InfoFormat( - CultureInfo.InvariantCulture, - "Type \"{0}\"'s version ({1}) doesn't match current version({2}) so ignored", - t.FullName, - typeVersion, - currentVersion); + Logger.EventsControllerVersionMismatch(t.FullName, typeVersion, currentVersion); } return matched; diff --git a/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Common/IocUtil.cs b/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Common/IocUtil.cs index 33bf0dc7c0e..15bac4234f3 100644 --- a/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Common/IocUtil.cs +++ b/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Common/IocUtil.cs @@ -18,8 +18,8 @@ public class IocUtil private static readonly ILogger Logger = DnnLoggingController.GetLogger(); /// Register a component into the IOC container for later instantiation. - /// Contract interface for the component to registr with the IOC container. - /// Concrete implementation class (must have apublic default constructor). + /// Contract interface for the component to register with the IOC container. + /// Concrete implementation class (must have a public default constructor). /// Optional name for the contract. Useful when more than once class implements the same contract. /// True if the component was created; false if it was already created in the system. /// This helper creates a singleton instance for the contract. @@ -54,7 +54,7 @@ public static bool RegisterComponent(string name = null) } catch (Exception e) { - Logger.Error(e); + Logger.IocUtilRegisterComponentException(e); return false; } } @@ -93,7 +93,7 @@ public static bool RegisterComponentInstance(string name, object inst } catch (Exception e) { - Logger.Error(e); + Logger.IocUtilRegisterComponentInstanceException(e); return false; } } @@ -109,11 +109,7 @@ public static TContract GetInstance(string name = null) var instance = GetInstanceLocal(name); if (instance == null) { - Logger.WarnFormat( - CultureInfo.InvariantCulture, - "No instance of type '{0}' and name '{1}' is registered in the IOC container.", - typeof(TContract).FullName, - name ?? ""); + Logger.IocUtilNoInstanceOfTypeAndNameIsRegisteredInTheIocContainer(typeof(TContract).FullName, name ?? ""); } return instance; diff --git a/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Controllers/ModulesController.cs b/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Controllers/ModulesController.cs index 180119d7e19..7558d4ad1ec 100644 --- a/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Controllers/ModulesController.cs +++ b/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Controllers/ModulesController.cs @@ -157,7 +157,7 @@ public ModuleInfo CopyModule(PortalSettings portalSettings, int moduleId, int so } catch (Exception ex) { - Logger.Error(ex); + Logger.ModulesControllerCopyModuleException(ex); message = new KeyValuePair(HttpStatusCode.InternalServerError, Localization.GetString(moveBahaviour ? "Prompt_ErrorWhileMoving" : "Prompt_ErrorWhileCopying")); } @@ -184,7 +184,7 @@ public void DeleteModule(PortalSettings portalSettings, int moduleId, int pageId } catch (Exception ex) { - Logger.Error(ex); + Logger.ModulesControllerDeleteModuleException(ex); message = new KeyValuePair(HttpStatusCode.InternalServerError, string.Format(CultureInfo.CurrentCulture, Localization.GetString("Prompt_FailedtoDeleteModule", Constants.LocalResourcesFile), moduleId)); } } diff --git a/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Controllers/PersonaBarController.cs b/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Controllers/PersonaBarController.cs index 7937535f205..55827c220f3 100644 --- a/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Controllers/PersonaBarController.cs +++ b/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Controllers/PersonaBarController.cs @@ -104,7 +104,7 @@ public bool IsVisible(PortalSettings portalSettings, UserInfo user, MenuItem men } catch (Exception ex) { - Logger.Error(ex); + Logger.PersonaBarControllerIsVisibleException(ex); visible = false; } } @@ -156,7 +156,7 @@ private static IMenuItemController GetMenuItemController(IServiceScope scope, Me } catch (Exception ex) { - Logger.Error(ex); + Logger.PersonaBarControllerGetMenuItemControllerException(ex); return null; } } @@ -220,7 +220,7 @@ private void UpdateParameters(MenuItem menuItem) } catch (Exception ex) { - Logger.Error(ex); + Logger.PersonaBarControllerUpdateParametersException(ex); } } @@ -237,7 +237,7 @@ private string GetMenuSettings(MenuItem menuItem) } catch (Exception ex) { - Logger.Error(ex); + Logger.PersonaBarControllerGetMenuSettingsException(ex); settings = new Dictionary(); } diff --git a/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/LoggerMessages.cs b/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/LoggerMessages.cs new file mode 100644 index 00000000000..4f6e5e67301 --- /dev/null +++ b/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/LoggerMessages.cs @@ -0,0 +1,108 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.PersonaBar.Library; + +using System; + +using Microsoft.Extensions.Logging; + +/// Extension methods for for pre-defined logging messages. +/// The Dnn.PersonaBar.Library project has been assigned event IDs from 5,000,000 to 5,499,999. +internal static partial class LoggerMessages +{ + /* + # Event IDs + - 5,000,000 to 5,499,999 + - Dnn.PersonaBar.Library project + - 5,000,000 to 5,000,999 + - Dnn.PersonaBar.Library namespace + - 5,001,000 to 5,001,999 + - Dnn.PersonaBar.Library.AppEvents namespace + - Dnn.PersonaBar.Library.AppEvents.Attributes namespace + - 5,002,000 to 5,002,999 + - Dnn.PersonaBar.Library.Attributes namespace + - 5,003,000 to 5,003,999 + - Dnn.PersonaBar.Library.Common namespace + - 5,004,000 to 5,004,999 + - Dnn.PersonaBar.Library.Containers namespace + - 5,005,000 to 5,005,999 + - Dnn.PersonaBar.Library.Controllers namespace + - 5,006,000 to 5,006,999 + - Dnn.PersonaBar.Library.Data namespace + - 5,007,000 to 5,007,999 + - Dnn.PersonaBar.Library.Dto namespace + - Dnn.PersonaBar.Library.Dto.Tabs namespace + - 5,008,000 to 5,008,999 + - Dnn.PersonaBar.Library.Helper namespace + - 5,009,000 to 5,009,999 + - Dnn.PersonaBar.Library.Model namespace + - 5,010,000 to 5,010,999 + - Dnn.PersonaBar.Library.Permissions namespace + - 5,011,000 to 5,011,999 + - Dnn.PersonaBar.Library.Prompt namespace + - Dnn.PersonaBar.Library.Prompt.Attributes namespace + - Dnn.PersonaBar.Library.Prompt.Common namespace + - Dnn.PersonaBar.Library.Prompt.Models namespace + - 5,012,000 to 5,012,999 + - Dnn.PersonaBar.Library.Repository namespace + - 5,013,000 to 5,013,999 + - Dnn.PersonaBar.Library.Security namespace + */ + // Dnn.PersonaBar.Library.AppEvents.EventsController (5,001,000 to 5,001,099) + [LoggerMessage(EventId = 5_001_000, Level = LogLevel.Information, Message = "Type \"{TypeFullName}\"'s version ({TypeVersion}) doesn't match current version({CurrentVersion}) so ignored")] + public static partial void EventsControllerVersionMismatch(this ILogger logger, string typeFullName, Version typeVersion, Version currentVersion); + + [LoggerMessage(EventId = 5_001_001, Level = LogLevel.Error, Message = "{TypeFullName}.ApplicationStart threw an exception.")] + public static partial void EventsControllerApplicationStartThrewAnException(this ILogger logger, Exception exception, string typeFullName); + + [LoggerMessage(EventId = 5_001_002, Level = LogLevel.Error, Message = "{TypeFullName}.ApplicationEnd threw an exception.")] + public static partial void EventsControllerApplicationEndThrewAnException(this ILogger logger, Exception exception, string typeFullName); + + [LoggerMessage(EventId = 5_001_003, Level = LogLevel.Error, Message = "Unable to create {TypeFullName} while calling Application start implementors.")] + public static partial void EventsControllerUnableToCreateAppEventHandler(this ILogger logger, Exception exception, string typeFullName); + + // Dnn.PersonaBar.Library.Common.IocUtil (5,003,000 to 5,003,099) + [LoggerMessage(EventId = 5_003_000, Level = LogLevel.Warning, Message = "No instance of type '{TypeFullName}' and name '{Name}' is registered in the IOC container.")] + public static partial void IocUtilNoInstanceOfTypeAndNameIsRegisteredInTheIocContainer(this ILogger logger, string typeFullName, string name); + + [LoggerMessage(EventId = 5_003_001, Level = LogLevel.Error)] + public static partial void IocUtilRegisterComponentException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 5_003_002, Level = LogLevel.Error)] + public static partial void IocUtilRegisterComponentInstanceException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Library.Controllers.PersonaBarController (5,005,000 to 5,005,099) + [LoggerMessage(EventId = 5_005_000, Level = LogLevel.Error)] + public static partial void PersonaBarControllerIsVisibleException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 5_005_001, Level = LogLevel.Error)] + public static partial void PersonaBarControllerGetMenuItemControllerException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 5_005_002, Level = LogLevel.Error)] + public static partial void PersonaBarControllerUpdateParametersException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 5_005_003, Level = LogLevel.Error)] + public static partial void PersonaBarControllerGetMenuSettingsException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Library.Controllers.ModulesController (5,005,100 to 5,005,199) + [LoggerMessage(EventId = 5_005_100, Level = LogLevel.Error)] + public static partial void ModulesControllerCopyModuleException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 5_005_101, Level = LogLevel.Error)] + public static partial void ModulesControllerDeleteModuleException(this ILogger logger, Exception exception); + + // Dnn.PersonaBar.Library.Permissions.MenuPermissionController (5,010,000 to 5,010,099) + [LoggerMessage(EventId = 5_010_000, Level = LogLevel.Error)] + public static partial void MenuPermissionControllerGetMenuPermissionsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 5_010_001, Level = LogLevel.Error)] + public static partial void MenuPermissionControllerEnsureMenuDefaultPermissionsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 5_010_002, Level = LogLevel.Error)] + public static partial void MenuPermissionControllerSaveMenuDefaultPermissionsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 5_010_003, Level = LogLevel.Error, Message = "Role \"{RoleName}\" in portal \"{PortalId}\" doesn't marked as system role, will ignore add this default permission to {MenuItemIdentifier}.")] + public static partial void MenuPermissionControllerRoleInPortalNotMarkedAsSystemRoleIgnoring(this ILogger logger, string roleName, int portalId, string menuItemIdentifier); +} diff --git a/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Permissions/MenuPermissionController.cs b/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Permissions/MenuPermissionController.cs index 58e51c45094..9fbbe62bb5d 100644 --- a/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Permissions/MenuPermissionController.cs +++ b/Dnn.AdminExperience/Library/Dnn.PersonaBar.Library/Permissions/MenuPermissionController.cs @@ -125,7 +125,7 @@ public static MenuPermissionCollection GetMenuPermissions(IHostSettings hostSett } catch (Exception ex) { - Logger.Error(ex); + Logger.MenuPermissionControllerGetMenuPermissionsException(ex); } finally { @@ -402,7 +402,7 @@ private static void EnsureMenuDefaultPermissions(IHostSettings hostSettings, IPo } catch (Exception ex) { - Logger.Error(ex); + Logger.MenuPermissionControllerEnsureMenuDefaultPermissionsException(ex); } } @@ -442,7 +442,7 @@ private static void SaveMenuDefaultPermissions(IHostSettings hostSettings, IPort } else if (role != null) { - Logger.Error($"Role \"{roleName}\" in portal \"{portalId}\" doesn't marked as system role, will ignore add this default permission to {menuItem.Identifier}."); + Logger.MenuPermissionControllerRoleInPortalNotMarkedAsSystemRoleIgnoring(roleName, portalId, menuItem.Identifier); } break; @@ -474,7 +474,7 @@ private static void SaveMenuDefaultPermissions(IHostSettings hostSettings, IPort } catch (Exception ex) { - Logger.Error(ex); + Logger.MenuPermissionControllerSaveMenuDefaultPermissionsException(ex); } } diff --git a/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Components/BusinessController.cs b/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Components/BusinessController.cs index 59dd85f5601..65811682ece 100644 --- a/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Components/BusinessController.cs +++ b/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Components/BusinessController.cs @@ -31,7 +31,7 @@ namespace Dnn.PersonaBar.UI.Components using Microsoft.Extensions.Logging; /// Provides upgrade logic for the Persona Bar. - public class BusinessController(IHostSettingsService hostSettingsService, IHostSettings hostSettings, IPortalController portalController) : IUpgradeable + public partial class BusinessController(IHostSettingsService hostSettingsService, IHostSettings hostSettings, IPortalController portalController) : IUpgradeable { private static readonly ILogger Logger = DnnLoggingController.GetLogger(); private readonly IHostSettingsService hostSettingsService = hostSettingsService ?? Globals.GetCurrentServiceProvider().GetRequiredService(); @@ -84,7 +84,10 @@ public string UpgradeModule(string version) private static void RemoveAssembly(string assemblyName) { - Logger.Info(string.Concat(Localization.GetString("LogStart", Localization.GlobalResourceFile), "Removal of assembly:", assemblyName)); + if (Logger.IsEnabled(LogLevel.Information)) + { + Logger.BusinessControllerRemovalOfAssembly(Localization.GetString("LogStart", Localization.GlobalResourceFile), assemblyName); + } var packageInfo = PackageController.Instance.GetExtensionPackage(Null.NullInteger, p => p.Name.Equals(assemblyName, StringComparison.OrdinalIgnoreCase) @@ -94,12 +97,12 @@ private static void RemoveAssembly(string assemblyName) var fileName = assemblyName + ".dll"; if (DataProvider.Instance().UnRegisterAssembly(packageInfo.PackageID, fileName)) { - Logger.Info($"{Util.ASSEMBLY_UnRegistered} - {fileName}"); + Logger.BusinessControllerAssemblyUnregistered(Util.ASSEMBLY_UnRegistered, fileName); } } else { - Logger.Info($"{Util.ASSEMBLY_InUse} - {assemblyName}"); + Logger.BusinessControllerAssemblyInUse(Util.ASSEMBLY_InUse, assemblyName); } } diff --git a/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/HttpModules/PersonaBarModule.cs b/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/HttpModules/PersonaBarModule.cs index 400ed324771..cd7995405aa 100644 --- a/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/HttpModules/PersonaBarModule.cs +++ b/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/HttpModules/PersonaBarModule.cs @@ -73,12 +73,7 @@ private static void OnSkinInit(object sender, SkinEventArgs e) } catch (Exception ex) { - Logger.ErrorFormat( - CultureInfo.InvariantCulture, - "{0}.Init threw an exception. {1}\r\n{2}", - instance.GetType().FullName, - ex.Message, - ex.StackTrace); + Logger.PersonaBarModuleSkinEventsInitThrewAnException(ex, instance.GetType().FullName); } }); } @@ -93,12 +88,7 @@ private static void OnSkinLoad(object sender, SkinEventArgs e) } catch (Exception ex) { - Logger.ErrorFormat( - CultureInfo.InvariantCulture, - "{0}.Load threw an exception. {1}\r\n{2}", - instance.GetType().FullName, - ex.Message, - ex.StackTrace); + Logger.PersonaBarModuleSkinEventsLoadThrewAnException(ex, instance.GetType().FullName); } }); } @@ -113,12 +103,7 @@ private static void OnSkinPreRender(object sender, SkinEventArgs e) } catch (Exception ex) { - Logger.ErrorFormat( - CultureInfo.InvariantCulture, - "{0}.PreRender threw an exception. {1}\r\n{2}", - instance.GetType().FullName, - ex.Message, - ex.StackTrace); + Logger.PersonaBarModuleSkinEventsPreRenderThrewAnException(ex, instance.GetType().FullName); } }); } @@ -133,12 +118,7 @@ private static void OnSkinUnLoad(object sender, SkinEventArgs e) } catch (Exception ex) { - Logger.ErrorFormat( - CultureInfo.InvariantCulture, - "{0}.UnLoad threw an exception. {1}\r\n{2}", - instance.GetType().FullName, - ex.Message, - ex.StackTrace); + Logger.PersonaBarModuleSkinEventsUnLoadThrewAnException(ex, instance.GetType().FullName); } }); } diff --git a/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/LoggerMessages.cs b/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/LoggerMessages.cs new file mode 100644 index 00000000000..dc3d3b36a06 --- /dev/null +++ b/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/LoggerMessages.cs @@ -0,0 +1,62 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace Dnn.PersonaBar.UI; + +using System; + +using Microsoft.Extensions.Logging; + +/// Extension methods for for pre-defined logging messages. +/// The Dnn.PersonaBar.UI project has been assigned event IDs from 5,500,000 to 5,999,999. +internal static partial class LoggerMessages +{ + [LoggerMessage(EventId = 5_500_000, Level = LogLevel.Information, Message = "{LogStart}Removal of assembly:{AssemblyName}")] + public static partial void BusinessControllerRemovalOfAssembly(this ILogger logger, string logStart, string assemblyName); + + [LoggerMessage(EventId = 5_500_001, Level = LogLevel.Information, Message = "{AssemblyUnregistered} - {FileName}")] + public static partial void BusinessControllerAssemblyUnregistered(this ILogger logger, string assemblyUnregistered, string fileName); + + [LoggerMessage(EventId = 5_500_002, Level = LogLevel.Information, Message = "{AssemblyInUse} - {AssemblyName}")] + public static partial void BusinessControllerAssemblyInUse(this ILogger logger, string assemblyInUse, string assemblyName); + + [LoggerMessage(EventId = 5_500_100, Level = LogLevel.Error, Message = "{TypeFullName}.Init threw an exception.")] + public static partial void PersonaBarModuleSkinEventsInitThrewAnException(this ILogger logger, Exception exception, string typeFullName); + + [LoggerMessage(EventId = 5_500_101, Level = LogLevel.Error, Message = "{TypeFullName}.Load threw an exception.")] + public static partial void PersonaBarModuleSkinEventsLoadThrewAnException(this ILogger logger, Exception exception, string typeFullName); + + [LoggerMessage(EventId = 5_500_102, Level = LogLevel.Error, Message = "{TypeFullName}.PreRender threw an exception.")] + public static partial void PersonaBarModuleSkinEventsPreRenderThrewAnException(this ILogger logger, Exception exception, string typeFullName); + + [LoggerMessage(EventId = 5_500_102, Level = LogLevel.Error, Message = "{TypeFullName}.UnLoad threw an exception.")] + public static partial void PersonaBarModuleSkinEventsUnLoadThrewAnException(this ILogger logger, Exception exception, string typeFullName); + + [LoggerMessage(EventId = 5_500_200, Level = LogLevel.Error)] + public static partial void ComponentsControllerGetRoleGroupsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 5_500_201, Level = LogLevel.Error)] + public static partial void ComponentsControllerGetSuggestionUsersException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 5_500_202, Level = LogLevel.Error)] + public static partial void ComponentsControllerGetSuggestionRolesException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 5_500_300, Level = LogLevel.Error)] + public static partial void TabsControllerGetPortalTabsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 5_500_301, Level = LogLevel.Error)] + public static partial void TabsControllerSearchPortalTabsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 5_500_302, Level = LogLevel.Error)] + public static partial void TabsControllerGetPortalTabException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 5_500_303, Level = LogLevel.Error)] + public static partial void TabsControllerGetTabsDescendantsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 5_500_400, Level = LogLevel.Error)] + public static partial void PortalsControllerGetPortalsException(this ILogger logger, Exception exception); + + [LoggerMessage(EventId = 5_500_500, Level = LogLevel.Error)] + public static partial void MenuExtensionsControllerGetExtensionControllerException(this ILogger logger, Exception exception); +} diff --git a/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/ComponentsController.cs b/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/ComponentsController.cs index 35ba78fade9..d066e47cbdc 100644 --- a/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/ComponentsController.cs +++ b/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/ComponentsController.cs @@ -81,7 +81,7 @@ public HttpResponseMessage GetRoleGroups(bool reload = false) } catch (Exception ex) { - Logger.Error(ex); + Logger.ComponentsControllerGetRoleGroupsException(ex); return this.Request.CreateResponse(HttpStatusCode.InternalServerError, new { Error = ex.Message }); } } @@ -118,7 +118,7 @@ public HttpResponseMessage GetSuggestionUsers(string keyword, int count) } catch (Exception ex) { - Logger.Error(ex); + Logger.ComponentsControllerGetSuggestionUsersException(ex); return this.Request.CreateResponse(HttpStatusCode.InternalServerError, new { Error = ex.Message }); } } @@ -164,7 +164,7 @@ public HttpResponseMessage GetSuggestionRoles(string keyword, int roleGroupId, i } catch (Exception ex) { - Logger.Error(ex); + Logger.ComponentsControllerGetSuggestionRolesException(ex); return this.Request.CreateResponse(HttpStatusCode.InternalServerError, new { Error = ex.Message }); } } diff --git a/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/MenuExtensionsController.cs b/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/MenuExtensionsController.cs index a0faac2e80d..fd1982de458 100644 --- a/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/MenuExtensionsController.cs +++ b/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/MenuExtensionsController.cs @@ -120,7 +120,7 @@ private IExtensionController GetExtensionController(PersonaBarExtension extensio } catch (Exception ex) { - Logger.Error(ex); + Logger.MenuExtensionsControllerGetExtensionControllerException(ex); return null; } } diff --git a/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/PortalsController.cs b/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/PortalsController.cs index 51c5f30e819..49bdbf6c36c 100644 --- a/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/PortalsController.cs +++ b/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/PortalsController.cs @@ -67,7 +67,7 @@ public HttpResponseMessage GetPortals(bool addAll = false) } catch (Exception exc) { - Logger.Error(exc); + Logger.PortalsControllerGetPortalsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } diff --git a/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/TabsController.cs b/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/TabsController.cs index 18ac562f2ef..ca5f9ed231d 100644 --- a/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/TabsController.cs +++ b/Dnn.AdminExperience/Library/Dnn.PersonaBar.UI/Services/TabsController.cs @@ -83,7 +83,7 @@ public HttpResponseMessage GetPortalTabs(int portalId, string cultureCode, bool } catch (Exception exc) { - Logger.Error(exc); + Logger.TabsControllerGetPortalTabsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -97,7 +97,7 @@ public HttpResponseMessage GetPortalTabs(int portalId, string cultureCode, bool /// The friendly name of a module which must be on the page. /// Whether to include host pages. /// Whether to include disabled pages. - /// WHether to include deleted pages. + /// Whether to include deleted pages. /// A response with a Results field. [HttpGet] public HttpResponseMessage SearchPortalTabs(string searchText, int portalId, string roles = "", bool disabledNotSelectable = false, int sortOrder = 0, string validateTab = "", bool includeHostPages = false, bool includeDisabled = false, bool includeDeleted = false) @@ -115,7 +115,7 @@ public HttpResponseMessage SearchPortalTabs(string searchText, int portalId, str } catch (Exception exc) { - Logger.Error(exc); + Logger.TabsControllerSearchPortalTabsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -141,7 +141,7 @@ public HttpResponseMessage GetPortalTab(int portalId, int tabId, string cultureC } catch (Exception exc) { - Logger.Error(exc); + Logger.TabsControllerGetPortalTabException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } @@ -186,7 +186,7 @@ public HttpResponseMessage GetTabsDescendants(int portalId, int parentId, string } catch (Exception exc) { - Logger.Error(exc); + Logger.TabsControllerGetTabsDescendantsException(exc); return this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } } From 97dff1f215b3dbf1370301a306b9f570f80839d4 Mon Sep 17 00:00:00 2001 From: Peter Donker Date: Sun, 5 Apr 2026 22:04:58 +0200 Subject: [PATCH 30/30] We need System.Memory at install time --- Build/Tasks/packaging.json | 1 - 1 file changed, 1 deletion(-) diff --git a/Build/Tasks/packaging.json b/Build/Tasks/packaging.json index e7284ae89b7..bc5f5c3e182 100644 --- a/Build/Tasks/packaging.json +++ b/Build/Tasks/packaging.json @@ -53,7 +53,6 @@ "/bin/Microsoft.Bcl.Memory.dll", "/bin/Microsoft.Bcl.TimeProvider.dll", "/bin/System.Formats.Asn1.dll", - "/bin/System.Memory.dll", "/bin/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll", "/bin/Lucene.Net.Contrib.Core.dll", "/bin/Lucene.Net.Contrib.Highlighter.dll",