使用mongo-java-drivers控制mongodb的日志输出

原文:https://www.jianshu.com/p/1ec6e6ddaa1f

项目同样是使用mongo-java-drivers作为mongodb驱动,控制台一直输出各种连接池和集群的日志,太烦人了,可以在logback.xml过滤指定包的日志输出级别,只输出warn以上的日志


        
            
            
            
        
        
        
            
            
            
        

 

mongo-java-drivers 的官方文档,发现有如下配置可以设定

The driver uses the following logger names:

org.mongodb.driver: the root logger
cluster: for logs related to monitoring of the MongoDB servers to which the driver connects
connection: for logs related to connections and connection pools
protocol: for logs related to protocol message sent to and received from a MongoDB server
insert: for logs related to insert messages and responses
update: for logs related to update messages and responses
delete: for logs related to delete messages and responses
query: for logs related to query messages and responses
getmore: for logs related to getmore messages and responses
killcursor: for logs related to killcursor messages and responses
command: for logs related to command messages and responses
uri: for logs related to connection string parsing
management: for logs related to JMX

 

你可能感兴趣的:(mongodb,java,springboot)