Make nesting of queryLog consistent for success and failure responses.

Closes #234