I am very new at Mongo
and I am trying to profile Mongo queries on the application (mongo client) side. I have a java application, which uses mongodb
driver to query a Mongo database and I would like to log all queries and the time each query takes. Is it possible ?
Asked
Active
Viewed 917 times
3

Michael
- 41,026
- 70
- 193
- 341
-
Yes, using the [profiler](http://docs.mongodb.org/manual/tutorial/manage-the-database-profiler/) : `db.setProfilingLevel(2)` – Ori Dar Jan 26 '14 at 15:10
-
db.setProfilingLevel( ) logs server side. The question is about client side logging... – Vegar Nov 26 '14 at 19:43
2 Answers
2
JProfiler has a MongoDB probe. It can show you hot spots with backtraces, telemetries and single events.
Disclaimer: My company develops JProfiler

Ingo Kegel
- 46,523
- 10
- 71
- 102
1
You can configure MongoDB driver logging using regular Java logging backend:
Configure logging for the MongoDB Java driver
By default Mongo server will log all slow queries, i.e. those that take more than 100ms to execute. You can change that setting on the server.