datalust / serilog-sinks-seq

A Serilog sink that writes events to the Seq structured log server
https://datalust.co/seq
Apache License 2.0
239 stars 50 forks source link

How to configure Seq sink in ASP.NET Core 2? #96

Closed RPM1984 closed 6 years ago

RPM1984 commented 6 years ago

Hi,

So, simple question and i'm hoping it's a simple answer...

How do we configure the Seq sink/server URL in appsettings.json (ie ASP.NET Core 2).

Program.cs:

var configuration = new ConfigurationBuilder()
                .SetBasePath(Directory.GetCurrentDirectory())
                .AddJsonFile("appsettings.json", false, true)
                .AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Production"}.json", true)
                .Build();

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

appsettings.json:

{
  "Serilog": {
   // what do i do here to configure Seq sink?
  }
}

Thanks 😊

RPM1984 commented 6 years ago

Sorry, my mistake... i (somehow/stupidly) missed the info on the main page. My bad