Log sql errors.