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 activity, build, deployment, and runtime logs in App Platform using the control panel, CLI, and API. You can also enable log forwarding to forward application logs to external log providers.
Types of Logs
App Platform records several different types of information about your app to during each stage of its deployment. You can access and review the following logs:
Activity: Maintains a timeline of your app’s deployments, including the commit hash that triggered the build, how long the build took, and the build’s start and end times.
Deployment details: Contains overview information about a specific deployment, including build duration and the amount of time that was billed during deployment. This page also contains the deployment’s build and deploy logs.
Build log: Records the commands and subsequent build processes used to build the app, including any errors or warnings emitted by the software building the app. These can be helpful for identifying issues with the application’s code or dependencies that may need to be addressed before the application can be deployed.
Deploy log: Records the deployment of the app to its server, including any errors or warnings emitted from the software being used to host the app.
Runtime log: Records messages and errors emitted by the app and its components while running. These logs can be useful for troubleshooting issues with the application’s logic or functionality.
Crash log: Records the log output from the instance before it crashed and a potential reason for the crash.
View Logs Using the Automation
The CLI command and API endpoint used to retrieve an app’s logs require the app’s ID. You can retrieve a list of your apps and their IDs using the doctl apps list command or the /v2/apps endpoint.
How to view logs using the DigitalOcean CLI
To view logs via the command-line, follow these steps:
import os
from pydo import Client
client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))
get_resp = client.apps.get_logs(app_id="4f6c71e2", deployment_id="3aa4d20e", component_name="component")
The live_url returned may use either the https:// or wss:// protocols and will keep pushing live logs as they become available.
View Logs Using the Control Panel
To view app resource logs, click Apps in the left menu and then click your app.
Activity Logs
To view the activity for an app, click the Activity tab. This displays your app’s timeline of deployments.
Deployment Logs
To view logs and information for a specific deployment, click the Activity tab and then click the deployment link in the headline of the deployment you want to review. From here, you can review the deployment’s Build logs and Deploy logs.
Runtime Logs
To view runtime logs, click the Runtime Logs tab, then click 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.
Crash Logs
Crash logs are available after a container crashes and restarts. You can only access crash logs using doctl, the official DigitalOcean CLI.
To access the log from before the last crash, run the following command in a terminal, replacing <your-app-ID> with your app’s ID: