HubDocs

Guides

Logs and shell. Follow build and runtime logs, run a command, or open a shell in an app.

hub app my-app logs

Logs show recent output and follow new activity, including the transition from build to running app. While a deploy builds, you see the build as it happens, then the app's output once the new release runs. A deploy that starts later shows up the same way. Each line shows once, and a line your app prints again and again, like a health check, shows every time. Press Ctrl-C to stop.

Lines about the release, such as building, running or failed, go to stderr, so redirecting the output to a file keeps the log alone.

hub app my-app logs --no-follow             # print recent output and exit
hub app my-app logs --tail 1000             # start with more lines
hub app my-app logs --service worker        # another service of a compose app
hub app my-app logs --build                 # the build log of the newest release
hub app my-app logs --build --release 3     # the build log of release 3

Runtime logs are what the app's running containers kept, so a new release starts them again. Build logs are stored with each release and stay.

Run a command

hub app my-app exec -- ls -la
hub app my-app exec --service db -- psql -U app app
hub app my-app exec -- sh -c 'echo $HOSTNAME'

exec runs the command after -- in the public service, or in the service you name, without a shell. It prints up to 48 KiB of output and exits with the command's exit code. A command that runs longer than 60 seconds is stopped.

Open a shell

hub app my-app shell
hub app my-app shell --service worker

shell opens a shell inside the running container in your terminal. If you close it and open it again, you land back in the same shell with what it printed meanwhile. Exit with Ctrl-D.

The Shell page on the dashboard opens the same shell in the browser. A shell nobody is attached to ends after 15 minutes. Viewers can read logs but cannot open a shell or run commands; see Teams and roles.

On this page