chrisdot
chrisdot

Reputation: 789

Using application insights, metrics tracking is ok, but can not find the logs

I set up a POC/demo project to test application insights in order to have a full observability experience. I think I followed the different recommandation, like using the workspace-based application insight resource, using the connection string approach (rather than the instrumentation key one), and used the C#/.net 6 minimal web api project template modified as described to enable/configure the application insights telemetry.

When I run my example, everything works fine regarding metrics, live metrics, application maps up to the application insight workspace (I can visualize charts, see the live metrics, start a map...).

BUT I can not see any logs... Where should I find those? How can I trouble shoot this?

(I added a console output for the loggs just to check if filtering is ok, but it works also...)

Upvotes: 0

Views: 833

Answers (1)

Peter Bons
Peter Bons

Reputation: 29770

Do mind that if you write logs using the ILogger interface with severity level "Information" like this _logger.LogInformation("Some Info"); you need to adjust the loglevel settings because the default settings only log trace telemetry of level warning and up.

You can modify that in the configuration (also, see the docs):

{
  "Logging": {
    "LogLevel": {
      "Default": "Information"
    },
    "ApplicationInsights": {
      "LogLevel": {
        "Default": "Information"
      }
    }
  }
}

You can use the transaction search in the portal:

enter image description here

Or you can query the workspace directly:

enter image description here

Upvotes: 2

Related Questions