diff --git a/IRaCIS.Core.API/_ServiceExtensions/SerilogSetup.cs b/IRaCIS.Core.API/_ServiceExtensions/SerilogSetup.cs index 7622f1c24..f8eb97fe1 100644 --- a/IRaCIS.Core.API/_ServiceExtensions/SerilogSetup.cs +++ b/IRaCIS.Core.API/_ServiceExtensions/SerilogSetup.cs @@ -1,4 +1,5 @@ -using Serilog; +using DocumentFormat.OpenXml.Bibliography; +using Serilog; using Serilog.Events; using Serilog.Formatting.Compact; @@ -28,12 +29,14 @@ namespace IRaCIS.Core.API .Enrich.FromLogContext() .Filter.ByExcluding(logEvent => logEvent.Properties.ContainsKey("RequestPath") && logEvent.Properties["RequestPath"].ToString().Contains("/health")) - //https://github.com/serilog/serilog-formatting-compact - // 控制台输出 JSON 格式 - .WriteTo.Console(formatter: new CompactJsonFormatter(),LogEventLevel.Warning) + //https://github.com/serilog/serilog-formatting-compact - // 文件输出 JSON 格式 - .WriteTo.File(new CompactJsonFormatter(), $"{AppContext.BaseDirectory}Serilogs/.json", rollingInterval: RollingInterval.Day); + .WriteTo.Console() + .WriteTo.File($"{AppContext.BaseDirectory}Serilogs/.log", rollingInterval: RollingInterval.Day); + //// 控制台输出 JSON 格式 + //.WriteTo.Console(formatter: new CompactJsonFormatter(), LogEventLevel.Warning), + //// 文件输出 JSON 格式 + //.WriteTo.File(new CompactJsonFormatter(), $"{AppContext.BaseDirectory}Serilogs/.json", rollingInterval: RollingInterval.Day); ////控制台 方便调试 问题 我们显示记录日志 时 获取上下文的ip 和用户名 用户类型 //.WriteTo.Console(restrictedToMinimumLevel: LogEventLevel.Warning, diff --git a/IRaCIS.Core.Application/BusinessFilter/LegacyController/ProjectExceptionFilter.cs b/IRaCIS.Core.Application/BusinessFilter/LegacyController/ProjectExceptionFilter.cs index 444c1dfbd..f9fc7aa85 100644 --- a/IRaCIS.Core.Application/BusinessFilter/LegacyController/ProjectExceptionFilter.cs +++ b/IRaCIS.Core.Application/BusinessFilter/LegacyController/ProjectExceptionFilter.cs @@ -57,6 +57,7 @@ public class ProjectExceptionFilter(ILogger _logger, ISt _logger.LogError(errorInfo); + //_logger.LogError(exception, exception.Message); } else { diff --git a/IRaCIS.Core.Application/TestService.cs b/IRaCIS.Core.Application/TestService.cs index c764d0838..61d451cb8 100644 --- a/IRaCIS.Core.Application/TestService.cs +++ b/IRaCIS.Core.Application/TestService.cs @@ -33,12 +33,6 @@ using System.Text; namespace IRaCIS.Core.Application.Service { - - - - - - [ApiExplorerSettings(GroupName = "Institution")] public class TestService(IRepository _dicRepository, IRepository _trialRepository,