View portal error logs
Note
Effective October 12, 2022, Power Apps portals is Power Pages. More information: Microsoft Power Pages is now generally available (blog)
We will soon migrate and merge the Power Apps portals documentation with Power Pages documentation.
Portal administrators and developers use Power Apps portals to create websites for their customers. Developers often debug issues while developing the portal. To help debug, you can access detailed error logs for any issues on your portal. There are multiple ways that you can get error logs for your portals.
Note
Power Apps portal error logs are also used for Power Pages. More information: What is Power Pages
Tip
To learn about the roles required to perform tasks in this article, read Admin roles required for portal administrative tasks.
Custom error
If any server-side exception occurs in your portal, a customized error page with a user-friendly error message is shown by default. To configure the error message, see Display a custom error message.
However, it's better to see the ASP.NET detailed error page, also known as Yellow Screen of Death (YSOD), for debugging purposes. The detailed error page helps you to get the full stack of server errors.
To enable YSOD, you need to disable custom errors on your portal.
Note
It is advisable to only disable custom errors when you are in the development phase and enable custom errors once you go live.
More information on custom error: Displaying a Custom Error Page
Disable custom error
You can disable custom errors on portals to display the detailed exception message if any server-side exception occurs in your portal.
Go to Portal Actions > Disable custom errors.
Select Disable in the confirmation message. While custom errors are being disabled, the portal restarts and will be unavailable. A message appears when custom errors are disabled.
Enable custom error
You can enable custom errors on portals to display a professional-looking page instead of YSOD. This page provides meaningful information if any exception occurs in the application.
Go to Portal Actions > Enable custom errors.
Select Enable in the confirmation message. While custom errors are being enabled, the portal restarts and will be unavailable. A message appears when custom errors are enabled.
Note
- If you change the instance that your portal is connected to, the custom errors setting is set to enabled. You must disable the custom errors again, if required.
- You must not enable or disable custom errors when the instance that your portal is connected to is being changed; otherwise an error message appears.
Display a custom error message
You can configure your portal to display a professional-looking custom error instead of a generic error.
To define a custom error, use the content snippet Portal Generic Error
. The content defined in this snippet is shown on the error page. This content snippet isn't available out-of-the-box and you must create it. The content snippet Type can be Text or HTML. To create or edit the content snippet, see Customize content by using content snippets.
Note
If liquid code is written in the content snippet, it will be skipped and not rendered.
When you enable custom errors, the message appears in the following structure on the error page:
<Content Snippet
>
<Error ID
>
<Date and time
>
<Portal ID
>
Below is an example of a custom error message, using a content snippet of type HTML:
This is a custom error, file a support ticket with screenshot of error by clicking here
Note
If the portal cannot retrieve a content snippet because it can't connect to Microsoft Dataverse or if the snippet is not available in Dataverse, an error message appears.
Access portal error logs
After developing and publishing the portal, you still need to be able to access portal logs to debug issues reported by your customers. To access the logs, configure your portal to send all application errors to an Azure Blob storage account that you own. By accessing portal error logs, you can respond to customer queries efficiently because you have details of the issue. To get portal error logs into your Azure Blob storage, you must enable diagnostic logging from the Power Apps portals admin center.
Note
If you change the Dataverse instance that your portal is connected to, diagnostic logging is disabled. You must enable diagnostic logging again.
Enable diagnostic logging
Go to Portal Actions > Enable diagnostic logging.
In the Enable diagnostic logging window, enter the following values:
- Connection String of Azure Blob Storage service: URL of the Azure Blob Storage service to store the portal error logs. The maximum length of the URL is 2048 characters. If the URL is longer than 2048 characters, an error message appears. More information on connection string: Configure Azure Storage connection strings
- Select retention period: Duration to keep the portal error logs in blob storage. The error logs are deleted after the selected duration. You can select one of the following values:
- One day
- Seven days
- 30 days
- 60 days
- 90 days
- 180 days
- Always
By default, the retention period is 30 days.
Select Configure.
Once diagnostic logging is configured, a new telemetry-logs blob container is created in your Azure storage account and the logs are written into the blob files stored in the container. The following screenshot shows the telemetry-logs blob container in Azure Storage Explorer:
When diagnostic logging is enabled successfully, the following action becomes available:
- Update diagnostic logging configuration: Allows you to update or remove diagnostic logging configuration for the portal.
- Disable diagnostic logging: Allows you to disable diagnostic logging configuration for the portal.
Update diagnostic logging
Go to Portal Actions > Update diagnostic logging configuration.
In the Update diagnostic logging configuration window, enter the following values:
- Do you want to update the Connection string of the Azure Blob Storage service?: Allows you to specify whether to update the connection string of the Azure Blob Storage service. By default, it's selected.
- Connection String of Azure Blob Storage service: URL of the Azure Blob Storage service to store the portal error logs. The maximum length of the URL can be 2048 characters. If the URL is longer than 2048 characters, an error message appears. This field is displayed only if the Do you want to update the Connection string of the Azure Blob Storage service? check box is selected. More information on connection string: Configure Azure Storage connection strings
- Select retention period: Duration to keep the portal error logs in blob storage. The error logs are deleted after the selected duration. You can select one of the following values:
- One day
- Seven days
- 30 days
- 60 days
- 90 days
- 180 days
- Always
By default, the retention period is 30 days.
Select Update.
Disable diagnostic logging
Go to Portal Actions > Disable diagnostic logging.
Select Disable in the confirmation message.
Display plugin error
Another scenario that often occurs while developing a portal is an error generated by custom plug-ins and business logic written in your Dataverse environment. These errors can generally be accessed by disabling custom errors or enabling diagnostic logging. In some cases, it's faster to display these errors directly on the portal to diagnose the issue faster. You can accomplish this by configuring your portal to display custom plugin errors from Dataverse on your portal screen.
To display custom plugin errors, create the site setting Site/EnableCustomPluginError
and set its value to True. The custom plugin errors will be displayed on the screen instead of a generic error. The error will display only the message part of the plugin error and not the complete stack trace.
Following are the screens where custom plugin errors will appear:
- List
- Retrieval of records
- Basic form
- Retrieve
- Create/Update, and so on
- Multistep forms
- Retrieve
- Create/Update, and so on
If the site setting isn't present, then it will be treated as false by default and plugin errors won't render.
See also
Feedback
Submit and view feedback for