MongoDB:调试操作是什么?

时间:2017-01-08 12:13:57

标签: java mongodb spring-mvc logback

我在spring mvc中使用mongo 3.4,关于mongo的版本是

<!-- https://mvnrepository.com/artifact/org.mongodb/mongo-java-driver -->
    <dependency>
        <groupId>org.mongodb</groupId>
        <artifactId>mongo-java-driver</artifactId>
        <version>3.4.0</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.springframework.data/spring-data-mongodb -->
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-mongodb</artifactId>
        <version>1.9.2.RELEASE</version>
    </dependency>

但每隔10秒就会出现调试信息:

20:10:43.789 DEBUG [cluster-ClusterId{value='58722ad16230c2332cf90a44', description='null'}-139.224.222.20:27017] [o.m.d.cluster]:56 - Checking status of 139.224.222.20:27017
20:10:43.801 DEBUG [cluster-ClusterId{value='58722ad16230c2332cf90a44', description='null'}-139.224.222.20:27017] [o.m.d.cluster]:56 - Updating cluster description to  {type=STANDALONE, servers=[{address=139.224.222.20:27017, type=STANDALONE, roundTripTime=15.2 ms, state=CONNECTED}]

有人可以告诉我调试操作的目的是什么,这个操作会影响性能吗?

1 个答案:

答案 0 :(得分:0)

20:10:43.801 DEBUG [cluster-ClusterId{value='58722ad16230c2332cf90a44', description='null'}-139.224.222.20:27017] [o.m.d.cluster]:56 - Updating cluster description to  {type=STANDALONE, servers=[{address=139.224.222.20:27017, type=STANDALONE, roundTripTime=15.2 ms, state=CONNECTED}]

上述行不会损害性能并代表: //给出db的状态        []

有五个严重性级别,Debug是其中之一,debug有一个Verbosity Levels&gt; 0确定MongoDB输出的信息和调试消息的数量。

您可以通过此命令设置输出级别:

db.setLogLevel(-1, "query")

-1如果您不想要任何调试消息,请将级别设置为1到5。