Postgres dockerized: enable query logging
Jan 18, 2024
Change your docker-compose.yml
adding the command below
version: '3'
services:
postgresql:
image: /postgres:latest
container_name: postgresql
ports:
- "5432:5432"
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: secret
restart: always
command: ["postgres", "-c", "log_statement=all", "-c", "log_destination=stderr"]
stop and restart, then run docker-compose logs -f postgresl
to see also logs printed out to the stderr