Log failed queries.