How to log the queries executed by Spring Data MongoDB?
问题 Is there a way to find the query that was run against the database in spring data mongodb? I know this is possible in case of JPA. So was just wondering if there was something similar in Spring data MongoDB? 回答1: The easiest way is to set the log level to DEBUG for org.springframework.data.mongodb . 回答2: logging: level: org.springframework.data.mongodb.core.MongoTemplate: DEBUG To clarify Oliver's answer add that to the application.yml file or properties file. 来源: https://stackoverflow.com