Suppress output from Codeship service
Asked Answered
K

2

3

I'm testing a container in Codeship that requires a database. Using services in codeship-services.yml I'm linking the database container to the application container. The problem is the database container is printing a lot of output that gets mixed with the output of the tests. I want to get rid of the MongoDB logs completely but MongoDB doesn't have options to do that.

I'm currently running it with mongod --quiet --setParameter logLevel=0 but getting a lot of output still.

So I'm looking for a solution on the Codeship side to suppress output from a container (service in Codeship terms). The

logging:
    driver: none

setting from docker-compose doesn't seem to work.

Here is my codeship-services.yml:

myapp:
  build:
    dockerfile: Dockerfile
    image: myapp
  cached: true
  links:
    - database

database:
  image: mongo:3.4.3
  command: mongod --quiet --logpath /tmp/mongo.log --setParameter logLevel=0
Kola answered 10/4, 2017 at 9:41 Comment(1)
Logging is currently a directive Codeship doesn't support yet.Fireball
C
3

If you want to reroute the MongoDB logs to /dev/null, thereby getting rid of them entirely, you should replace the path for the log output specified by the key --logpath. For instance:

database:
  image: mongo:3.4.3
  command: mongod --quiet --logpath /dev/null
Croupier answered 15/2, 2019 at 1:9 Comment(0)
S
0

If you want to get rid completely of MongoDB logs, you can redirect all output of mongod command to \dev\null.

mongod --quiet --logpath /tmp/mongo.log --setParameter logLevel=0 > /dev/null 2>&1

Scram answered 10/4, 2017 at 11:4 Comment(1)
Unfortunately this fails when I run it using jet steps. If I add > /dev/null I get he following error: about to fork child process, waiting until server is ready for connections. {ContainerRunStdout=step_name:"Test" service_name:"database"}: forked process: 16 {ContainerRunStdout=step_name:"Test" service_name:"database"}: ERROR: child process failed, exited with error number 1Kola

© 2022 - 2024 — McMap. All rights reserved.