Skip to content

AppSettings.json to configure Serilog.File Sink doesn't seem to work #10965

Description

@mistyn8

Which exact Umbraco version are you using? For example: 8.13.1 - don't just write v8

v9-rc002

Bug summary

 "Serilog": {
    "MinimumLevel": {
      "Default": "Information"
    },
    "WriteTo": [
      {
        "Name": "Async",
        "Args": {
          "configure": [
            {
              "Name": "Console"
            },
            {
              "Name": "File",
              "Args": {
                "restrictedToMinimumLevel": "Warning"
              }
            }            
          ]
        }
      }      
    ]
  },

I'm expecting that the json files only now write warning logs, but information logs are still appended.

Specifics

Ps I'm wanting to do this as Using Seq Sink for better structured logging/reporting/interrogation.. so would like information logging there, so only require minimal logging in json files.

https://github.com/serilog/serilog/wiki/Configuration-Basics#overriding-per-sink

Setting the minimumLevel for serilog globally would affect all sinks.

https://github.com/umbraco/Umbraco-CMS/blob/48fcfcae21c579231268147167619274482abef3/src/Umbraco.Infrastructure/Logging/Serilog/LoggerConfigExtensions.cs presumably is where config needs to take account of appsettings.json

Steps to reproduce

update appsettings.json as in the summary, and json file based logs are not restricted to Warning.

Expected result / actual result

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions