billpratt / serilog-sinks-sumologic

A Serilog event sink that writes to Sumo Logic
Apache License 2.0
10 stars 8 forks source link

Usable with serilog-settings-configuration? #2

Closed seangwright closed 7 years ago

seangwright commented 7 years ago

Installed product versions

Description

Is this package usable with the settings configuration approach?

Log.Logger = new LoggerConfiguration()
    .ReadFrom.Configuration(Configuration)
    .CreateLogger();

Steps to recreate

My appsettings.json looks like this now

{
  "Serilog": {
    "Using": [ "Serilog.Sinks.Literate" ],
    "MinimumLevel": "Debug",
    "WriteTo": [
      { "Name": "LiterateConsole" },
      {
        "Name": "RollingFile",
        "Args": {
          "pathFormat": "serilogs//Proj.Api-{Date}.txt"
        }
      },
      {
        "Name": "SumoLogic",
        "endpointUrl": "https://endpoint2.collection.us2.sumologic.com/receiver/v1/http/collection-guid"
      }
    ],
    "Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ],
    "Properties": {
      "Application": "Proj"
    }
  },
}

Current behavior

Unknown

Expected behavior

Configure Sumo Logic sink from appsettings.json

tdawgy commented 7 years ago

I believe this issue can be closed, the below example is working as expected for me :)

"Serilog": { "MinimumLevel": { "Default": "Information", "Override": { "System": "Warning", "Microsoft": "Warning" } }, "WriteTo": [ { "Name": "SumoLogic", "Args": { "endpointUrl": (endpointUrl goes here) } } ] }