0
votes

I have a .NET Core 2.1 application (Web API) where I added logging providers for the Console and ApplicationInsights.
I followed the instructions from this article to learn, how the logger works. Later I added ApplicationInsights Provider what I learned from this example.

My configuration file just looks like that:

  "Logging": {
    "LogLevel": {
      "Default": "Trace"
    }
  },

Nothing else.
I expect to get all log messages to appear in ApplicationInsights, but however only warning messages, error messages and critical messages appear there.
All logs with level < warning does not appear there.

If I add a specific log level "debug" for ApplicationInsights, this also does not work.

Any ideas what I might do wrong?

1

1 Answers

1
votes

If you read thoroughly the documentation page that you posted, in the sub-section

ILogger logs

it is stated that the default logging level is =< Warning.

You will find an official Microsoft link on how to change minimum logging levels here.

What you need to do to change log level for Application Insights is set your configuration file like below:

{
  "Logging": {
    "LogLevel": {
      "Default": "Warning"
    },
    "ApplicationInsights": {
      "LogLevel": {
        "Microsoft": "Error"
      }
    }
  }
}