From 39692bec2c210292dae08c0d0faaebf121c56cf1 Mon Sep 17 00:00:00 2001 From: Dominion Date: Wed, 17 May 2023 23:10:38 -0400 Subject: [PATCH] Actually enable node request logging in swarm mode --- src/Tgstation.Server.Host/Core/Application.cs | 5 ++++- tests/Tgstation.Server.Tests/Live/LiveTestingServer.cs | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Tgstation.Server.Host/Core/Application.cs b/src/Tgstation.Server.Host/Core/Application.cs index 9ce061cd03..0daf42748d 100644 --- a/src/Tgstation.Server.Host/Core/Application.cs +++ b/src/Tgstation.Server.Host/Core/Application.cs @@ -435,7 +435,10 @@ namespace Tgstation.Server.Host.Core }); // setup the HTTP request pipeline - // Final point where we wrap exceptions in a 500 (ErrorMessage) response + // Add additional logging context to the request + applicationBuilder.UseAdditionalRequestLoggingContext(swarmConfiguration); + + // Wrap exceptions in a 500 (ErrorMessage) response applicationBuilder.UseServerErrorHandling(); // Add the X-Powered-By response header diff --git a/tests/Tgstation.Server.Tests/Live/LiveTestingServer.cs b/tests/Tgstation.Server.Tests/Live/LiveTestingServer.cs index ccc564461e..4508ee9fc1 100644 --- a/tests/Tgstation.Server.Tests/Live/LiveTestingServer.cs +++ b/tests/Tgstation.Server.Tests/Live/LiveTestingServer.cs @@ -14,6 +14,7 @@ using Tgstation.Server.Api.Models; using Tgstation.Server.Host; using Tgstation.Server.Host.Configuration; using Tgstation.Server.Host.Core; +using Tgstation.Server.Host.Extensions; using Tgstation.Server.Host.Setup; using Tgstation.Server.Host.Utils; @@ -189,7 +190,9 @@ namespace Tgstation.Server.Tests.Live if (firstRun) args[0] = string.Format(CultureInfo.InvariantCulture, "Database:DropDatabase={0}", false); - using (swarmNodeId != null + var swarmMode = swarmNodeId != null; + ApplicationBuilderExtensions.LogSwarmIdentifier = swarmMode; + using (swarmMode ? LogContext.PushProperty(SerilogContextHelper.SwarmIdentifierContextProperty, swarmNodeId) : null) await RealServer.Run(cancellationToken);