log the query