From db720b23580ac9c3e52ff4bf5c85d329e3045828 Mon Sep 17 00:00:00 2001 From: Diego Cepeda Date: Mon, 31 Jan 2022 17:31:09 -0800 Subject: [PATCH] add error logging to healtcheck --- src/oncall/healthcheck.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/oncall/healthcheck.py b/src/oncall/healthcheck.py index 6ac3794..f5a38e6 100644 --- a/src/oncall/healthcheck.py +++ b/src/oncall/healthcheck.py @@ -4,6 +4,9 @@ from falcon import HTTPNotFound, HTTPInternalServerError from . import db +import logging +logger = logging.getLogger('oncall.app') + class HealthCheck(object): @@ -29,11 +32,13 @@ class HealthCheck(object): cursor.close() connection.close() except: + logger.exception('failed to query DB for healthcheck') raise HTTPInternalServerError() try: with open(self.path) as f: status = f.readline().strip() except: + logger.error('could not find healthcheck file') raise HTTPNotFound() resp.content_type = 'text/plain' resp.body = status