Add some logging around pkg_resources failures.

This commit is contained in:
Dave Shawley 2017-02-20 07:52:19 -05:00
parent 3a57fede12
commit c37493b318

View file

@ -1,9 +1,13 @@
import json
import logging
import pkg_resources
from tornado import web
_LOGGER = logging.getLogger(__name__)
class StatusHandler(web.RequestHandler):
"""
Simple handler that returns application status information.
@ -60,7 +64,11 @@ class StatusHandler(web.RequestHandler):
cls._application_name = pkg_info.project_name
cls._application_version = pkg_info.version
cls._package_name = None
_LOGGER.debug('found application information "%s" %s',
cls._application_name, cls._application_version)
except pkg_resources.ResolutionError:
_LOGGER.exception('failed to lookup package "%r"',
cls._package_name)
cls._application_name = None
cls._application_version = None