Skip to content

Serilog ignores dotnet logging configuration #254

Open
@vars-ecco

Description

@vars-ecco

Hello,

I would like to ask, what is the reason for this line

builder.AddFilter<SerilogLoggerProvider>(null, LogLevel.Trace);

The thing is that I would like to use dotnet configuration for serilog as well, i.e. something like this

"Logging": {
  "LogLevel": {
    "Default": "None"
  },
  "Serilog": {
    "LogLevel": {
      "Default": "Warning"
    }
  }
}

But that line creates a rule that overwrites the logging configuration.

What is a proper way to use serilog with dotnet configuration rules? Should I simply avoid using AddSerilog method and call builder.AddProvider(new SerilogLoggerProvider(logger)) instead?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions