Add getter mode for logQueries.

This is useful if you want to know whether or not a connection is
currently logging queries.
Merge pull request #4128 from markstory/3.0-log-queries

Add getter mode for logQueries.