Stream live logs from a deployed BTP app, read recent logs after a crash, and inspect environment variables to debug binding and config issues.
Once your app is deployed, the cf CLI is your window into what's happening in production.
cf apps
Output:
name requested state instances memory disk urls
bookshop-srv started 1/1 256M 512M bookshop-srv.cfapps.eu10.hana.ondemand.com
bookshop-app started 1/1 128M 256M bookshop.cfapps.eu10.hana.ondemand.com
cf logs bookshop-srv
Every log line from your app appears in real time. Press Ctrl+C to stop.
cf logs bookshop-srv --recent
This shows the last ~1000 log lines. Useful for finding the error that caused a crash.
cf logs bookshop-srv --recent | grep -i error
cf logs bookshop-srv --recent | grep "cds -"
| Log line | Meaning |
|---|---|
[APP/PROC/WEB] OUT [cds] - server listening on... |
App started successfully |
[APP/PROC/WEB] ERR Error: connect ECONNREFUSED |
Can't reach a bound service |
[CELL/0] OUT Exit status 137 |
App ran out of memory (increase memory in mta.yaml) |
[STG/0] ERR npm ERR! ... |
Build failed during staging |
cf env bookshop-srv
This prints all environment variables, including:
{
"VCAP_SERVICES": {
"hana": [{
"credentials": {
"host": "...",
"port": "443",
"user": "DEPLOY_USER_...",
"password": "..."
}
}],
"xsuaa": [...]
},
"VCAP_APPLICATION": {
"application_name": "bookshop-srv",
"space_name": "dev"
}
}
VCAP_SERVICES is how Cloud Foundry passes service credentials to your app. CAP reads this automatically — no manual wiring needed.
cf events bookshop-srv
Shows a timeline of start, stop, crash, and scale events.
| Command | When to use |
|---|---|
cf restart bookshop-srv |
App is hanging or unhealthy; same code, same env |
cf restage bookshop-srv |
Environment variables changed (new binding, new env var) |
cf push / cf deploy |
Code changed — need a new deployment |
cf scale bookshop-srv -m 512M # double the memory
cf scale bookshop-srv -i 2 # run 2 instances
Sign in for progress tracking & Q&A →