Closed stevieray8450 closed 3 years ago
@stevieray8450 Could you please provide a small repro (an archive or a repo) that will help us to investigate this issue.
@rajkumar-rangaraj , sure. Please see https://github.com/stevieray8450/AiTest and supply your own instrumentation key in appsettings.json. Thank you!
https://github.com/stevieray8450/AiTest/blob/master/Program.cs#L20 The Logging provider is replaced with Serilog, so the logs don't get sent to ApplicationInsights.
@cijothomas Thanks for pointing that out. Yet dependency, metric, and request data gets recorded. It seems like I should be able to still collect that exception telemetry, too. How could I get that?
If you replace the logging system with Serilog, (as in the repro you shared), no logging provider can get the logs. (not just application insights, anything like ms.ext.logging.console). You can simply comment out the following lines (https://github.com/stevieray8450/AiTest/blob/master/Program.cs#L20-L25) to get logs flowing to ApplicationInsights (and any other providers).
If you want to keep Serilog as the main provider, and have serilog forward it to others (in the repro, it look like its forwarding to Console), then you need to configure Serilog to sent to ApplicationInsights (I have seen that they do have a sink for application insights as well). Its best to ask in Serilog repo on how to set up that.
Describe the bug
When invoking
ILogger.Log
as mentioned here and here, no exception telemetry is getting captured or recorded. I can observe this from Visual Studio 2019 as well as inside the Azure Application Insights instance accessed via the Azure Portal.Other telemetry -- dependencies, metrics, and requests, for example -- get recorded as expected, and are accessible via Visual Studio 2019 and Azure Portal.
To Reproduce
ApplicationInsights:InstrumentationKey
andLogging:ApplicationInsights:LogLevel:Default
are coming from Azure App Configuration and are configured with the correct instrumentation key (confirmed by the fact that we have other expected telemetry getting recorded) and "Information" value, respectively.Repro code. Simple API controller:
Demonstrating registration at Startup:
Result: neither call to
ILogger.Log
results in exception telemetry getting recordedWe will close this issue if:
For Immediate Support
For immediate support relating to the Application Insights .NET SDK we encourage you to file an Azure Support Request with Microsoft Azure instead of filing a GitHub Issue in this repository. You can do so by going online to the Azure portal and submitting a support request. Access to subscription management and billing support is included with your Microsoft Azure subscription, and technical support is provided through one of the Azure Support Plans. For step-by-step guidance for the Azure portal, see How to create an Azure support request. Alternatively, you can create and manage your support tickets programmatically using the Azure Support ticket REST API