APM dotnet core agent - disable logging

I am using elastic apm Elastic.Apm.NetCoreAll version 1.25.0.
Tried every possible way to disable the logs:

environment variable ....

Nothing seems to work for me. Logs are still coming, for example:

2023-11-06 15:54:59.637 [INF] [1] {"ConfigurationStore"} Elastic APM .NET Agent, version: 1.25.0+ede1fffffc8b82780f30a35cd4cebf394afdcf8d
2023-11-06 15:54:59.599 [DBG] [1] {"AbstractConfigurationReader (ApmConfiguration)"} GlobalLabels configuration option doesn't have a valid value - using default (empty map)

Should these be affected by the above logging configuration?

Will appreciate if someone can support me on that.


Hi @shlomys

Just to be precise....

Per the docs The Environment Variable Setting would be


And config per here

  "Logging": {
    "LogLevel": { 
      "Default": "Warning",
      "Elastic.Apm": "None"

I tried it as well, doesn't work, I still get log messages.
One thing that may be related is that we use Serilog, but I am not sure if it's related.
I found similar topic at https://discuss.elastic.co/t/dotnet-6-0-log-level-setting/315258/2 and tried to upgrade my apm library but it doesn't seem to resolve the issue.

Hey, @shlomys.

The default log level if unconfigured is Error, yet you have Debug logs showing up too, so something is causing it to be configured at that level. It may depend on your use of Serilog.

Can you share the exact code portions for your app configuration setup (are you using IConfguration?), how you have configured Serilog, and how you registered the agent? That will help us understand the context better.

Hi, found the issue. With Serilog the settings should be similar to the following:

"Serilog": {
"Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File" ],
"MinimumLevel": {
"Default": "Debug",
"Override": {
"System": "Information",
"Microsoft": "Information",
"Microsoft.AspNetCore.Mvc.Infrastructure": "Warning",
"Elastic.Apm": "Fatal"

The minimum Serilog level is Fatal which works for me (couldn't find 'None' for Serilog).

So now I have no Debug logs anymore, as expected. Suggest to add this to the documentation.

Many thanks everyone for the support.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.