Skip to main content

Java SDK developer's guide - Debugging

In addition to writing unit and integration tests, debugging your Workflows is also a very valuable testing tool. You can debug your Workflow code using a debugger provided by your favorite Java IDE.

Note that when debugging your Workflow code, the Temporal Java SDK includes deadlock detection which fails a Workflow Task in case the code blocks over a second without relinquishing execution control. Because of this you can often encounter the PotentialDeadlockException Exception while stepping through Workflow code during debugging.

To alleviate this issue, you can set the TEMPORAL_DEBUG environment variable to true before debugging your Workflow code. Make sure to set TEMPORAL_DEBUG to true only during debugging.

How to debug in a development environment​

In addition to the normal development tools of logging and a debugger, you can also see what’s happening in your Workflow by using the Web UI or tctl.

How to debug in a production environment​

You can debug production Workflows using:

  • Web UI
  • tctl
  • Replay
  • Tracing πŸ”—
    How to setup Tracing
    Tracing allows you to view the call graph of a Workflow along with its Activities and any Child Workflows.
    guide-context
  • Logging πŸ”—
    How to log from a Workflow
    Send logs and errors to a logging service, so that when things go wrong, you can see what happened.
    guide-context

You can debug and tune Worker performance with metrics and the Worker performance guide. For more information, see Observability ▢️ Metrics for setting up SDK metrics.

Debug Server performance with Cloud metrics πŸ”—

How to monitor Temporal Cloud metrics
Configure and track performance metrics for Temporal Cloud.
introduction temporal cloud metrics
or self-hosted Server metrics.