[JAVA-4377] Add debug logging for number of results in query batches Created: 27/Oct/21  Updated: 28/Oct/23  Resolved: 09/Nov/21

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

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

Documentation Changes: Not Needed

 Description   

The driver already has debug logging available for server replies, but the log message is generic and doesn't log the actual response document. Normally this isn't a problem, but for cursor-related responses it can sometimes be useful to know the number of documents returned in each batch.

We should add debug logging to QueryBatchCursor and AsyncQueryBatchCursor to log the number of documents returned in each batch.



 Comments   
Comment by Githook User [ 09/Nov/21 ]

Author:

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

Message: Log cursor results at debug level (#817)

  • The logger name is "org.mongodb.driver.operation"
  • The message is "Received batch of %s documents with cursorId %d from server %s"
  • It logs the initial results and results from each getMore for both sync and reactive cursors

JAVA-4377
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/e3dac020e12d377a5d829356369a661793ae8c45

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