Added logging for counts and failures of lookups to CouchDB