Skip to content

Commit

Permalink
Remove NetEscapades.Extensions.Logging.RollingFile because it's incom…
Browse files Browse the repository at this point in the history
…patible with our updated automatic logs correlation (#5689)
  • Loading branch information
zacharycmontoya authored Jun 13, 2024
1 parent 236edd5 commit 1c5f274
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<ItemGroup>
<PackageReference Include="Datadog.Trace.Bundle" Version="2.53.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<PackageReference Include="NetEscapades.Extensions.Logging.RollingFile" Version="2.5.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,6 @@ public static IHostBuilder CreateHostBuilder(string[] args)
{
return Host.CreateDefaultBuilder(args)
.ConfigureServices(services => services.AddHostedService<Worker>())
#if NETCOREAPP3_0_OR_GREATER
.ConfigureLogging(logging =>
{
// The JsonFormatter used by NetEscapades.Extensions.Logging.RollingFile includes all properties
// if scopes are enabled - however, it requires .NET 3.0+
//
// Additions to configuration:
// - used json format
// - enabled scopes
logging.AddFile(opts =>
{
opts.IncludeScopes = true; // must include scopes so that correlation identifiers are added
opts.FileName = "log-MicrosoftExtensions-jsonFile";
opts.Extension = "log";
opts.FormatterName = "json";
});
});
#else
.ConfigureLogging(logging =>
{
// Using Serilog with Microsoft.Extensions.Logging is supported, but uses the Serilog log injection
Expand All @@ -45,7 +27,6 @@ public static IHostBuilder CreateHostBuilder(string[] args)
.WriteTo.File(new JsonFormatter(), "Logs/log-Serilog-jsonFile.log")
.CreateLogger());
});
#endif
}
}
}

0 comments on commit 1c5f274

Please sign in to comment.