From e66e540bbba8755ac39765fd72a5ffce65f8c129 Mon Sep 17 00:00:00 2001 From: Ramon Smits Date: Wed, 23 Aug 2023 15:54:27 +0000 Subject: [PATCH 1/2] Logging exception on the same like so make log parsing more useful --- src/ServiceControl.Audit/Infrastructure/LoggingConfigurator.cs | 2 +- .../Infrastructure/LoggingConfigurator.cs | 2 +- src/ServiceControl/LoggingConfigurator.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ServiceControl.Audit/Infrastructure/LoggingConfigurator.cs b/src/ServiceControl.Audit/Infrastructure/LoggingConfigurator.cs index ab0d55274e..3f5aa0d455 100644 --- a/src/ServiceControl.Audit/Infrastructure/LoggingConfigurator.cs +++ b/src/ServiceControl.Audit/Infrastructure/LoggingConfigurator.cs @@ -25,7 +25,7 @@ public static void ConfigureLogging(LoggingSettings loggingSettings) var version = FileVersionInfo.GetVersionInfo(typeof(Bootstrapper).Assembly.Location).ProductVersion; var nlogConfig = new LoggingConfiguration(); - var simpleLayout = new SimpleLayout("${longdate}|${threadid}|${level}|${logger}|${message}${onexception:${newline}${exception:format=tostring}}"); + var simpleLayout = new SimpleLayout("${longdate}|${threadid}|${level}|${logger}|${message}${onexception:|${exception:format=tostring}}"); var header = $@"------------------------------------------------------------- ServiceControl Audit Version: {version} -------------------------------------------------------------"; diff --git a/src/ServiceControl.Monitoring/Infrastructure/LoggingConfigurator.cs b/src/ServiceControl.Monitoring/Infrastructure/LoggingConfigurator.cs index ef6f22d6d7..8279757ad8 100644 --- a/src/ServiceControl.Monitoring/Infrastructure/LoggingConfigurator.cs +++ b/src/ServiceControl.Monitoring/Infrastructure/LoggingConfigurator.cs @@ -25,7 +25,7 @@ public static void Configure(Settings settings, bool logToConsole) var version = FileVersionInfo.GetVersionInfo(typeof(Bootstrapper).Assembly.Location).ProductVersion; var nlogConfig = new LoggingConfiguration(); - var simpleLayout = new SimpleLayout("${longdate}|${threadid}|${level}|${logger}|${message}${onexception:${newline}${exception:format=tostring}}"); + var simpleLayout = new SimpleLayout("${longdate}|${threadid}|${level}|${logger}|${message}${onexception:|${exception:format=tostring}}"); var header = $@"------------------------------------------------------------- ServiceControl Monitoring Version: {version} Selected Transport: {settings.TransportType} diff --git a/src/ServiceControl/LoggingConfigurator.cs b/src/ServiceControl/LoggingConfigurator.cs index f624632bc7..537be6172a 100644 --- a/src/ServiceControl/LoggingConfigurator.cs +++ b/src/ServiceControl/LoggingConfigurator.cs @@ -26,7 +26,7 @@ public static void ConfigureLogging(LoggingSettings loggingSettings) var version = FileVersionInfo.GetVersionInfo(typeof(Bootstrapper).Assembly.Location).ProductVersion; var nlogConfig = new LoggingConfiguration(); - var simpleLayout = new SimpleLayout("${longdate}|${threadid}|${level}|${logger}|${message}${onexception:${newline}${exception:format=tostring}}"); + var simpleLayout = new SimpleLayout("${longdate}|${threadid}|${level}|${logger}|${message}${onexception:|${exception:format=tostring}}"); var header = $@"------------------------------------------------------------- ServiceControl Version: {version} -------------------------------------------------------------"; From c9d933aca351445e2834dd6d4e88f816ea5907cd Mon Sep 17 00:00:00 2001 From: Ramon Smits Date: Wed, 23 Aug 2023 15:55:04 +0000 Subject: [PATCH 2/2] OnCriticalError using incorrect log level --- src/ServiceControl.Audit/Auditing/AuditIngestion.cs | 2 +- src/ServiceControl/Operations/ErrorIngestion.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ServiceControl.Audit/Auditing/AuditIngestion.cs b/src/ServiceControl.Audit/Auditing/AuditIngestion.cs index d0552dd9a0..255b804ebb 100644 --- a/src/ServiceControl.Audit/Auditing/AuditIngestion.cs +++ b/src/ServiceControl.Audit/Auditing/AuditIngestion.cs @@ -78,7 +78,7 @@ FailedAuditImport FailedMessageFactory(FailedTransportMessage msg) Task OnCriticalError(string failure, Exception exception) { - logger.Warn($"OnCriticalError. '{failure}'", exception); + logger.Fatal($"OnCriticalError. '{failure}'", exception); return watchdog.OnFailure(failure); } diff --git a/src/ServiceControl/Operations/ErrorIngestion.cs b/src/ServiceControl/Operations/ErrorIngestion.cs index 62fc68ed6c..fc3b40f46e 100644 --- a/src/ServiceControl/Operations/ErrorIngestion.cs +++ b/src/ServiceControl/Operations/ErrorIngestion.cs @@ -194,7 +194,7 @@ async Task OnMessage(MessageContext messageContext) Task OnCriticalError(string failure, Exception exception) { - logger.Warn($"OnCriticalError. '{failure}'", exception); + logger.Fatal($"OnCriticalError. '{failure}'", exception); return watchdog.OnFailure(failure); }