|
| 1 | +--- |
| 2 | +title: Debug canvas apps without Live monitor |
| 3 | +description: Learn alternative approaches to debug Power Apps canvas apps when Live monitor isn't available, such as in SharePoint forms or custom portal embeddings. |
| 4 | +ms.date: 01/20/2026 |
| 5 | +ms.reviewer: carlosff, v-shaywood |
| 6 | +ms.custom: sap:Running Canvas App |
| 7 | +--- |
| 8 | + |
| 9 | +<!-- [CUSTOMER INTENT: As a Power Apps maker, I want to debug canvas app issues when I can't use Live monitor, so I can troubleshoot problems in embedded or hosted scenarios.] --> |
| 10 | + |
| 11 | +# Debug canvas apps without Live monitor |
| 12 | + |
| 13 | +This article describes alternative debugging approaches for Power Apps canvas apps when [Live monitor](/power-apps/maker/monitor-canvasapps) isn't available. Use these techniques for SharePoint integrated forms, custom pages, or custom portal embeddings where you can't open Live monitor alongside the app. |
| 14 | + |
| 15 | +## Summary |
| 16 | + |
| 17 | +Live monitor is the recommended tool for debugging canvas apps because it shows real-time events and works with the [Trace function](/power-platform/power-fx/reference/function-trace). However, some hosted or embedded scenarios don't support it. This article covers alternatives like Application Insights, Dataverse logging tables, SharePoint list logging, and on-screen diagnostics panels. |
| 18 | + |
| 19 | +For scenarios where Live monitor is available, see [Debug canvas apps with Live monitor and Trace](monitor-debugging-canvas-apps.md). |
| 20 | + |
| 21 | +## Alternative debugging approaches |
| 22 | + |
| 23 | +When Live monitor isn't available, choose an alternative based on your environment and needs: |
| 24 | + |
| 25 | +| Alternative | Best for | Notes | |
| 26 | +| ----------- | -------- | ----- | |
| 27 | +| [Application Insights](#application-insights-integration) | Centralized telemetry and performance monitoring | Requires Azure setup. Emits traces and metrics outside Power Apps. | |
| 28 | +| [Dataverse logging table](#write-debug-records-to-dataverse) | Ad-hoc diagnostics and audit trails | Create a custom table. Use guarded logic to write records when debugging. | |
| 29 | +| [SharePoint list logging](#write-debug-records-to-sharepoint) | Lightweight environments without Dataverse | Use `Collect` or `Patch` to a list. Prune entries to control size. | |
| 30 | +| [On-screen diagnostics panel](#create-an-on-screen-diagnostics-panel) | Immediate feedback during testing | Only for secure audiences. Remove before broad rollout. | |
| 31 | + |
| 32 | +## Application Insights integration |
| 33 | + |
| 34 | +[Application Insights](/power-apps/maker/canvas-apps/application-insights) provides centralized telemetry for canvas apps. It captures performance metrics, errors, and custom traces in Azure Monitor, where you can analyze data across sessions and users. |
| 35 | + |
| 36 | +This approach requires: |
| 37 | + |
| 38 | +- An Azure subscription |
| 39 | +- An Application Insights resource |
| 40 | +- Configuration in the Power Apps app settings |
| 41 | + |
| 42 | +For setup instructions, see [Analyze app telemetry using Application Insights](/power-apps/maker/canvas-apps/application-insights). |
| 43 | + |
| 44 | +## Write debug records to Dataverse |
| 45 | + |
| 46 | +If your environment includes Dataverse, create a custom **Debug Logs** table to capture diagnostic information. This approach works well for ad-hoc troubleshooting and audit trails. |
| 47 | + |
| 48 | +### Create the Debug Logs table |
| 49 | + |
| 50 | +1. In [Power Apps](https://make.powerapps.com), go to **Tables** and create a new table named **Debug Logs**. |
| 51 | +1. Add the following columns: |
| 52 | + - **Title** (Single line of text): A label for the log entry. |
| 53 | + - **UserEmail** (Single line of text): The email of the user. |
| 54 | + - **Timestamp** (Date and time): When the event occurred. |
| 55 | + - **Payload** (Multiple lines of text): Additional data in JSON format. |
| 56 | + - Add other columns as needed for your scenario (for example, **CartCount**, **ScreenName**). |
| 57 | + |
| 58 | +### Example: Write a debug record to Dataverse |
| 59 | + |
| 60 | +Use a guarded `Patch` call to write records only when a debug query string parameter is present: |
| 61 | + |
| 62 | +```powerfx |
| 63 | +If(Param("debug") = "true", |
| 64 | + Patch( |
| 65 | + 'Debug Logs', |
| 66 | + Defaults('Debug Logs'), |
| 67 | + { |
| 68 | + Title: "BeforeSubmit", |
| 69 | + UserEmail: User().Email, |
| 70 | + CartCount: CountRows(colCart), |
| 71 | + Timestamp: Now(), |
| 72 | + Payload: JSON({customerId: ddCustomer.Selected.Id}) |
| 73 | + } |
| 74 | + ) |
| 75 | +); |
| 76 | +``` |
| 77 | + |
| 78 | +### Run the app in debug mode |
| 79 | + |
| 80 | +To enable debug logging, add `&debug=true` to the app URL: |
| 81 | + |
| 82 | +```text |
| 83 | +https://apps.powerapps.com/play/e/[environment-id]/a/[app-id]?debug=true |
| 84 | +``` |
| 85 | + |
| 86 | +After reproducing the issue, open the **Debug Logs** table in Dataverse to review the captured records. |
| 87 | + |
| 88 | +> [!NOTE] |
| 89 | +> Remove or disable debug logging before you deploy the app broadly. Periodically delete old log entries to manage storage. |
| 90 | +
|
| 91 | +## Write debug records to SharePoint |
| 92 | + |
| 93 | +For lightweight environments without Dataverse, use a SharePoint list to capture debug information. |
| 94 | + |
| 95 | +### Create the debug list |
| 96 | + |
| 97 | +1. In SharePoint, create a new list named **AppDebugLogs**. |
| 98 | +1. Add columns for **Title**, **UserEmail**, **Timestamp**, **Payload**, and any other data you want to capture. |
| 99 | + |
| 100 | +### Example: Write a debug record to SharePoint |
| 101 | + |
| 102 | +```powerfx |
| 103 | +If(Param("debug") = "true", |
| 104 | + Patch( |
| 105 | + AppDebugLogs, |
| 106 | + Defaults(AppDebugLogs), |
| 107 | + { |
| 108 | + Title: "BeforeSubmit", |
| 109 | + UserEmail: User().Email, |
| 110 | + Timestamp: Now(), |
| 111 | + Payload: JSON({customerId: ddCustomer.Selected.Id, cartCount: CountRows(colCart)}) |
| 112 | + } |
| 113 | + ) |
| 114 | +); |
| 115 | +``` |
| 116 | + |
| 117 | +> [!NOTE] |
| 118 | +> SharePoint lists have storage limits. Prune old entries regularly to prevent the list from growing too large. |
| 119 | +
|
| 120 | +## Create an on-screen diagnostics panel |
| 121 | + |
| 122 | +For immediate feedback during testing, create a diagnostics panel that displays debug information directly in the app. This approach is useful when you need to see values in real time. |
| 123 | + |
| 124 | +### Step 1: Collect debug data |
| 125 | + |
| 126 | +Instead of using Trace, collect data to a local collection: |
| 127 | + |
| 128 | +```powerfx |
| 129 | +If( |
| 130 | + Param("debug") = "true", |
| 131 | + Collect( |
| 132 | + debugTraces, |
| 133 | + { |
| 134 | + Timestamp: Now(), |
| 135 | + Data: $"Before submit for {User().Email} with {CountRows(colCart)} items in the cart" |
| 136 | + } |
| 137 | + ) |
| 138 | +) |
| 139 | +``` |
| 140 | + |
| 141 | +### Step 2: Add a text control to display traces |
| 142 | + |
| 143 | +Add a text control to the screen that shows the collected traces. Set its **Visible** property so it only appears in debug mode. |
| 144 | + |
| 145 | +**Control properties:** |
| 146 | + |
| 147 | +| Property | Value | |
| 148 | +| -------- | ----- | |
| 149 | +| **Text** | `Concat(debugTraces, $"[{Text(Timestamp, "hh:mm:ss.fff")}] {Data}", Char(10))` | |
| 150 | +| **Visible** | `Param("debug") = "true"` | |
| 151 | +| **Height** | 200 | |
| 152 | +| **Width** | 300 | |
| 153 | +| **X** | `Parent.Width - 320` | |
| 154 | +| **Y** | 20 | |
| 155 | + |
| 156 | +This displays a scrollable list of debug messages that you can copy and analyze outside the app. |
| 157 | + |
| 158 | +### Example YAML for the text control |
| 159 | + |
| 160 | +If you're using Power Apps Studio's YAML view: |
| 161 | + |
| 162 | +```yaml |
| 163 | +- TextDebugPanel: |
| 164 | + |
| 165 | + Properties: |
| 166 | + Height: =200 |
| 167 | + Size: =12 |
| 168 | + Text: |- |
| 169 | + =Concat( |
| 170 | + debugTraces, |
| 171 | + $"[{Text(Timestamp,"hh:mm:ss.fff")}] {Data}", |
| 172 | + Char(10)) |
| 173 | + Visible: =Param("debug") = "true" |
| 174 | + Width: =300 |
| 175 | + X: =Parent.Width - 320 |
| 176 | + Y: =20 |
| 177 | +``` |
| 178 | +
|
| 179 | +> [!IMPORTANT] |
| 180 | +> Remove or hide the diagnostics panel before deploying the app to end users. Users who open the app with the debug parameter shouldn't see internal diagnostic information. |
| 181 | +
|
| 182 | +## Best practices for alternative debugging |
| 183 | +
|
| 184 | +- **Guard debug controls**: Use query string parameters (`Param("debug") = "true"`) or role checks to show debug features only during testing. |
| 185 | +- **Clean up before deployment**: Remove debug controls, logging calls, and diagnostic panels before you deploy broadly. |
| 186 | +- **Manage log storage**: For Dataverse or SharePoint logging, periodically delete old entries. |
| 187 | +- **Use meaningful labels**: Include descriptive titles like "BeforeSubmit" or "OnVisible_OrderScreen" to make logs easier to analyze. |
| 188 | +- **Include context**: Log the user email, screen name, and relevant data values so you can correlate entries across sessions. |
| 189 | + |
| 190 | +## Related content |
| 191 | + |
| 192 | +- [Debug canvas apps with Live monitor and Trace](monitor-debugging-canvas-apps.md) |
| 193 | +- [Analyze app telemetry using Application Insights](/power-apps/maker/canvas-apps/application-insights) |
| 194 | +- [Collaborative debugging with Live monitor](/power-apps/maker/monitor-collaborative-debugging) |
| 195 | +- [Live monitor overview](/power-apps/maker/monitor-overview) |
| 196 | +- [Trace function reference](/power-platform/power-fx/reference/function-trace) |
0 commit comments