Skip to content

feat: Unified environment log reader (plugin traces, async jobs, workflows, flow runs) #41

@TomProkop

Description

@TomProkop

Context

During a conference demo session building a Warehouse Management app end-to-end, plugin steps were imported as disabled and plugins did not fire. There was no CLI way to diagnose this — we had to raw-query sdkmessageprocessingstep via SQL to discover statecode=1. If plugins had thrown runtime errors, there would have been no way to see trace logs without opening the browser.

Currently, debugging Dataverse runtime behavior requires the maker portal or manual OData/SQL queries against system tables. The CLI should provide a unified log surface for runtime diagnostics.

Note: Deployment/import logs are already covered by txc environment deployment list/show. This issue is specifically about runtime execution logs that have no CLI support today.

Proposal

Add a txc environment log command family for runtime diagnostics:

Command Source Table / API Use Case
txc environment log list Multiple (unified) Recent logs across all sources, sorted by time
txc environment log plugin-trace plugintracelog Plugin execution traces, errors, custom Trace() output
txc environment log async-jobs asyncoperation Background job status — workflows, async plugins, bulk ops
txc environment log workflow workflowlog + asyncoperation Classic workflow run history with step details
txc environment log flow-runs Power Automate API Cloud flow run history, trigger details, action failures

Key flags

--since 1h              # Time window (1h, 30m, 7d)
--entity <name>         # Filter to logs related to a specific entity
--plugin <name>         # Filter by plugin class name
--errors-only           # Only show failures/exceptions
--follow / --watch      # Tail mode — stream new logs as they appear
--correlation-id <guid> # Trace a single request across plugin chain

MCP tool equivalents

Tool Parameters
environment_log_list since, entity, errors-only
environment_log_plugin_trace since, plugin, entity, errors-only, correlation-id
environment_log_async_jobs since, entity, status-filter
environment_log_flow_runs since, flow-name, status-filter

Example workflows

# "Why didn't my plugin fire?"
txc environment log plugin-trace --since 10m --errors-only

# "What happened to my async workflow?"
txc environment log async-jobs --since 1h --entity udpp_warehousetransaction

# "Show me everything that happened in the last 5 minutes"
txc environment log list --since 5m

# "Tail logs while I test in the browser"
txc environment log plugin-trace --follow

Implementation notes

  • plugin-trace queries plugintracelog entity (columns: typename, messagename, exceptiondetails, messageblock, performanceexecutionstarttime, operationtype)
  • async-jobs queries asyncoperation (filter by operationtype, regardingobjectid, statuscode)
  • flow-runs requires Power Automate Management connector or direct API calls to flow.microsoft.com
  • --follow can poll with configurable interval (default 5s)
  • Consider --json output mode for piping to jq
  • Out of scope: deployment/import logs (already covered by txc environment deployment list/show)

Priority: 🔴 High | Effort: Large

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions