Log the query that has failed