Custom Logging in Power Automate


Handling errors gracefully within your flow logic is important. Fortunately, there is plenty of guidance to be found on the subject:
But handling errors doesn’t necessarily fix them.
How can we investigate exceptions without wading through countless pages of flow run history?
If integrating with Azure Application Insights is not in scope and the information available within the Automation Center is not granular or specific enough, consider custom event logging.
Scenarios / Use Cases
Log List Examples
Approval Event History
Scheduled Automation
Bulk Content Sync
Creating a Log or Event List
Columns
There’s no perfect recipe, but I usually include a column for each of these values:
Run outcome (success, error, warning, etc.)
Outcome details
Associated item title
Associated item ID
Flow run ID
Then, add additional columns for your specific logging scenario, as needed.
For ALM scenarios, you may find adding these helpful:
Flow name
Solution name
Environment
Configuration Tips
Disable search on the list (advanced settings) or restrict list permissions to only the relevant individuals/audiences
Index any columns that might be needed for sorting/filtering
Include a multi-line plain text column, if you’d like to store JSON output
Create view(s) and add custom column formatting, if that helps readability
Examine the list after log entries start to populate - you may think of another field or two worth capturing
Cloning an Existing List
Assuming custom logging proves useful, you may want to create more lists in the future. You can use an existing list as a template, to speed creation. Some options:
ShareGate migration tool
Use an existing list option in the SharePoint UI (under site contents)
Microsoft Lists
Adding Logging Actions
Once your list is ready, it’s time to add some flow logic. New log entries will be added using a Create Item action.
There are two general approaches for adding logging steps - both achieve the same result, but have different considerations.
Add to Existing Flow(s)
You can sprinkle logging actions within your existing flow logic, utilizing copy/paste.
Pros | Cons |
Simple, fast approach | If the list schema changes, you may need to update (and find) all previously-added actions |
No additional licensing cost | Cannot add additional actions later (like sending notifications) unless done manually |
Can store complex data types, JSON | |
Uses existing SharePoint Online connection / reference (if present) |
Create Standalone Logging Flow
Alternatively, you can create a separate flow (HTTP trigger or child solution flow) to store your logging steps:
Once created, invoke it from existing flow(s) as needed:
Pros | Cons |
Much easier to extend later, if needed | Additional setup time and complexity |
Can handle complex data types (HTTP trigger only) | Requires premium licensing (HTTP trigger only) |
One logging flow can be shared by multiple solutions / flows | Need to collect and send parent workflow context |
Option to run asynchronously - won’t hold up parent flow |
Other Notes
Consider disabling retry policies whenever a standalone logging flow gets invoked or a Create Item log action is called. You don’t want to hold up a parent flow run in the unlikely event that logging hits a snag.
For logging hierarchical flow outcomes, consider creating an entry for when the parent begins, ends, and every child iteration in between. Store a shared identifier (like parent flow run ID) to help group entries later.
Calculating overall flow run duration, error and success totals, etc. can add additional value to the last log entry for a given flow run. Don’t spend the time adding that logic unless the extra insight is worth it, however.
You can use the logging technique described on this page to store errors / exceptions only, or you can include successful outcomes and other event types, depending on the situation.
Subscribe to my newsletter
Read articles from Jake Mannion directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Jake Mannion
Jake Mannion
I love backpacking and adventuring, but I am particularly obsessed with exploring the Grand Canyon and its surrounding tributary canyons. My hobbies include photography, sports, reading and PC gaming. I also have a love/hate relationship with a vintage Suzuki motorcycle. Father of two remarkable children and husband to an equally remarkable woman. "I'll only be this young for one more day"