diff --git a/examples/Serilog/Client/Client.csproj b/examples/Serilog/Client/Client.csproj index b7b550c..fe0c934 100644 --- a/examples/Serilog/Client/Client.csproj +++ b/examples/Serilog/Client/Client.csproj @@ -2,7 +2,7 @@ Exe - net7.0 + net8.0 @@ -18,9 +18,9 @@ - - - + + + diff --git a/examples/Serilog/Service/Program.cs b/examples/Serilog/Service/Program.cs index 03ba23f..947e314 100644 --- a/examples/Serilog/Service/Program.cs +++ b/examples/Serilog/Service/Program.cs @@ -4,13 +4,16 @@ WebApplicationBuilder builder = WebApplication.CreateBuilder(args); -builder.WebHost - .UseSerilog((ctx, loggerConfig) => loggerConfig - .ReadFrom.Configuration(ctx.Configuration) - .Enrich.FromLogContext() - // Add the property to the template explicitly, or log all properties with {Properties}. - .WriteTo.Console(outputTemplate: "Message: {Message:lj}{NewLine}\tCorrelation ID: {CorrelationId}{NewLine}") - .WriteTo.Debug() +builder.Services + .AddLogging(configure => configure.AddSerilog( + new LoggerConfiguration() + .ReadFrom.Configuration(builder.Configuration) + .Enrich.FromLogContext() + // Add the property to the template explicitly, or log all properties with {Properties}. + .WriteTo.Console(outputTemplate: "Message: {Message:lj}{NewLine}\tCorrelation ID: {CorrelationId}{NewLine}") + .WriteTo.Debug() + .CreateLogger() + ) ); builder.Services diff --git a/examples/Serilog/Service/Service.csproj b/examples/Serilog/Service/Service.csproj index b26d256..6c63e86 100644 --- a/examples/Serilog/Service/Service.csproj +++ b/examples/Serilog/Service/Service.csproj @@ -1,12 +1,12 @@  - net7.0 + net8.0 - - + +