print query to log