Skip to main content
Version: v1

Logs

Logs are where you find out why a container won't start or why a page throws an error. This page is for developers tracking down either problem in the local stack. It shows the commands that read each kind of log.

Each container writes its output to Docker's log. ahoy logs shows that log by running docker compose logs with any arguments you add. Drupal records its own messages in the watchdog log, which Drush reads.

ahoy up scans the container logs right after it starts the stack and fails if any container has logged [Error]. When that happens, or when Doctor reports a container that isn't running, start with these commands:

# Show container logs
ahoy logs
# Check recent logs of a single container
ahoy logs -- --tail=50 cli
# View Drupal watchdog logs
ahoy drush watchdog:show --count=20

In ahoy logs -- --tail=50 cli, Ahoy drops the -- and passes the rest to docker compose logs; see Usage on the Ahoy page.

You can pass any service name from docker-compose.yml:

  • cli, nginx, php, database, chrome and wait-for-dependencies
  • database2, redis, solr and clamav, if you enabled them in the installer

docker compose config --services prints the names in your project.

Follow the logs​

To follow the output live, add -f. To narrow the output to 1 container, also add a service name:

# Follow the logs of all containers
ahoy logs -- -f
# Follow the logs of the nginx container
ahoy logs -- -f nginx

Press Ctrl+C to stop following.

Fix a failed start​

ahoy up runs docker compose up --detach, then exits with status 1 when docker compose logs contains the exact, case-sensitive text [Error]. ahoy up doesn't print the matching line. Each log line starts with the name of the container that wrote it, so the following command shows each matching line with its container:

ahoy logs | grep -F '[Error]'

A container keeps its log until it's removed, so an old [Error] line keeps failing ahoy up after you fix the cause. To start a new log, recreate that container, for example with ahoy up -- --force-recreate <service>.

Doctor checks that the cli, php, nginx and database containers are running, in that order. At the first container that isn't running, Doctor prints these lines and stops:

Run 'ahoy up'.
Run 'ahoy logs <service>' to see error logs.

Doctor prints the service name in place of <service>. Read that log, fix the cause and run ahoy up again.

Confirm that the stack is healthy by checking both of these:

  • ahoy up exits with status 0 (echo $? prints it), so no container has logged [Error].
  • ahoy doctor prints [ OK ] All containers are running. and ends with [ OK ] All required checks have passed.