From dd5e94cf861b8c86ab4ed7687bde9f3acb17206e Mon Sep 17 00:00:00 2001 From: James Turk Date: Wed, 11 Jul 2012 14:58:00 -0400 Subject: [PATCH] elasticsearch log fix --- oyster/ext/elasticsearch.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/oyster/ext/elasticsearch.py b/oyster/ext/elasticsearch.py index 451e569..7c0c7bb 100644 --- a/oyster/ext/elasticsearch.py +++ b/oyster/ext/elasticsearch.py @@ -7,11 +7,11 @@ from ..conf import settings from pyes import ES es = ES(settings.ELASTICSEARCH_HOST) +log = logging.getLogger('oyster.ext.elasticsearch') class ElasticSearchPush(Task): # results go straight to elasticsearch ignore_result = True - log = logging.getLogger('oyster.ext.elasticsearch') def run(self, doc_id): doc = kernel.db.tracked.find_one({'_id': doc_id}) @@ -19,19 +19,18 @@ class ElasticSearchPush(Task): try: text = kernel.extract_text(doc) if not text: - self.log.info('no text for %s', doc_id, - extra={'doc_class':doc['doc_class']}) + log.info('no text for %s', doc_id, + extra={'doc_class':doc['doc_class']}) return - self.log.info('tracked %s', doc_id, - extra={'doc_class':doc['doc_class']}) + log.info('tracked %s', doc_id, + extra={'doc_class':doc['doc_class']}) es.index(dict(doc['metadata'], text=text), settings.ELASTICSEARCH_INDEX, settings.ELASTICSEARCH_DOC_TYPE, id=doc_id) except Exception as e: - self.log.warning('error tracking %s', doc_id, - extra={'doc_class':doc['doc_class']}, - exc_info=True) + log.warning('error tracking %s', doc_id, + extra={'doc_class':doc['doc_class']}, exc_info=True) raise