How to View Logs in App Platform

App Platform is a Platform-as-a-Service (PaaS) offering that allows developers to publish code directly to DigitalOcean servers without worrying about the underlying infrastructure.


You can view application, build, and deploy logs in App Platform both in the control panel and from the command line. You can also enable log forwarding to forward application logs to external log providers.

View Logs Using the CLI

To retrieve an app’s logs using doctl, you need to provide the app’s ID in the command. You can retrieve an app’s ID using the doctl apps list command.

How to view logs using the DigitalOcean CLI

To view logs via the command-line, follow these steps:

  1. Install doctl, the DigitalOcean command-line tool.

  2. Create a personal access token, and save it for use with doctl.

  3. Use the token to grant doctl access to your DigitalOcean account.

                  doctl auth init
                
  4. Finally, view logs with doctl apps logs. The basic usage looks like this, but you'll want to read the usage docs for more details:

                  doctl apps logs <app id> <component name (defaults to all components)> [flags]
                

View Logs Using the API

How to view logs using the DigitalOcean API

To view logs using the DigitalOcean API, follow these steps:

  1. Create a personal access token, and save it for use with the API.

  2. Send a GET request to https://api.digitalocean.com/v2/apps/{app_id}/deployments/{deployment_id}/components/{component_name}/logs

    cURL

    To view logs with cURL, call:

    
                    curl -X GET \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
      "https://api.digitalocean.com/v2/apps/{app_id}/deployments/{deployment_id}/components/{component_name}/logs"

The live_url returned may use either the https:// or wss:// protocols and will keep pushing live logs as they become available.

View Logs from the Control Panel

To view app resource logs, go to https://cloud.digitalocean.com/apps and click on your app. Click on the Runtime Logs tab, then click on a resource to view its logs. The logs show within a few minutes after the app deploys. The logs are updated in real-time while the resource is running.

Logs screen

To view build and deploy logs, go to https://cloud.digitalocean.com/apps, click on your app, and click on the Activity tab. Click on any event in the deployment history to view all logs that were generated at build and deploy time.