From 341719e9634998cfbcbcbadb5da33dd6618b0d9a Mon Sep 17 00:00:00 2001 From: Ramon Smits Date: Fri, 14 Mar 2025 15:24:56 +0100 Subject: [PATCH] Logging exceptions thrown during init, start and stop --- src/ServiceControl.Audit/Program.cs | 5 +++++ src/ServiceControl.Monitoring/Program.cs | 5 +++++ src/ServiceControl/Program.cs | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/src/ServiceControl.Audit/Program.cs b/src/ServiceControl.Audit/Program.cs index f69494a859..1d9e094d8f 100644 --- a/src/ServiceControl.Audit/Program.cs +++ b/src/ServiceControl.Audit/Program.cs @@ -38,6 +38,11 @@ return 0; } +catch (Exception ex) +{ + NLog.LogManager.GetCurrentClassLogger().Fatal(ex, "Unrecoverable error"); + throw; +} finally { // The following log statement is meant to leave a trail in the logs to determine if the process was killed diff --git a/src/ServiceControl.Monitoring/Program.cs b/src/ServiceControl.Monitoring/Program.cs index 872e659a9c..8620eba3cc 100644 --- a/src/ServiceControl.Monitoring/Program.cs +++ b/src/ServiceControl.Monitoring/Program.cs @@ -30,6 +30,11 @@ return 0; } +catch (Exception ex) +{ + NLog.LogManager.GetCurrentClassLogger().Fatal(ex, "Unrecoverable error"); + throw; +} finally { // The following log statement is meant to leave a trail in the logs to determine if the process was killed diff --git a/src/ServiceControl/Program.cs b/src/ServiceControl/Program.cs index b5d0f3c63e..7c746ff60c 100644 --- a/src/ServiceControl/Program.cs +++ b/src/ServiceControl/Program.cs @@ -38,6 +38,11 @@ return 0; } +catch (Exception ex) +{ + NLog.LogManager.GetCurrentClassLogger().Fatal(ex, "Unrecoverable error"); + throw; +} finally { // The following log statement is meant to leave a trail in the logs to determine if the process was killed