I have a java application which use morphia to work with mongodb.
I want to log all the queries sent to mongodb in a file, which I can analyze them to improve the performance. But I don't find a way to log them.
I know mongodb can log the queries in system.profile
collection, but I still want a log file.
How to do that?
Do you use SLF4J or Logback/Log4J? Add Morphias' SLF4JExtension to your CLASSPATH.
Then simply enable com.google.code.morphia
logger and log it wherever you want.