aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap.py8
-rw-r--r--src/crawler/classic_crawler.py1
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:
bgstack15