Results 1 to 4 of 4

Thread: How to Log Query String for Mongo

  1. #1
    Join Date
    Mar 2011
    Posts
    7

    Default How to Log Query String for Mongo

    Hey There,

    I'm trying to see why my query is returning no results... and would like to see the exact query executed. I tried to get this to log by adding

    log4j.category.org.springframework.data.document=T RACE

    to my log4j.properties i get SOME extra logging but not the query.

    Is there a way to list the query that is being executed?

    Thanks!
    Dave

  2. #2
    Join Date
    Apr 2006
    Location
    Dresden, Germany
    Posts
    483

    Default

    Do you refer to the repositories? Actually, MongoQueryCreator logs the query it creates into DEBUG level. If you'd like to see more logging output inside MongoTemplate feel free to open a JIRA.

    Regards,
    Ollie

  3. #3
    Join Date
    Aug 2004
    Posts
    1,107

    Default

    I just added some debug logging to the MongoTemplate's find methods. So if you enable DEBUG for org.springframework.data.document.mongodb you should see the query being used.
    Thomas Risberg
    SpringSource by Pivotal
    http://www.springsource.org

  4. #4
    Join Date
    Mar 2011
    Posts
    7

    Smile Thanks..

    Thanks, that helps a lot. I can see the template queries now. -D

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •