From d02697b33838f546413403ec8c33892f9f47fa87 Mon Sep 17 00:00:00 2001 From: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com> Date: Wed, 7 Feb 2024 15:39:58 -1000 Subject: [PATCH] Remove generic host --- aspnetcore/fundamentals/logging/index.md | 95 ++---------------------- 1 file changed, 6 insertions(+), 89 deletions(-) diff --git a/aspnetcore/fundamentals/logging/index.md b/aspnetcore/fundamentals/logging/index.md index 6517f18a44..b8642c680c 100644 --- a/aspnetcore/fundamentals/logging/index.md +++ b/aspnetcore/fundamentals/logging/index.md @@ -23,18 +23,16 @@ This topic describes logging in .NET as it applies to ASP.NET Core apps. For det Logging providers store logs, except for the `Console` provider which displays logs. For example, the Azure Application Insights provider stores logs in [Azure Application Insights](/azure/azure-monitor/app/app-insights-overview). Multiple providers can be enabled. -The default ASP.NET Core web app templates: +The default ASP.NET Core web app templates call , which adds the following logging providers: -* Use the [Generic Host](xref:fundamentals/host/generic-host). -* Call , which adds the following logging providers: - * [Console](#console) - * [Debug](#debug) - * [EventSource](#event-source) - * [EventLog](#welog): Windows only +* [Console](#console) +* [Debug](#debug) +* [EventSource](#event-source) +* [EventLog](#welog): Windows only [!code-csharp[](~/fundamentals/logging/index/samples/6.x/WebApp/Program.cs?name=snippet1&highlight=1)] -The preceding code shows the `Program.cs` file created with the ASP.NET Core web app templates. The next several sections provide samples based on the ASP.NET Core web app templates, which use the Generic Host. +The preceding code shows the `Program.cs` file created with the ASP.NET Core web app templates. The next several sections provide samples based on the ASP.NET Core web app templates. The following code overrides the default set of logging providers added by `WebApplication.CreateBuilder`: @@ -759,87 +757,6 @@ Using a third-party framework is similar to using one of the built-in providers: For more information, see each provider's documentation. Third-party logging providers aren't supported by Microsoft. - - - - ### No asynchronous logger methods Logging should be so fast that it isn't worth the performance cost of asynchronous code. If a logging data store is slow, don't write to it directly. Consider writing the log messages to a fast store initially, then moving them to the slow store later. For example, when logging to SQL Server, don't do so directly in a `Log` method, since the `Log` methods are synchronous. Instead, synchronously add log messages to an in-memory queue and have a background worker pull the messages out of the queue to do the asynchronous work of pushing data to SQL Server. For more information, see [Guidance on how to log to a message queue for slow data stores (dotnet/AspNetCore.Docs #11801)](https://github.com/dotnet/AspNetCore.Docs/issues/11801).