Skip to content

Commit

Permalink
Merge pull request #406 from ucdavis/srk/stack-is-back
Browse files Browse the repository at this point in the history
need to call ConfigureStackifyLogging
  • Loading branch information
srkirkland authored Jan 19, 2024
2 parents c0b7f03 + 3f0de83 commit f032efb
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 3 deletions.
6 changes: 6 additions & 0 deletions Sloth.Api/Logging/LoggingConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Serilog.Exceptions;
using Serilog.Sinks.Elasticsearch;
using Serilog.Sinks.MSSqlServer;
using StackifyLib;

namespace Sloth.Api.Logging
{
Expand Down Expand Up @@ -60,6 +61,11 @@ public static LoggerConfiguration GetConfiguration()
// add in stackify sink if the api key is valid
if (!string.IsNullOrEmpty(loggingSection.GetValue<string>("ApiKey")))
{
if (!_loggingSetup)
{
_configuration.ConfigureStackifyLogging(); // applies stackify settings
}

logConfig = logConfig.WriteTo.Stackify();
}

Expand Down
1 change: 1 addition & 0 deletions Sloth.Api/Sloth.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<PackageReference Include="Serilog.Sinks.Elasticsearch" Version="8.4.1" />
<PackageReference Include="Serilog.Sinks.MSSqlServer" Version="5.7.1" />
<PackageReference Include="Serilog.Sinks.Stackify" Version="2.0.2" />
<PackageReference Include="StackifyLib" Version="2.2.13" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.3.1" />
</ItemGroup>

Expand Down
6 changes: 6 additions & 0 deletions Sloth.Jobs.Core/Logging/LoggingConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -66,6 +67,11 @@ public static LoggerConfiguration GetConfiguration()
// add in stackify sink if the api key is valid
if (!string.IsNullOrEmpty(loggingSection.GetValue<string>("ApiKey")))
{
if (!_loggingSetup)
{
_configuration.ConfigureStackifyLogging(); // applies stackify settings
}

logConfig = logConfig.WriteTo.Stackify();
}

Expand Down
1 change: 1 addition & 0 deletions Sloth.Jobs.Core/Sloth.Jobs.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<PackageReference Include="Serilog.Sinks.Elasticsearch" Version="8.4.1" />
<PackageReference Include="Serilog.Sinks.MSSqlServer" Version="5.7.1" />
<PackageReference Include="Serilog.Sinks.Stackify" Version="2.0.2" />
<PackageReference Include="StackifyLib" Version="2.2.13" />
</ItemGroup>

</Project>
10 changes: 7 additions & 3 deletions Sloth.Web/Logging/LoggingConfiguration.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand Down Expand Up @@ -61,9 +60,14 @@ public static LoggerConfiguration GetConfiguration()
// add in stackify sink if the api key is valid
if (!string.IsNullOrEmpty(loggingSection.GetValue<string>("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<string>("ElasticUrl"), UriKind.Absolute, out var elasticUri))
{
Expand Down
2 changes: 2 additions & 0 deletions Sloth.Web/Sloth.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
<PackageReference Include="Serilog.Sinks.Stackify" Version="2.0.2" />

<PackageReference Include="SSH.NET" Version="2020.0.2" />

<PackageReference Include="StackifyLib" Version="2.2.13" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit f032efb

Please sign in to comment.