spring-data-mongodb icon indicating copy to clipboard operation
spring-data-mongodb copied to clipboard

Missing logs on mongoTemplate class

Open rrin8 opened this issue 1 year ago • 2 comments

Hi, This is a feedback on the org.springframework.data.mongodb.core.MongoTemplate cass logging. During some troubleshooting i noticed that in the mongoTemplate class, the doStream method is missing the debug logging of the query executed, the doFind with debug active Instead print the query to be executed. i also noticed on doFind that the log debug output is missing the sorting parameter (very useful for query optimization) but in other like doFindAndModify there is, maybe the logging is a little inconsistent across the various type of possibile actions.

Is a log check/alignment planned? Thanks, Riccardo

rrin8 avatar Jul 31 '24 07:07 rrin8

Thanks for reaching out. This is an issue you can help us with if you want to submit a pull request to address the issue.

mp911de avatar Aug 01 '24 07:08 mp911de

I've done some analysis of that class and logging and this is what we currently have (below list of method names)

No logging

  • stream
  • execute
  • execute through CollectionCallbacks
  • withSession
  • geoNear

With logging

  • executeQuery
  • createCollection (through doCreateCollection)
  • findOne
  • findDistinct
  • findAndModify
  • findAndRemove
  • findAndReplace

I will go through the whole class and ensure that we log as much debug information as it makes sense for all of the public methods (where it makes sense obviously).

marcingrzejszczak avatar Sep 11 '24 13:09 marcingrzejszczak