GitHub Actions — Enable debug logging

When the GitHub workflow doesn’t provide enough information about why a workflow, job or step is not working as expected, then we enabled debug logging. Debug logging helps us to analyse an issue when the default logging is not sufficient.

The debug logging in GitHub Actions workflow can be enabled at 2 levels.

  • Runner debug logging — Provides more information about runner and worker.
  • Step debug logging — Provides more information about workflow steps.

The debug logging is enabled by creating a variable or secret in the repository that contains the GitHub Actions workflow.

Important details

Enable runner debug logging

  • Set the value of secret or variable ACTIONS_RUNNER_DEBUG to true in the repository where workflow resides. Documentation on how to create a secret or variable is provided earlier.
  • If both secret and variable are set, the value of secret takes precedence.
  • Download the logs as per the steps in the documentation provided earlier. In addition to regular logs, there will now be an additional folder named runner-diagnostic-logs. This folder contains the debug logs for the worker and runner.
  • The runner logs provide information about setting up the runners to execute jobs.
  • The worker logs provide information about execution of a job.

Enable step debug logging

  • While debugging at runner level can be helpful in some cases, the step debugging helps us to get useful information about the execution of steps in the workflow.
  • Set the value of secret or variable ACTIONS_STEP_DEBUG to true in the repository where workflow resides. Documentation on how to create a secret or variable is provided earlier.
  • If both secret and variable are set, the value of secret takes precedence.
Step logs without debug logging enabled
Step logs without debug logging enabled
Step logs with debug logging enabled
Step logs with debug logging enabled

Hope you find this article useful.

Happy Reading.

--

--

Amit Kumar Dube (अमित दुबे)

@AmitDubeDev | Professional GCP Architect | Terraform ACE | Lead Infra Consultant | Hindi Speaker