【问题标题】:monbodb flooding the console with change from standalone to standalonemongodb 充斥着控制台,从独立到独立
【发布时间】:2021-02-15 22:01:36
【问题描述】:

我刚刚升级到 mongodb 4.4.1,控制台每隔一秒就会充斥着这些消息:

D, [2020-11-03T03:28:32.885772 #24798] DEBUG -- : MONGODB | There was a change in the members of the 'Single' topology.
D, [2020-11-03T03:28:42.875739 #24798] DEBUG -- : MONGODB | Server description for localhost:27017 changed from 'standalone' to 'standalone' [awaited].
D, [2020-11-03T03:28:42.876668 #24798] DEBUG -- : MONGODB | There was a change in the members of the 'Single' topology.
D, [2020-11-03T03:28:42.888517 #24798] DEBUG -- : MONGODB | Server description for localhost:27017 changed from 'standalone' to 'standalone'.

任何人都知道为什么会这样,如果它很糟糕,以及如何停止?

【问题讨论】:

  • 将日志级别设置为信息。
  • 感谢回复,但我需要debug,想知道是否可以在mongo级别禁用这个,就像每秒一样
  • 你可以在这里看到它enter link description here
  • 谢谢,我不想禁用所有 mongo 日志消息,只是每 1 秒拓扑更改消息

标签: mongodb


【解决方案1】:

我最近在使用 Mongoid 7.1 连接到独立(非集群)MongoDB 4.4 实例的 Rails 6 应用程序中遇到了类似的行为。下面做了一个很大的假设,即您在使用 Mongoid 的 Rails 应用程序的上下文中也看到了这种行为。

这种过度日志记录的原因似乎在于 Mongoid 所依赖的 MongoDB Ruby 驱动程序版本。具体来说,MongoDB Ruby 驱动程序中的默认日志记录级别设置为Debug。当与the default logging behaviours of Rails and Mongoid 结合使用时,这会导致在非生产环境中过多地记录 MongoDb 拓扑事件。有关更多详细信息,请参阅下面的公共 MongoDB Jira 票证。

https://jira.mongodb.org/browse/RUBY-2419

https://jira.mongodb.org/browse/RUBY-2356

2.14 版的 MongoDB Ruby 驱动程序 introduced a fix 将默认日志记录级别设置为 info。这个驱动版本本身后来被引入到 Mongoid。

升级应用中使用的 Mongoid 版本似乎已经解决了这个问题。

【讨论】:

    猜你喜欢
    • 2016-02-27
    • 2016-03-24
    • 1970-01-01
    • 1970-01-01
    • 2023-03-25
    • 2013-10-08
    • 1970-01-01
    • 1970-01-01
    • 2020-02-20
    相关资源
    最近更新 更多