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.Api/Sloth.Api.csproj b/Sloth.Api/Sloth.Api.csproj index c27219ee..48227942 100644 --- a/Sloth.Api/Sloth.Api.csproj +++ b/Sloth.Api/Sloth.Api.csproj @@ -30,6 +30,7 @@ + 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(); } diff --git a/Sloth.Jobs.Core/Sloth.Jobs.Core.csproj b/Sloth.Jobs.Core/Sloth.Jobs.Core.csproj index b1fcaec6..11e4ac05 100644 --- a/Sloth.Jobs.Core/Sloth.Jobs.Core.csproj +++ b/Sloth.Jobs.Core/Sloth.Jobs.Core.csproj @@ -19,6 +19,7 @@ + diff --git a/Sloth.Web/Logging/LoggingConfiguration.cs b/Sloth.Web/Logging/LoggingConfiguration.cs index 21455c5e..fa67440f 100644 --- a/Sloth.Web/Logging/LoggingConfiguration.cs +++ b/Sloth.Web/Logging/LoggingConfiguration.cs @@ -1,14 +1,13 @@ using System; using System.Collections.Generic; using System.Data; -using System.Diagnostics; using Microsoft.Extensions.Configuration; using Serilog; using Serilog.Events; using Serilog.Exceptions; using Serilog.Sinks.Elasticsearch; using Serilog.Sinks.MSSqlServer; -using Serilog.Sinks.MSSqlServer.Sinks.MSSqlServer.Options; +using StackifyLib; namespace Sloth.Web.Logging { @@ -61,9 +60,14 @@ 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(); } - + // add in elastic search sink if the uri is valid if (Uri.TryCreate(loggingSection.GetValue("ElasticUrl"), UriKind.Absolute, out var elasticUri)) { diff --git a/Sloth.Web/Sloth.Web.csproj b/Sloth.Web/Sloth.Web.csproj index 8e373590..4841b318 100644 --- a/Sloth.Web/Sloth.Web.csproj +++ b/Sloth.Web/Sloth.Web.csproj @@ -38,6 +38,8 @@ + +