From 1681a73b259ae4656042912596b41d4f46ef1dfe Mon Sep 17 00:00:00 2001 From: James Gunn Date: Tue, 2 Jul 2024 16:32:55 +0100 Subject: [PATCH] Reduce the console logs (#1403) --- TeachingRecordSystem/Directory.Packages.props | 1 + .../appsettings.Production.json | 10 ++++++++++ .../src/TeachingRecordSystem.Api/appsettings.json | 3 ++- .../appsettings.Production.json | 10 ++++++++++ .../appsettings.json | 3 ++- .../TeachingRecordSystem.Core.csproj | 1 + .../appsettings.Production.json | 10 ++++++++++ .../TeachingRecordSystem.SupportUi/appsettings.json | 3 ++- .../src/TeachingRecordSystem.Worker/appsettings.json | 2 +- 9 files changed, 39 insertions(+), 4 deletions(-) diff --git a/TeachingRecordSystem/Directory.Packages.props b/TeachingRecordSystem/Directory.Packages.props index 6d7a1c238..550e7dcb5 100644 --- a/TeachingRecordSystem/Directory.Packages.props +++ b/TeachingRecordSystem/Directory.Packages.props @@ -77,6 +77,7 @@ + diff --git a/TeachingRecordSystem/src/TeachingRecordSystem.Api/appsettings.Production.json b/TeachingRecordSystem/src/TeachingRecordSystem.Api/appsettings.Production.json index 63547fffc..1abcfe469 100644 --- a/TeachingRecordSystem/src/TeachingRecordSystem.Api/appsettings.Production.json +++ b/TeachingRecordSystem/src/TeachingRecordSystem.Api/appsettings.Production.json @@ -10,5 +10,15 @@ "IncludeActivityData": true, "MaxRequestBodySize": "None", "TracesSampleRate": 0 + }, + "Serilog": { + "Filter": [ + { + "Name": "ByIncludingOnly", + "Args": { + "expression": "@l = 'Error' or StartsWith(@m, 'Request finished')" + } + } + ] } } diff --git a/TeachingRecordSystem/src/TeachingRecordSystem.Api/appsettings.json b/TeachingRecordSystem/src/TeachingRecordSystem.Api/appsettings.json index 457c10979..41f4cff87 100644 --- a/TeachingRecordSystem/src/TeachingRecordSystem.Api/appsettings.json +++ b/TeachingRecordSystem/src/TeachingRecordSystem.Api/appsettings.json @@ -3,7 +3,8 @@ "MinimumLevel": { "Default": "Information" }, - "Enrich": [ "FromLogContext" ] + "Enrich": [ "FromLogContext" ], + "Using": [ "Serilog.Expressions" ] }, "AllowedHosts": "*", "RecurringJobs": { diff --git a/TeachingRecordSystem/src/TeachingRecordSystem.AuthorizeAccess/appsettings.Production.json b/TeachingRecordSystem/src/TeachingRecordSystem.AuthorizeAccess/appsettings.Production.json index 5bd3960dc..8fb1c2364 100644 --- a/TeachingRecordSystem/src/TeachingRecordSystem.AuthorizeAccess/appsettings.Production.json +++ b/TeachingRecordSystem/src/TeachingRecordSystem.AuthorizeAccess/appsettings.Production.json @@ -4,5 +4,15 @@ "IncludeActivityData": true, "MaxRequestBodySize": "None", "TracesSampleRate": 0 + }, + "Serilog": { + "Filter": [ + { + "Name": "ByIncludingOnly", + "Args": { + "expression": "@l = 'Error' or StartsWith(@m, 'Request finished')" + } + } + ] } } diff --git a/TeachingRecordSystem/src/TeachingRecordSystem.AuthorizeAccess/appsettings.json b/TeachingRecordSystem/src/TeachingRecordSystem.AuthorizeAccess/appsettings.json index cbf48727d..130b8d51d 100644 --- a/TeachingRecordSystem/src/TeachingRecordSystem.AuthorizeAccess/appsettings.json +++ b/TeachingRecordSystem/src/TeachingRecordSystem.AuthorizeAccess/appsettings.json @@ -6,7 +6,8 @@ "Microsoft.AspNetCore": "Warning" } }, - "Enrich": [ "FromLogContext" ] + "Enrich": [ "FromLogContext" ], + "Using": [ "Serilog.Expressions" ] }, "AllowedHosts": "*", "RequestTrnSupportEmail": "qts.enquiries@education.gov.uk" diff --git a/TeachingRecordSystem/src/TeachingRecordSystem.Core/TeachingRecordSystem.Core.csproj b/TeachingRecordSystem/src/TeachingRecordSystem.Core/TeachingRecordSystem.Core.csproj index 069d06228..3be366662 100644 --- a/TeachingRecordSystem/src/TeachingRecordSystem.Core/TeachingRecordSystem.Core.csproj +++ b/TeachingRecordSystem/src/TeachingRecordSystem.Core/TeachingRecordSystem.Core.csproj @@ -139,6 +139,7 @@ + diff --git a/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/appsettings.Production.json b/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/appsettings.Production.json index 2c63c0851..0daa0c101 100644 --- a/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/appsettings.Production.json +++ b/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/appsettings.Production.json @@ -1,2 +1,12 @@ { + "Serilog": { + "Filter": [ + { + "Name": "ByIncludingOnly", + "Args": { + "expression": "@l = 'Error' or StartsWith(@m, 'Request finished')" + } + } + ] + } } diff --git a/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/appsettings.json b/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/appsettings.json index fc6d9069e..f69f51c7f 100644 --- a/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/appsettings.json +++ b/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/appsettings.json @@ -6,7 +6,8 @@ "Microsoft.AspNetCore": "Warning" } }, - "Enrich": [ "FromLogContext" ] + "Enrich": [ "FromLogContext" ], + "Using": [ "Serilog.Expressions" ] }, "AzureAd": { "Instance": "https://login.microsoftonline.com/", diff --git a/TeachingRecordSystem/src/TeachingRecordSystem.Worker/appsettings.json b/TeachingRecordSystem/src/TeachingRecordSystem.Worker/appsettings.json index 13409ce24..e7f3c29f4 100644 --- a/TeachingRecordSystem/src/TeachingRecordSystem.Worker/appsettings.json +++ b/TeachingRecordSystem/src/TeachingRecordSystem.Worker/appsettings.json @@ -1,7 +1,7 @@ { "Serilog": { "MinimumLevel": { - "Default": "Information" + "Default": "Error" }, "Enrich": [ "FromLogContext" ] },