From 208126931f2c948a7caaba792bc95566c51e66d6 Mon Sep 17 00:00:00 2001 From: Steve Gordon Date: Fri, 22 Mar 2024 12:22:03 +0000 Subject: [PATCH] Clarify logging behaviour in troubleshooting doc --- docs/troubleshooting.asciidoc | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/docs/troubleshooting.asciidoc b/docs/troubleshooting.asciidoc index bb00e1d4c..ba23c0943 100644 --- a/docs/troubleshooting.asciidoc +++ b/docs/troubleshooting.asciidoc @@ -39,9 +39,29 @@ The way to collect logs depends on the setup of your application. ==== ASP.NET Core If you added the agent to your application as per the <> document with the `UseAllElasticApm` or `UseElasticApm` method, it will integrate with the -https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging/?view=aspnetcore-3.1[ASP.NET Core logging infrastructure]. +https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging[ASP.NET Core logging infrastructure]. This means the Agent will pick up the configured logging provider and log as any other component logs. +[IMPORTANT] +-- +In this scenario, the `LogLevel` APM agent configuration (e.g. setting the `ELASTIC_APM_LOG_LEVEL` environment variable) DOES NOT control the +verbosity of the agent logs. The agent logs are controlled by the ASP.NET Core logging configuration from `IConfiguration`, typically configured +via `appsettings.json`. +-- + +For example, the following configuration in `appsettings.json` limits APM agents logs to those with a log level of `Warning` or higher: + +[source,xml] +---- +"Logging": { + "LogLevel": { + "Default": "Information", + "Elastic.Apm": "Warning" <1> + } +}, +---- +<1> Control the verbosity of the agent logs by setting the log level for the `Elastic.Apm` category + [float] [[collect-logs-classic]] ==== ASP.NET Classic