Closed mehtadone closed 5 years ago
Is this a console application? Which library version are you using?
It's a asp.net core application on dotnet 2.2. The library versions are below ```"Serilog.AspNetCore" Version="2.1.1" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.0.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
<PackageReference Include="Serilog.Sinks.Logz.Io" Version="2.2.0" />
<PackageReference Include="Serilog.Sinks.RollingFile" Version="3.3.0" /```
I have published a new package version 2.2.1 with a fix. Just another note, it looks like you are doing your logger configuration wrong way. Correct one would be user Serilog.AspNetCore package and configure your logger using extension method:
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseSerilog((context, configuration) => configuration.ReadFrom.Configuration(context.Configuration), true)
.UseStartup<Startup>();
I also added example project with it: https://github.com/mantasaudickas/serilog-sinks-logz-io/blob/master/tests/Serilog.Sinks.Logz.Io.AspNetCoreApi/Program.cs#L15 and usage: https://github.com/mantasaudickas/serilog-sinks-logz-io/blob/master/tests/Serilog.Sinks.Logz.Io.AspNetCoreApi/Startup.cs#L38
Thank you for reporting the issue.
Perfect. Thank you for the quick fix. Appreciated.
I have also changed the way I'm setting up my logger, but out of curiosity, what are the benefits of using the extension method vs setting Log.Logger?
Extension methods does more than just sets Log.Logger, but also registers and enables Serilog LoggerFactory.
Hi,
I maybe doing something wrong, but I'm using the following setup but debug logs still get sent to Logz.io
and the setup of the logger is like so: