This page describes how to view the streaming logs of your application and to check the status of resources from within Cloud Code.
The Development sessions view provides a structured view of the logging output that surfaces tasks, artifacts, and deployed resources. This view lets you see the status of each task in your deployment and locate more information in the full logging output.
The Log Viewer provides tools for searching and filtering logs.
View the status of tasks and resources
When you start a development or debugging session, the Development sessions section displays the structured logging view.
To view the Development sessions section, open the Command Palette (press
Ctrl
/Cmd
+Shift
+P
) and then run the Cloud Code: Focus on development sessions explorer command.As a task begins, a progress_activity spinning semi-circle progress indicator appears.
If a task succeeds, a check_circle checkmark appears next to the step.
If a task fails, an error error mark appears next to the step.
To see details of a step, click the step in the Development sessions section. The Output tab displays the step in the logging output.
To view the full Skaffold logs, click the Status node.
To view the logs for a container, expand Status, expand Stream Application Logs, and then click the container name. The logs for the container are displayed in the Output tab.
Launch the Log Viewer
To launch the Log Viewer, open the command palette
(press Ctrl
/Cmd
+Shift
+P
or click View > Command Palette) and
then run Cloud Code: View Logs.
Stream logs from a pod
To stream logs from a pod:
- Click Cloud Code and then expand the Kubernetes section.
- Expand your minikube cluster and then expand Pods.
- Right-click a pod and then click Stream Logs.
- If there are multiple containers in the pod, select a container when prompted.
View logs from a pod
- Click Cloud Code and then expand the Kubernetes section.
- Expand your minikube cluster and then expand Pods.
- Right-click a pod and then click View Logs
- If there are multiple containers in the pod, select a container when prompted.
View logs for a specific resource
To view the logs for a specific resource, follow these steps:
- Click Cloud Code and then expand the Kubernetes section.
In the Kubernetes section, expand the following:
- The cluster whose logs you want to view
- Namespaces
- The namespace whose logs you want to view
- Deployments
Right-click the deployment and select View logs.
View streaming logs
To have the Log Viewer display updated logs as the logs are generated, in the Log Viewer, turn the Streaming slider on.
View Kubernetes logs using Cloud Logging
To display logs from GKE clusters with Cloud Logging enabled, follow these steps:
- To open the Log Viewer, open the command palette (press
Ctrl
/Cmd
+Shift
+P
or click View > Command Palette) and then run Cloud Code: View Logs. - Select Kubernetes Application Logs from the Log Type list.
- To stream logs from multiple pods, turn on the Streaming slider and select all in the Pod list.
- Logs are displayed for the active cluster by default. To switch to a different cluster, select the cluster name from the Cluster list.
View Kubernetes logs using kubectl
To display logs from a non-GKE cluster or a GKE cluster without Cloud Logging enabled, follow these steps:
- To open the Log Viewer, open the command palette (press
Ctrl
/Cmd
+Shift
+P
or click View > Command Palette) and then run Cloud Code: View Logs. - Select Kubectl Logs from the Log Type list.
- In the Deployment or Pod list, select a deployment or pod to view logs from.
- To refine your search results, click Search Logs and then type search terms. This search includes the namespace, deployment, pod, container, and time. For clusters with Cloud Logging enabled, you can also filter by severity level.
Change the display time
To change the display time to a different time zone, click more_vertMore next to the Time column header and then choose a time zone.
What's next
- Debug a Kubernetes application in Cloud Code.
- Explore the Kubernetes documentation on troubleshooting containerized applications.