[JAVA-4439] Log client metadata and settings when creating a client Created: 07/Jan/22  Updated: 28/Oct/23  Resolved: 22/Mar/22

Status: Closed
Project: Java Driver
Component/s: Logging
Affects Version/s: None
Fix Version/s: 4.6.0

Type: New Feature Priority: Major - P3
Reporter: Ross Lawley Assignee: Jeffrey Yemin
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Documentation Changes: Not Needed

 Description   

This will help with support cases and is easily discoverable.

Example log statement:

10:48:53.340 [Test worker] INFO  org.mongodb.driver.client - MongoClient with metadata {"driver": {"name": "mongo-java-driver|sync", "version": "4.5.0"}, "os": {"type": "Darwin", "name": "Mac OS X", "architecture": "x86_64", "version": "11.6.4"}, "platform": "Java/Oracle Corporation/17+35-LTS-2724"} created with settings MongoClientSettings{readPreference=ReadPreference{name=secondary, hedgeOptions=null}, writeConcern=WriteConcern{w=majority, wTimeout=null ms, journal=null}, retryWrites=true, retryReads=true, readConcern=ReadConcern{level=MAJORITY}, credential=null, streamFactoryFactory=null, commandListeners=[], codecRegistry=ProvidersCodecRegistry{codecProviders=[ValueCodecProvider{}]}, clusterSettings={hosts=[127.0.0.1:27017], srvServiceName=mongodb, mode=SINGLE, requiredClusterType=UNKNOWN, requiredReplicaSetName='null', serverSelector='null', clusterListeners='[]', serverSelectionTimeout='30000 ms', localThreshold='30000 ms'}, socketSettings=SocketSettings{connectTimeoutMS=10000, readTimeoutMS=0, receiveBufferSize=0, sendBufferSize=0}, heartbeatSocketSettings=SocketSettings{connectTimeoutMS=10000, readTimeoutMS=10000, receiveBufferSize=0, sendBufferSize=0}, connectionPoolSettings=ConnectionPoolSettings{maxSize=100, minSize=0, maxWaitTimeMS=120000, maxConnectionLifeTimeMS=0, maxConnectionIdleTimeMS=0, maintenanceInitialDelayMS=0, maintenanceFrequencyMS=60000, connectionPoolListeners=[], maxConnecting=2}, serverSettings=ServerSettings{heartbeatFrequencyMS=10000, minHeartbeatFrequencyMS=500, serverListeners='[]', serverMonitorListeners='[]'}, sslSettings=SslSettings{enabled=false, invalidHostNameAllowed=false, context=null}, applicationName='null', compressorList=[], uuidRepresentation=UNSPECIFIED, serverApi=null, autoEncryptionSettings=null, contextProvider=null}



 Comments   
Comment by Githook User [ 22/Mar/22 ]

Author:

{'name': 'Jeff Yemin', 'email': 'jeff.yemin@mongodb.com', 'username': 'jyemin'}

Message: Improve info-level logging for MongoClient construction

  • include client metadata document as JSON
  • include MongoClientSettings#toString

JAVA-4439
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/e4456227e21de6a9a962addd353c81cc9ea635a7

Comment by Githook User [ 22/Mar/22 ]

Author:

{'name': 'Jeff Yemin', 'email': 'jeff.yemin@mongodb.com', 'username': 'jyemin'}

Message: Remove extraneous fields from MongoClientSettings#toString

JAVA-4439
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/e0bc8fafc5026463a2467c67dbb8355257fae201

Comment by Githook User [ 22/Mar/22 ]

Author:

{'name': 'Jeff Yemin', 'email': 'jeff.yemin@mongodb.com', 'username': 'jyemin'}

Message: Add ReadConcern#toString

JAVA-4439
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/3f544e4f8048f45a6b7667ccef777e7fe7f760c6

Comment by Githook User [ 22/Mar/22 ]

Author:

{'name': 'Jeff Yemin', 'email': 'jeff.yemin@mongodb.com', 'username': 'jyemin'}

Message: Fix typo in WriteConcern#toString

JAVA-4439
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/389e530fe1752ef784c55517d28e9a12b8c04c73

Comment by Githook User [ 22/Mar/22 ]

Author:

{'name': 'Jeff Yemin', 'email': 'jeff.yemin@mongodb.com', 'username': 'jyemin'}

Message: Add AutoEncryptionSettings#toString

All values hidden

JAVA-4439
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/39150c4275a32eaded324e66af86cf558cb9b337

Comment by Githook User [ 22/Mar/22 ]

Author:

{'name': 'Jeff Yemin', 'email': 'jeff.yemin@mongodb.com', 'username': 'jyemin'}

Message: Add toString method to codec registry-related classes

JAVA-4439
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/5e0ac8593aabb1b57daf18333a7190899d87edfa

Generated at Thu Feb 08 09:02:05 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.