Azure Bot logging

2019-09-20 13:21发布

问题:

I have a Bot configured for Teams and hosted in Azure. I have a couple of graph api requests sent from the Bot. I would like to log the time between request, response, and other related exceptions thrown. Where is this log best kept for an Azure hosted Bot?

回答1:

This can be done automatically when you choose to integrate Application Insights. See this guide:

Application Insights helps you get actionable insights through application performance management (APM) and instant analytics. Out of the box you get rich performance monitoring, powerful alerting, and easy-to-consume dashboards to help ensure your Bot is available and performing as you expect. You can quickly see if you have a problem, then perform a root cause analysis to find and fix the issue.

You can also keep track of bot messages analytics using Application Insights (source):

Analytics is an extension of Application Insights. Application Insights provides service-level and instrumentation data like traffic, latency, and integrations. Analytics provides conversation-level reporting on user, message, and channel data.



回答2:

The easiest way (if you re hosting it on Azure App Service), is to enable App logging and then use Stream Logs Service. Of course, on your app you would need to use Trace class and log the events manually.

Check: https://docs.microsoft.com/en-us/azure/app-service/web-sites-enable-diagnostic-log