I have an Asp.Net Core 6 Web Api.
I added Application Insights to it and I have stored the Connection string in a local Secrets.json file as is recommended.
I don't want to send telemetry when in debug while I am still developing the app.
I want to be able to switch it on and off while I develop.
What is the best way to do it?
The first thing that comes to my mind is to adjust the log level in appsettings.Development.json:
"ApplicationInsights": {
"LogLevel": {
"Default": "None"
}
}
I see this question here, but all the answers seem outdated because in the documentation it is recommended to make the configurations in appsettings.json, NOT in the code.
Is there a better alternative for Asp.net Core 6 and Microsoft.ApplicationInsights.AspNetCore" Version="2.20.0" than putting the LogLevel to none?
Edit: I use Secrets.json file as recommended here to store the connection string locally.