added logging for queries and api serves