From 3f0de83eaeaff0782c4460d4b70c7b903699b406 Mon Sep 17 00:00:00 2001 From: Scott Kirkland Date: Fri, 19 Jan 2024 11:47:55 -0800 Subject: [PATCH] add in to api and jobs too --- Sloth.Api/Logging/LoggingConfiguration.cs | 6 ++++++ Sloth.Jobs.Core/Logging/LoggingConfiguration.cs | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/Sloth.Api/Logging/LoggingConfiguration.cs b/Sloth.Api/Logging/LoggingConfiguration.cs index 2ca8c3ef..234d7bac 100644 --- a/Sloth.Api/Logging/LoggingConfiguration.cs +++ b/Sloth.Api/Logging/LoggingConfiguration.cs @@ -7,6 +7,7 @@ using Serilog.Exceptions; using Serilog.Sinks.Elasticsearch; using Serilog.Sinks.MSSqlServer; +using StackifyLib; namespace Sloth.Api.Logging { @@ -60,6 +61,11 @@ public static LoggerConfiguration GetConfiguration() // add in stackify sink if the api key is valid if (!string.IsNullOrEmpty(loggingSection.GetValue("ApiKey"))) { + if (!_loggingSetup) + { + _configuration.ConfigureStackifyLogging(); // applies stackify settings + } + logConfig = logConfig.WriteTo.Stackify(); } diff --git a/Sloth.Jobs.Core/Logging/LoggingConfiguration.cs b/Sloth.Jobs.Core/Logging/LoggingConfiguration.cs index 6cdb1461..92de6c30 100644 --- a/Sloth.Jobs.Core/Logging/LoggingConfiguration.cs +++ b/Sloth.Jobs.Core/Logging/LoggingConfiguration.cs @@ -8,6 +8,7 @@ using Serilog.Sinks.Elasticsearch; using Serilog.Sinks.MSSqlServer; using Serilog.Sinks.MSSqlServer.Sinks.MSSqlServer.Options; +using StackifyLib; namespace Sloth.Jobs.Core.Logging { @@ -66,6 +67,11 @@ public static LoggerConfiguration GetConfiguration() // add in stackify sink if the api key is valid if (!string.IsNullOrEmpty(loggingSection.GetValue("ApiKey"))) { + if (!_loggingSetup) + { + _configuration.ConfigureStackifyLogging(); // applies stackify settings + } + logConfig = logConfig.WriteTo.Stackify(); }