I'm using Spring Data's Querydsl integration to execute my queries using predicates.
我使用Spring Data的Querydsl集成来使用谓词执行查询。
findAll(predicate, pageable)
Is there a way to dump the actual raw queries/commands that get executed?
是否有一种方法可以转储实际执行的原始查询/命令?
I have also looked at the answer to this question and it wasn't working for me.. Configure logging for the MongoDB Java driver
我也研究过这个问题的答案,但它并不适合我。为MongoDB Java驱动程序配置日志记录
--Update-- I've managed to get the logging working by adding logging.level.org.mongodb.driver=DEBUG in application.properties (not log4j.properties)
—Update—通过在应用程序中添加logger .level.org.mongodb.driver=DEBUG,我成功地让日志工作了起来。属性(不是log4j . properties)
But still, I can't see the raw query that's being performed:
但是,我仍然看不到正在执行的原始查询:
2016-03-23 21:50:56 DEBUG query:56 - Query completed 2016-03-23 21:50:56 DEBUG query:56 - Sending query of namespace testdb.reservation on connection [connectionId{localValue:4, serverValue:42631}] to server ds046785.mongolab.com:39186
2016-03-23 21:50:56调试查询:56 -完成查询2016-03-23 21:50:56调试查询:56 -发送名称空间testdb查询对服务器ds046785.mongolab.com的连接[connectionId{localValue:4, serverValue:42631}]的预订
1 个解决方案
#1
4
Enable the profiler by setting the profile value using the following command in the mongo shell:
通过在mongo shell中使用以下命令设置配置文件值来启用分析器:
db.setProfilingLevel(2)
output of the profiler can be viewed using this command:
可以使用以下命令查看分析器的输出:
db.system.profile.find( { millis : { $gt : 100 } } )
This command displays all operations longer than 100 milliseconds
此命令显示超过100毫秒的所有操作
#1
4
Enable the profiler by setting the profile value using the following command in the mongo shell:
通过在mongo shell中使用以下命令设置配置文件值来启用分析器:
db.setProfilingLevel(2)
output of the profiler can be viewed using this command:
可以使用以下命令查看分析器的输出:
db.system.profile.find( { millis : { $gt : 100 } } )
This command displays all operations longer than 100 milliseconds
此命令显示超过100毫秒的所有操作