Objective
One of the most important aspects in the life cycle of the Azure DevOps – Pipeline development is to have tools and techniques in place to find out the root cause of any error that would have occurred during the pipeline Azure DevOps pipeline execution.
In this article, we are going to learn about the features that Azure DevOps pipeline supports the DevOps engineers to quickly understand what’s going on in the pipeline.
By default, Azure DevOps pipeline provides logs which provide information about the execution of each step in the pipeline. In order to view the default logs, click on the specific task which shows the default logs for that task as shown below.
At times, the default logs wouldn’t help us understand what went wrong and how to provide a fix for the issue.
In such cases, it would be helpful if we get more diagnostic logs about each step in the Azure DevOps pipelines. Below are the two different techniques to enable the feature of getting additional logs.
- Enable Diagnostic logs for an Individual pipeline execution.
- Enable Diagnostic logs for every pipeline execution
Individual Pipeline Runs
If you would like to get additional logs for a specific pipeline execution, all you need to do is enable the Enable System Diagnostics checkbox as shown below just before you hit the Run button.
All Pipeline executions
If you always want to enable System Diagnostics to capture the Diagnostics traces for cases where the pipeline executed automatically (Continuous Integration scenarios), then in such cases, all you need is to create a variable in the pipeline with the name system.debug and the set the value to true as shown below.
System. debug = true variable helps us get the diagnostics logs in all three types of types of pipelines.
- YAML based Pipelines
- Classic Build Pipelines
- Classic Release Pipelines
Once we set the value of system.debug to true, then the pipeline starts showing additional logs in the purple colour as shown below.
In the above scenario, the purple color logs might not make any sense. However, in some scenarios these additional logs would be very handy if you are looking for fixing an issue.
As shown in the above screenshot you can also view timestamps by clicking on the Toggle timestamps button.
If you would like to view the logs without any colors, you can click on the View raw log button which opens up the logs in a separate browser window where you can save them as well.
Download Logs
If you would like to share the logs to some other teams who don’t have access to your pipeline, you can download the logs by clicking on the Download Logs button in the Pipeline Summary page as shown below.
Summary
In this article, we learned how to get additional diagnostic logs that would help the Azure DevOps engineer get additional details for troubleshooting and fixing the error by using the Enable System Diagnostic button or setting the System.Debug variable to true. We have also learnt how to download the logs from the Pipeline Summary Page.
Thanks for reading. Please leave your comments if you have any feedback or comments.