When Application Insights is enabled in an app via Microsoft.AspNetCore.ApplicationInsights.HostingStartup it needs to enable the AppInsights logger provider by default with the following categories & levels:
| Category |
Level |
| Default |
Information |
| System.* |
Warning |
| Microsoft.* |
Warning |
Additionally, it needs to add a JSON file configuration provider pointing to an (optional) file called ApplicationInsights.settings.json which overrides the above defaults when present. This file will be in the layout of an Azure App Service app in [HomeFolder]\site\diagnostics (see here for another example). This should "just work" based on the recently added configuration driven logging settings support we added.
E.g.: D:\home\site\diagnostics\ApplicationInsights.settings.json
{
"Logging": {
"ApplicationInsights": {
"Microsoft.AspNetCore.Kestrel": "Debug",
"Microsoft.AspNetCore.Mvc": "Information"
}
}
}
Note about Visual Studio Debugging
When running in Visual Studio 2017 under the debugger, the existing Application Insights logger behavior needs to be preserved, i.e. all logger messages are sent to Application Insights if no instrumentation key is configured, such that they show up in the in-VS Application Insights search experience.
@glennc