Reputation: 85
I've read somewhere that Application Insights should work with structured logs, and I'm trying to log data to Application Insights using ILogger's BeginScope:
using (_logger.BeginScope("Some really useful information"))
{
// something something
_logger.LogError("Oh no.");
}
However, when inspecting the trace in Application Insights, I'm not getting the log data from BeginScope, just "Oh no" in this case. This is a .NET Core 2.0 application. Is BeginScope not supported with the default implementation of Application Insights ILogger? Or am I missing something?
Upvotes: 5
Views: 5483
Reputation: 3196
Application Insights does not yet directly support 'Scopes', but it's in feature backlog. https://github.com/Microsoft/ApplicationInsights-aspnetcore/issues/491
Upvotes: 0
Reputation: 85
I fixed this problem by using Serilog with it's Application Insights sink. Worked perfectly.
Upvotes: 3