diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2016-10-29 14:46:10 +0200 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2016-10-29 14:46:10 +0200 |
commit | ad67a17f02ee9ffca1e15f2aed93b9ea89531be6 (patch) | |
tree | feeb61754eef2f05736514536ace28db47830664 | |
parent | Updated CHANGELOG. (diff) | |
download | newspipe-ad67a17f02ee9ffca1e15f2aed93b9ea89531be6.tar.gz newspipe-ad67a17f02ee9ffca1e15f2aed93b9ea89531be6.tar.bz2 newspipe-ad67a17f02ee9ffca1e15f2aed93b9ea89531be6.zip |
Uses a strem handler for the logging on Heroku.
-rw-r--r-- | src/bootstrap.py | 8 | ||||
-rw-r--r-- | src/crawler/classic_crawler.py | 1 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/bootstrap.py b/src/bootstrap.py index 9358e3d8..f4b4591c 100644 --- a/src/bootstrap.py +++ b/src/bootstrap.py @@ -13,9 +13,13 @@ from urllib.parse import urlsplit def set_logging(log_path, log_level=logging.INFO, log_format='%(asctime)s %(levelname)s %(message)s'): formater = logging.Formatter(log_format) - handler = logging.FileHandler(log_path) + if conf.ON_HEROKU: + handler = logging.StreamHandler() + else: + handler = logging.FileHandler(log_path) handler.setFormatter(formater) - for logger_name in ('bootstrap', 'web', 'manager', 'runserver', 'classic_crawler'): + for logger_name in ('bootstrap', 'web', 'manager', 'runserver', + 'classic_crawler'): logger = logging.getLogger(logger_name) logger.addHandler(handler) logger.setLevel(log_level) diff --git a/src/crawler/classic_crawler.py b/src/crawler/classic_crawler.py index 4125dad7..f537cfd0 100644 --- a/src/crawler/classic_crawler.py +++ b/src/crawler/classic_crawler.py @@ -79,6 +79,7 @@ async def parse_feed(user, feed): except Exception as e: up_feed['last_error'] = str(e) up_feed['error_count'] = feed.error_count + 1 + logger.exception("error when parsing feed: " + str(e)) finally: up_feed['last_retrieved'] = datetime.now(dateutil.tz.tzlocal()) if parsed_feed is None: |