You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

appsettings.json 4.2KB

1 年之前
1 年之前
1 年之前
1 年之前
1 年之前
1 年之前
1 年之前
1 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. {
  2. "Logging": {
  3. "LogLevel": {
  4. "Default": "Information",
  5. "Microsoft": "Warning",
  6. "Microsoft.Hosting.Lifetime": "Information",
  7. "HttpClient": "Information"
  8. }
  9. },
  10. "Serilog": {
  11. "Using": [ "Serilog.Sinks.File", "Serilog.Sinks.Async", "Serilog.Sinks.Console", "Serilog.Expressions" ],
  12. "MinimumLevel": {
  13. "Default": "Verbose",
  14. "Override": {
  15. "Microsoft": "Warning",
  16. "Microsoft.Hosting.Lifetime": "Information",
  17. "HttpClient": "Information"
  18. }
  19. },
  20. "WriteTo": [
  21. {
  22. "Name": "Console",
  23. "Args": {
  24. "restrictedToMinimumLevel": "Verbose",
  25. "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff }[{Level:u3}] [Thread-{ThreadId}] [{SourceContext:l}] [{RequestId}] {Message:lj}{NewLine}{Exception}",
  26. "theme": "Serilog.Sinks.SystemConsole.Themes.AnsiConsoleTheme::Code, Serilog.Sinks.Console"
  27. }
  28. },
  29. {
  30. "Name": "Logger",
  31. "Args": {
  32. "ConfigureLogger": {
  33. "WriteTo": [
  34. {
  35. "Name": "File",
  36. "Args": {
  37. "RestrictedToMinimumLevel": "Information",
  38. "RollingInterval": "Day",
  39. "RollOnFileSizeLimit": "true",
  40. "OutputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff }[{Level:u3}] [Thread-{ThreadId}] [{SourceContext:l}] [{RequestId}] {Message:lj}{NewLine}{Exception}",
  41. "Path": "/var/health_monitor/logs/infos/info.log",
  42. "RetainedFileCountLimit": 10 // "--设置日志文件个数最大值,默认31,意思就是只保留最近的31个日志文件", "等于null时永远保留文件": null
  43. //"FileSizeLimitBytes": 20971520, //设置单个文件大小为3M 默认1G
  44. //"RollOnFileSizeLimit": true //超过文件大小后创建新的
  45. }
  46. }
  47. ],
  48. "Filter": [
  49. {
  50. "Name": "ByIncludingOnly",
  51. "Args": {
  52. "Expression": "@l = 'Information'"
  53. }
  54. }
  55. ]
  56. }
  57. }
  58. },
  59. {
  60. "Name": "Logger",
  61. "Args": {
  62. "ConfigureLogger": {
  63. "WriteTo": [
  64. {
  65. "Name": "File",
  66. "Args": {
  67. "RestrictedToMinimumLevel": "Warning",
  68. "RollingInterval": "Day",
  69. "RollOnFileSizeLimit": "true",
  70. "OutputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff }[{Level:u3}] [Thread-{ThreadId}] [{SourceContext:l}] [{RequestId}] {Message:lj}{NewLine}",
  71. "Path": "/var/health_monitor/logs/warnings/warn.log",
  72. "RetainedFileCountLimit": 10
  73. }
  74. }
  75. ],
  76. "Filter": [
  77. {
  78. "Name": "ByIncludingOnly",
  79. "Args": {
  80. "Expression": "@l = 'Warning'"
  81. }
  82. }
  83. ]
  84. }
  85. }
  86. },
  87. {
  88. "Name": "Logger",
  89. "Args": {
  90. "ConfigureLogger": {
  91. "WriteTo": [
  92. {
  93. "Name": "File",
  94. "Args": {
  95. "RestrictedToMinimumLevel": "Error",
  96. "RollingInterval": "Day",
  97. "RollOnFileSizeLimit": "true",
  98. "OutputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff }[{Level:u3}] [Thread-{ThreadId}][{SourceContext:l}] [{RequestId}] {Message:lj}{NewLine}{Exception}",
  99. "Path": "/var/health_monitor/logs/errors/error.log",
  100. "RetainedFileCountLimit": 15 // "--设置日志文件个数最大值,默认31,意思就是只保留最近的31个日志文件", "等于null时永远保留文件": null
  101. //"FileSizeLimitBytes": 20971520, //设置单个文件大小为3M 默认1G
  102. //"RollOnFileSizeLimit": true //超过文件大小后创建新的
  103. }
  104. }
  105. ],
  106. "Filter": [
  107. {
  108. "Name": "ByIncludingOnly",
  109. "Args": {
  110. "Expression": "@l = 'Error'"
  111. }
  112. }
  113. ]
  114. }
  115. }
  116. }
  117. ]
  118. }
  119. }