Enabling Cloud Logging for your Cloud Data Fusion Managed Service for Apache Spark
clusters lets you access granular execution records beyond standard pipeline
metrics. You can use these advanced logs to troubleshoot run failures, inspect
driver and executor behavior, and debug complex data transformations.

## Enable Managed Service for Apache Spark Cloud Logging

To view pipeline and cluster issues in Cloud Logging, enable advanced logs
in new or existing Cloud Data Fusion instances. To enable advanced logs in
an existing instance, do the following:

1. In the Google Cloud console, go to the Cloud Data Fusion
   **Instances** page.

   [Go to Instances](https://console.cloud.google.com/data-fusion/locations/-/instances)
2. Click the instance name.

3. In the **Advanced monitoring and logging** section, for
   **Dataproc Cloud Logging** , click
   **Edit**.

4. In the **Cloud Logging** window, select the
   **Enable Cloud Logging** checkbox.

5. Click **Save**.

## View logs

Every Cloud Data Fusion pipeline run is assigned a unique `RunID`.
After you deploy and run your pipeline, find its `RunID`. Then, in
Logging, use the `RunID` to view your pipeline
logs.

### Get the pipeline's RunID

1. Go to your instance:
   1. In the Google Cloud console, go to the Cloud Data Fusion page.

   2. To open the instance in the Cloud Data Fusion Studio,
      click **Instances** , and then click **View instance**.

      [Go to Instances](https://console.cloud.google.com/data-fusion/locations/-/instances)
2. Click **List**.
3. Click the pipeline for which you want to get the Run ID.
4. Click **Summary**.
5. In the **Run history** section, click **Table**.
6. To copy the Run ID, right-click the **RunID** , and click **Copy**.

### View the logs in Logs Explorer

1. In the Google Cloud console, go to the
   **Cloud Logging \> Logs Explorer** page:

   [Go Logs Explorer](https://console.cloud.google.com/logs/query)
2. In the **All resources** drop-down,
   select
   **Cloud Dataproc Cluster \> **`cdap-PIPELINE_NAME-YOUR_RUNID`****.

### Optional: Filter the logs

Use the filter menus to filter your logs. You can filter by various log
severity levels
or by components such as `datafusion-pipeline-logs`.

### Optional: Download the logs

Click **Download logs**.

For more information, see
[downloading log entries](https://docs.cloud.google.com/logging/docs/view/logs-explorer-interface#download_logs).

## What's next

- Learn how to [view audit logs](https://docs.cloud.google.com/data-fusion/docs/how-to/audit-logging).
- Learn how to [view pipeline logs from the Cloud Data Fusion Pipeline Studio](https://docs.cloud.google.com/data-fusion/docs/how-to/view-and-download-pipeline-logs).