How should you comp...
 
Notifications
Clear all

How should you complete the code? To answer, drag the appropriate code segments to the correct locations. Each code segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.

1 Posts
1 Users
0 Likes
134 Views
(@benninkcarrol)
Noble Member
Joined: 2 years ago
Posts: 687
Topic starter  

DRAG DROP

You are developing an ASP.NET Core Web API web service that uses Azure Application Insights to monitor performance and track events.

You need to enable logging and ensure that log messages can be correlated to events tracked by Application Insights.

How should you complete the code? To answer, drag the appropriate code segments to the correct locations. Each code segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content. NOTE: Each correct selection is worth one point.

Show Answer Hide Answer

Suggested Answer:

Explanation:

Box 1: ApplicationInsightsLoggerOptions

If you want to include the EventId and EventName properties, then add the following to the ConfigureServices method:

services

AddOptions<ApplicationInsightsLoggerOptions>()

Configure(o => o.IncludeEventId = true);

Box 2: IncludeEventID

Box 3: ApplicationServices

In Asp.Net core apps it turns out that trace logs do not show up in Application Insights out of the box. We need to add the following code snippet to our Configure method in Startup.cs:

loggerFactory.AddApplicationInsights(app.ApplicationServices, logLevel);

References: https://blog.computedcloud.com/enabling-application-insights-trace-logging-in-asp-net-core/


   
Quote

Latest Microsoft AZ-204 Dumps Valid Version

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund
Share: