I have an ASP net 5. I can't see my custom Traces, but I can see Metrics and Dependencies I thought that it was a problem with LogLevel, but seems I can't spot the right settings:
Startup.cs
public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews();
services.AddApplicationInsightsTelemetry(Configuration["ApplicationInsights:ConnectionString"]);
}
appsettings.json
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Information",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*",
"ApplicationInsights": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Information"
},
"ConnectionString": "InstrumentationKey=*****;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/"
},
code:
public async Task SendMessageAsync()
{
...
using (this._logger.BeginScope(nameof(SendMessageAsync)))
{
...
_logger.LogInformation($"Message sent...");
...
}
}
In the VS Output I see the Information msg being logged, but not the AppInsights Telemetry for the LogInformation
SenderApp.Controllers.HomeController: Information: Message sent...
Application Insights Telemetry: {"name":"AppDependencies","time":...
Application Insights Telemetry: {"name":"AppDependencies","time":...
The answer was very simple, but not easy to debug.
The logging settings for AppInsights in
appsettings.josn
should be underLogging