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?
I fixed this problem by using Serilog with it's Application Insights sink. Worked perfectly.