Error Handling and Log Management in Canvas Apps
Leveraging Azure Application Insights to handle errors and logs.
While developing canvas apps, we may use the IfError, FirstError functions alongside the Notify function to display error details which could help us with debugging.
We cannot afford to do this in production. We must implement some form of log management.
Log management is mandatory because:
- We don't want to display technical errors to end users in production
- Ability to monitor usage and activities.
- We can collect feedbacks from customers. (Interactive)
- Debugging becomes very easy.
- We will be on top of the situation should an emergency occur.(Unexpected, Unhandled events) using Alerts.
- Data can be harnessed for analytics purpose. (Export to #powerbi ).
One way we can achieve this is to send logs to Application Insights in Azure.
What do we need?
Azure Subscription
Then we can proceed to the Azure Portal to:
Create an Application Insights resource
Copy the instrumentation key.
Back to our canvas app:
In the App's property, paste the instrumentation key.
Save and Publish.
After doing this, Let us play the app and perform some actions.
We can see the following from Application Insights:
Location: Where the app is accessed from
Device Information: What devices are used
Browser Information: Client Browser would be visible.
In future post, we will try to log specific errors, warnings and information to Application Insights using custom trace.
That's it.