add logging of queries