[JAVA-2804] Log queries Created: 12/Mar/18  Updated: 13/Mar/18  Resolved: 13/Mar/18

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

Type: Improvement Priority: Major - P3
Reporter: Yassen Bantchev Assignee: Ross Lawley
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates JAVA-2698 Include more of the command document ... Closed

 Description   

Even with log level configured to "trace" the exact queries sent to the Mongo server are not logged when doing CRUD operations similarly to the way they are in the Ruby driver for example. This is a significant obstacle during development.



 Comments   
Comment by Yassen Bantchev [ 13/Mar/18 ]

Yes, it's a duplicate, sorry I missed that one. Looking forward to 3.7!

Comment by Jeffrey Yemin [ 12/Mar/18 ]

Linking to JAVA-2698, which I expect will address your concerns. A fix for this issue will be included in the 3.7 release of the driver in the next few months.

The command logging is included at DEBUG in the org.mongodb.driver.protocol.command logger, and looks like this (the example is for the find command):

10:18:18.819 [main] DEBUG org.mongodb.driver.protocol.command - Sending command '{ "find" : "test", "filter" : { "x" : 1 }, "sort" : { "y" : 1 }, "projection" : { "y" : 1 }, "$db" : "test", "lsid" : { "id" : { "$binary" : { "base64" : "ShsRPF35T0ijm0Lpnj9CIA==", "subType" : "04" } } }, "$readPreference" : { "mode" : "primaryPreferred" } }' with request id 8 to database test on connection [connectionId{localValue:2, serverValue:433}] to server 127.0.0.1:27017

Let us know if this meets your needs, and if so I'll resolve this as a duplicate.

Generated at Thu Feb 08 08:58:06 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.