I am trying to use a very simple setup to log my Asp.Net core application events into Azure Analytics. I am using Windows App Service with NetCore 6.0. Everything is working fine, I can see my logs in the AppService Log Stream and Log(Analytics) AppServiceAppLogs table but when I use Scopes for logging like below code, these values are not showing in the logs.
using (logger.BeginScope(new Dictionary<string, object> { { "user" , "Alex" } }))
{
logger.LogInformation("Test Log");
}
I had to add below configuration in Program.cs to see the scopes in the LogStream
builder.Services.Configure<AzureFileLoggerOptions>(options =>
{
options.IncludeScopes = true;
});
but cannot get see them in the Azure Analytics workspace. Anyone has any experince with using scopes/strucutured logging with Azure Analytics and AspNet.Extesions.Logging ?
I tried using Serilog and I am getting nice structured josn log in console on my local machine but again no luck with Azure Analytrics and LogStream.