{ "Logging": { "LogLevel": { "Default": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information", "HttpClient": "Information" } }, "Serilog": { "Using": [ "Serilog.Sinks.File", "Serilog.Sinks.Async", "Serilog.Sinks.Console", "Serilog.Expressions" ], "MinimumLevel": { "Default": "Verbose", "Override": { "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information", "HttpClient": "Information" } }, "WriteTo": [ { "Name": "Console", "Args": { "restrictedToMinimumLevel": "Verbose", "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff }[{Level:u3}] [Thread-{ThreadId}] [{SourceContext:l}] [{RequestId}] {Message:lj}{NewLine}{Exception}", "theme": "Serilog.Sinks.SystemConsole.Themes.AnsiConsoleTheme::Code, Serilog.Sinks.Console" } }, { "Name": "Logger", "Args": { "ConfigureLogger": { "WriteTo": [ { "Name": "File", "Args": { "RestrictedToMinimumLevel": "Information", "RollingInterval": "Day", "RollOnFileSizeLimit": "true", "OutputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff }[{Level:u3}] [Thread-{ThreadId}] [{SourceContext:l}] [{RequestId}] {Message:lj}{NewLine}{Exception}", "Path": "/var/near_card_attendance/logs/infos/info.log", "RetainedFileCountLimit": 10 // "--设置日志文件个数最大值,默认31,意思就是只保留最近的31个日志文件", "等于null时永远保留文件": null //"FileSizeLimitBytes": 20971520, //设置单个文件大小为3M 默认1G //"RollOnFileSizeLimit": true //超过文件大小后创建新的 } } ], "Filter": [ { "Name": "ByIncludingOnly", "Args": { "Expression": "@l = 'Information'" } } ] } } }, { "Name": "Logger", "Args": { "ConfigureLogger": { "WriteTo": [ { "Name": "File", "Args": { "RestrictedToMinimumLevel": "Warning", "RollingInterval": "Day", "RollOnFileSizeLimit": "true", "OutputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff }[{Level:u3}] [Thread-{ThreadId}] [{SourceContext:l}] [{RequestId}] {Message:lj}{NewLine}", "Path": "/var/near_card_attendance/logs/warnings/warn.log", "RetainedFileCountLimit": 10 } } ], "Filter": [ { "Name": "ByIncludingOnly", "Args": { "Expression": "@l = 'Warning'" } } ] } } }, { "Name": "Logger", "Args": { "ConfigureLogger": { "WriteTo": [ { "Name": "File", "Args": { "RestrictedToMinimumLevel": "Error", "RollingInterval": "Day", "RollOnFileSizeLimit": "true", "OutputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff }[{Level:u3}] [Thread-{ThreadId}][{SourceContext:l}] [{RequestId}] {Message:lj}{NewLine}{Exception}", "Path": "/var/near_card_attendance/logs/errors/error.log", "RetainedFileCountLimit": 15 // "--设置日志文件个数最大值,默认31,意思就是只保留最近的31个日志文件", "等于null时永远保留文件": null //"FileSizeLimitBytes": 20971520, //设置单个文件大小为3M 默认1G //"RollOnFileSizeLimit": true //超过文件大小后创建新的 } } ], "Filter": [ { "Name": "ByIncludingOnly", "Args": { "Expression": "@l = 'Error'" } } ] } } } ] } }