Monday 6 March 2023

Log all queries in the official Postgres docker image

 Setting log_destination to stderr did the trick for me without creating a new image:


version: "2.2" services: db: image: postgres:12-alpine command: ["postgres", "-c", "log_statement=all", "-c", "log_destination=stderr"]


And then I was able to trace the statements using docker-compose logs -f db.

Should work with other versions too, but I only tested it with postgres:12-alpine. 

No comments:

Post a Comment