A centralized logging system sends logs from every application instance to one shared location outside the applications. This avoids collecting files manually from multiple production servers and reduces dependence on remote access, disk space, and file permissions. section 26.3
The destination can be a cloud provider or a third-party log aggregator. Each application instance uses a logging provider to send messages to the same service, while other providers can continue writing to the console or files. section 26.3
Listing 26.5 Adding a third-party logging provider to WebApplicationBuilder
WebApplicationBuilder builder = WebApplication.CreateBuilder(args); #1 builder.Logging.AddFile(); #2 WebApplication app = builder.Build(); app.MapGet("/", () => "Hello world!"); app.Run(); #1 The WebApplicationBuilder configures the console and debug providers as normal. #2 Adds the new file logging provider to the logger factory
Adds a third-party logging provider to WebApplicationBuilder with builder.Logging.AddFile(). section 26.3
Common destinations include:
- Azure App Service, which provides centralized logging through its provider. section 26.3
- Third-party aggregators such as elmah.io or Seq, added through NuGet logging providers. section 26.3


