Application Insights - Logging exceptions

前端 未结 2 1657
我寻月下人不归
我寻月下人不归 2020-12-17 21:32

I wrote a custom logger for Application Insights in my app. I don\'t see any exceptions or ANY events when viewing App Insights in Azure Portal. Here is the logger class cod

2条回答
  •  猫巷女王i
    2020-12-17 22:05

    Nowadays, the question and the accepted answer are outdated. The contemporary approach is to add Microsoft.ApplicationInsights.AspNet NuGet package, which has logging out-of-the-box.

    Please refer to the official docs.

    The gist from the docs:

    1. ApplicationInsightsLoggerProvider is enabled by default.
    2. Captured log types can be configured in appsettings.json (or programmatically if you really need it)
        "Logging": {
            "LogLevel": {
                "Default": "Warning"
            },
            "ApplicationInsights": {
                "LogLevel": {
                    "Default": "Error"
                }
            }
        }
    

提交回复
热议问题