mongodb - 抑制 Codeship 服务的输出

标签 mongodb logging docker codeship

我正在 Codeship 中测试一个需要数据库的容器。使用 codeship-services.yml 中的服务,我将数据库容器链接到应用程序容器。问题是数据库容器正在打印大量与测试输出混合的输出。我想完全摆脱 MongoDB 日志,但 MongoDB 没有这样做的选项。

我目前正在运行它 mongod --quiet --setParameter logLevel=0 但仍然有很多输出。

所以我正在 Codeship 端寻找一种解决方案来抑制容器的输出(Codeship 术语中的服务)。

logging:
    driver: none

docker-compose 的设置似乎不起作用。

这是我的 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

最佳答案

如果您想将 MongoDB 日志重新路由到 /dev/null,从而完全摆脱它们,您应该替换由键 --logpath 指定的日志输出路径。例如:

database:
  image: mongo:3.4.3
  command: mongod --quiet --logpath /dev/null

关于mongodb - 抑制 Codeship 服务的输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43319795/

相关文章:

node.js - 如何将 mongodb 查询拆分为结果页

Python 旋转文件处理程序不旋转

debugging - c3p0 使用 Play Framework 1 进行日志记录?

python - 使用 PyObjC 时如何使 NSLog 与 Python 的日志模块一起工作?

python - 使用远程容器Python解释器的PyCharm远程调试

c# - Azure 上的 MongoDB : replSet can't get local. system.replset 配置

node.js - findOne 在服务器上返回未定义

mongodb 如何将 mongodump 仅索引到另一个 mongodb 实例

wordpress - 如何在docker-compose中设置WORDPRESS_DB_HOST

ubuntu - 当我启动容器时启动 tor 和 polipo