The following information can help you when debugging Workflows
and can assist you in deploying a reliable, predictable, and optimized workflow.

|---|---|
| Projects and environments | - Ideally, to protect your production resources, use separate projects for each of your environments: a project for development tasks; a project for application testing; a staging project where development can be merged into the built system; and a project for your production environment where finalized builds are available. - Alternatively, use separate workflows. |
| Workflow creation | - You can write your workflow in the Google Cloud console editor or by using a preferred IDE or source code editor. - Editing YAML files can be error-prone. [Set up autocompletion in your IDE](https://docs.cloud.google.com/workflows/docs/use-workflows-json-schema-with-ide.md.txt) or editor to reduce typos and other common errors when developing your workflow. The Google Cloud console editor for Workflows does provide some YAML and syntax validation, and autocompletion; however, there could be syntax errors that must be fixed and that are only caught at deployment. See [YAML indentation](https://docs.cloud.google.com/workflows/docs/troubleshooting.md.txt#indentation). |
| Workflow deployment | - You must [deploy your workflow](https://docs.cloud.google.com/workflows/docs/creating-updating-workflow.md.txt) from a Google Cloud project to execute it for testing. |
| Workflow execution | - When testing a workflow, you can execute it by using the gcloud CLI or in the Google Cloud console: - Use [`gcloud workflows run`](https://docs.cloud.google.com/sdk/gcloud/reference/workflows/run) to execute your workflow from the command line and see the results. - Use the [Google Cloud console](https://docs.cloud.google.com/workflows/docs/executing-workflow.md.txt#console) to execute your workflow and view the results in the **Output** pane. - You can [access the workflow execution results](https://docs.cloud.google.com/workflows/docs/access-execution-results.md.txt) in the Google Cloud console or by using the gcloud CLI. If testing from the command line, you'll likely want to view the logs in the Google Cloud console on the **Workflow details** page. - You can [retrieve the history of a specified workflow execution](https://docs.cloud.google.com/workflows/docs/debug-steps.md.txt) as a list of step entries, each entry providing information that can assist you in determining the source of an error or optimizing the performance of a workflow. - You can access a workflow's environment information (such as its location or project identifier) using built-in [environment variables](https://docs.cloud.google.com/workflows/docs/reference/environment-variables.md.txt). Built-in environment variables require no declaration and are available in every workflow execution. - Errors thrown during a workflow execution contain [tags to help you identify what caused the error](https://docs.cloud.google.com/workflows/docs/access-execution-results.md.txt#error-tags). - You can [check the status of any long-running execution](https://docs.cloud.google.com/workflows/docs/executing-workflow.md.txt#check_the_status_of_executions). - Each workflow execution automatically triggers at least two execution logs: one at the start of an execution and one at the end. You can view logs in Workflows or in Cloud Logging. To view the logs for a single workflow, [use the **Logs** tab in Workflows](https://docs.cloud.google.com/workflows/docs/log-workflow.md.txt#viewing-logs-workflows). To get an aggregate view of the logs for all of your workflows, [use the **Logs Explorer** page in Cloud Logging](https://docs.cloud.google.com/workflows/docs/log-workflow.md.txt#viewing-logs-logging). - You can send logs to Cloud Logging: - By enabling [call logging](https://docs.cloud.google.com/workflows/docs/log-workflow.md.txt#call_logging) which lets you set a flag so that each call step or exception during the execution of your workflow is logged. - By creating [custom logs](https://docs.cloud.google.com/workflows/docs/log-workflow.md.txt#custom_logs) that use the `sys.log` function in your source. |

## What's next

- [Known issues for Workflows](https://docs.cloud.google.com/workflows/docs/issues.md.txt)
- [Monitor workflows](https://docs.cloud.google.com/workflows/docs/monitor.md.txt)
- [Troubleshoot issues](https://docs.cloud.google.com/workflows/docs/troubleshooting.md.txt)
- [View history of execution steps](https://docs.cloud.google.com/workflows/docs/debug-steps.md.txt)