Skip to content

Commit

Permalink
switching to compact json formatter for logs so gelf will parse the p…
Browse files Browse the repository at this point in the history
…roperties
  • Loading branch information
Wes Shaddix committed Nov 21, 2024
1 parent 04fcabc commit 1665ec9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="Scrutor" Version="5.0.2" />
<PackageVersion Include="Serilog" Version="4.1.0" />
<PackageVersion Include="Serilog.Formatting.Compact" Version="3.0.0" />
<PackageVersion Include="Serilog.Settings.Configuration" Version="8.0.4" />
<PackageVersion Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageVersion Include="System.Text.Encodings.Web" Version="9.0.0" />
Expand Down
4 changes: 3 additions & 1 deletion src/Proxy/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Proxy.Shared;
using Serilog;
using Serilog.Events;
using Serilog.Formatting.Compact;

namespace Proxy;

Expand Down Expand Up @@ -74,8 +75,9 @@ private static void ConfigureLogging()

// create the logging configuration
var loggerConfiguration = new LoggerConfiguration()
.Enrich.FromLogContext()
.MinimumLevel.Is(logLevel)
.WriteTo.Console();
.WriteTo.Console(new CompactJsonFormatter());

// set any log properties that are configured
// these should be in the format of property=value,property=value,property=value
Expand Down
1 change: 1 addition & 0 deletions src/Proxy/Proxy.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<PackageReference Include="NATS.Client"/>
<PackageReference Include="Newtonsoft.Json"/>
<PackageReference Include="Serilog"/>
<PackageReference Include="Serilog.Formatting.Compact" />
<PackageReference Include="Serilog.Settings.Configuration"/>
<PackageReference Include="Serilog.Sinks.Console"/>
<PackageReference Include="System.Text.Encodings.Web"/>
Expand Down

0 comments on commit 1665ec9

Please sign in to comment.