From 0cd996779561171a96241e580dc3bded14aaacea Mon Sep 17 00:00:00 2001 From: Sajith Sasidharan Date: Tue, 11 Jun 2024 14:34:04 -0500 Subject: [PATCH] Make MongoDB log to a file instead of on the console --- compose.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/compose.yml b/compose.yml index 8e010a9..15dafa8 100644 --- a/compose.yml +++ b/compose.yml @@ -17,6 +17,12 @@ services: - type: volume source: mongodb target: /data/db:Z + command: + # MongoDB logs can drown out everything else, so we'll write + # them to a file. To watch the log messages, use: `docker exec + # -it tail -f /var/log/mongodb/mongod.log` + - '--logpath' + - '/var/log/mongodb/mongod.log' healthcheck: test: ["CMD", "mongosh", "localhost:${MONGO_PORT}/test", "--quiet"]