log query errors in log file