Only log every query when debugging.

Change-Id: I4f988d81cda6f6deb0ed7f497de4aa75409b158f
Merge "Only log every query when debugging."