修改json 日志展示
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
47fe825aa7
commit
de0b95a22b
|
@ -77,6 +77,7 @@
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.10" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.10" />
|
||||||
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
|
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
|
||||||
<PackageReference Include="Serilog.Enrichers.ClientInfo" Version="2.1.2" />
|
<PackageReference Include="Serilog.Enrichers.ClientInfo" Version="2.1.2" />
|
||||||
|
<PackageReference Include="Serilog.Formatting.Compact" Version="3.0.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.9.0" />
|
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.9.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
|
using Serilog.Formatting.Compact;
|
||||||
|
|
||||||
//using Serilog.Sinks.Email;
|
//using Serilog.Sinks.Email;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
|
@ -26,12 +28,20 @@ namespace IRaCIS.Core.API
|
||||||
.Enrich.FromLogContext()
|
.Enrich.FromLogContext()
|
||||||
.Filter.ByExcluding(logEvent => logEvent.Properties.ContainsKey("RequestPath") && logEvent.Properties["RequestPath"].ToString().Contains("/health"))
|
.Filter.ByExcluding(logEvent => logEvent.Properties.ContainsKey("RequestPath") && logEvent.Properties["RequestPath"].ToString().Contains("/health"))
|
||||||
|
|
||||||
//控制台 方便调试 问题 我们显示记录日志 时 获取上下文的ip 和用户名 用户类型
|
//https://github.com/serilog/serilog-formatting-compact
|
||||||
.WriteTo.Console(restrictedToMinimumLevel: LogEventLevel.Warning,
|
// 控制台输出 JSON 格式
|
||||||
outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] {ClientIp} {SourceContext:l} || {Message} || {Exception} ||end {NewLine}")
|
.WriteTo.Console(restrictedToMinimumLevel: LogEventLevel.Warning,
|
||||||
|
formatter: new CompactJsonFormatter())
|
||||||
|
|
||||||
.WriteTo.File($"{AppContext.BaseDirectory}Serilogs/.log", rollingInterval: RollingInterval.Day,
|
// 文件输出 JSON 格式
|
||||||
outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] {ClientIp} {SourceContext:l} || {Message} || {Exception} ||end {NewLine}");
|
.WriteTo.File(new CompactJsonFormatter(),$"{AppContext.BaseDirectory}Serilogs/.json", rollingInterval: RollingInterval.Day);
|
||||||
|
|
||||||
|
////控制台 方便调试 问题 我们显示记录日志 时 获取上下文的ip 和用户名 用户类型
|
||||||
|
//.WriteTo.Console(restrictedToMinimumLevel: LogEventLevel.Warning,
|
||||||
|
// outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] {ClientIp} {SourceContext:l} || {Message} || {Exception} ||end {NewLine}")
|
||||||
|
|
||||||
|
//.WriteTo.File($"{AppContext.BaseDirectory}Serilogs/.log", rollingInterval: RollingInterval.Day,
|
||||||
|
// outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] {ClientIp} {SourceContext:l} || {Message} || {Exception} ||end {NewLine}");
|
||||||
|
|
||||||
|
|
||||||
Log.Logger = config.CreateLogger();
|
Log.Logger = config.CreateLogger();
|
||||||
|
|
|
@ -16806,6 +16806,16 @@
|
||||||
入组 Selection 列表查询参数
|
入组 Selection 列表查询参数
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="P:IRaCIS.Application.Contracts.DoctorBasicInfo.WorkPartTime">
|
||||||
|
<summary>
|
||||||
|
工作兼职
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:IRaCIS.Application.Contracts.DoctorBasicInfo.WorkPartTimeEn">
|
||||||
|
<summary>
|
||||||
|
工作兼职En
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="P:IRaCIS.Application.Contracts.BasicInfoAndEmploymentDto.WorkPartTime">
|
<member name="P:IRaCIS.Application.Contracts.BasicInfoAndEmploymentDto.WorkPartTime">
|
||||||
<summary>
|
<summary>
|
||||||
工作兼职
|
工作兼职
|
||||||
|
|
Loading…
Reference in New Issue