From f5a229c1d5d98cf9b56635036a9ad1e6464e2af9 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 6 Aug 2025 17:47:42 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E7=BA=A7=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.API/_ServiceExtensions/SerilogSetup.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/IRaCIS.Core.API/_ServiceExtensions/SerilogSetup.cs b/IRaCIS.Core.API/_ServiceExtensions/SerilogSetup.cs index 455fcf589..221076e35 100644 --- a/IRaCIS.Core.API/_ServiceExtensions/SerilogSetup.cs +++ b/IRaCIS.Core.API/_ServiceExtensions/SerilogSetup.cs @@ -22,6 +22,8 @@ namespace IRaCIS.Core.API var config = new LoggerConfiguration() .MinimumLevel.Information() .MinimumLevel.Override("Microsoft", LogEventLevel.Information) + .MinimumLevel.Override("MassTransit", LogEventLevel.Warning) + .MinimumLevel.Override("FusionCache", LogEventLevel.Warning) // Filter out ASP.NET Core infrastructre logs that are Information and below 日志太多了 一个请求 记录好几条 .MinimumLevel.Override("Microsoft.AspNetCore", LogEventLevel.Warning) .MinimumLevel.Override("Microsoft.AspNetCore.Hosting", LogEventLevel.Warning) From 492312f5957126ebcfd489756173485cab382874 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 7 Aug 2025 09:13:55 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E7=BA=A7=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.API/_ServiceExtensions/SerilogSetup.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/IRaCIS.Core.API/_ServiceExtensions/SerilogSetup.cs b/IRaCIS.Core.API/_ServiceExtensions/SerilogSetup.cs index 221076e35..1d9b30a9b 100644 --- a/IRaCIS.Core.API/_ServiceExtensions/SerilogSetup.cs +++ b/IRaCIS.Core.API/_ServiceExtensions/SerilogSetup.cs @@ -23,14 +23,16 @@ namespace IRaCIS.Core.API .MinimumLevel.Information() .MinimumLevel.Override("Microsoft", LogEventLevel.Information) .MinimumLevel.Override("MassTransit", LogEventLevel.Warning) - .MinimumLevel.Override("FusionCache", LogEventLevel.Warning) + //https://github.com/ZiggyCreatures/FusionCache/blob/main/docs/Logging.md + .MinimumLevel.Override("ZiggyCreatures.Caching.Fusion", LogEventLevel.Warning) + // Filter out ASP.NET Core infrastructre logs that are Information and below 日志太多了 一个请求 记录好几条 .MinimumLevel.Override("Microsoft.AspNetCore", LogEventLevel.Warning) .MinimumLevel.Override("Microsoft.AspNetCore.Hosting", LogEventLevel.Warning) .MinimumLevel.Override("Microsoft.AspNetCore.Mvc", LogEventLevel.Warning) .MinimumLevel.Override("Microsoft.AspNetCore.Routing", LogEventLevel.Warning) .MinimumLevel.Override("Hangfire", LogEventLevel.Warning) - .Enrich.FromLogContext() + .Enrich.FromLogContext() .Filter.ByExcluding(logEvent => logEvent.Properties.ContainsKey("RequestPath") && logEvent.Properties["RequestPath"].ToString().Contains("/health")) .WriteTo.Console() .WriteTo.File($"{AppContext.BaseDirectory}Serilogs/.log", rollingInterval: RollingInterval.Day,retainedFileCountLimit:60);