MongoDB详细日志记录。每个v添加到输出中的是什么?

时间:2013-12-20 10:05:32

标签: mongodb logging

每个'v'(从1到5)添加到日志输出中的是什么?

当然,我可以试验一下。但有人提供了具体的答案吗?

1 个答案:

答案 0 :(得分:3)

没有关于每个级别的详细程度添加的日志行的说明性列表。大多数额外的细节实际上只对MongoDB开发人员有意义(特别是随着日志级别的增加)。

如果您感到好奇,可以grep日志条目from the source code

例如,查看在第1级记录的内容:

$ grep -r "LOG(1)" * | wc -l
185

$ grep -r "LOG(1)" * | head
client/connpool.cpp:                LOG(1) << "Exception thrown when checking pooled connection to " <<
client/dbclient.cpp:            LOG(1) << "creating new connection to:" << _servers[0] << endl;
client/dbclient.cpp:            LOG(1) << "connected connection!" << endl;
client/dbclient_rs.cpp:                    LOG(1) << "checking replica set: " << name << endl;
client/dbclient_rs.cpp:            if( wasFound ){ LOG(1) << "slave '" << prev << ( wasMaster ? "' is master node, trying to find another node" :
client/dbclient_rs.cpp:            else{ LOG(1) << "slave '" << prev << "' was not found in the replica set" << endl; }
client/dbclient_rs.cpp:        else LOG(1) << "slave '" << prev << "' is not initialized or invalid" << endl;
client/dbclient_rs.cpp:            LOG(1) << "dbclient_rs getSlave falling back to a non-local secondary node" << endl;
client/dbclient_rs.cpp:        LOG(1) << "dbclient_rs getSlave no member in secondary state found, "
client/dbclient_rs.cpp:        LOG(1) <<  "_check : " << getServerAddress() << endl;