diff --git a/marconi/bootstrap.py b/marconi/bootstrap.py index 5051e9727..5db7adc17 100644 --- a/marconi/bootstrap.py +++ b/marconi/bootstrap.py @@ -50,7 +50,8 @@ class Bootstrap(object): invoke_on_load=True) return mgr.driver except RuntimeError as exc: - raise exceptions.InvalidDriver(exc) + LOG.exception(exc) + raise exceptions.InvalidDriver(exc) @decorators.lazy_property(write=False) def transport(self): @@ -62,7 +63,8 @@ class Bootstrap(object): invoke_args=[self.storage]) return mgr.driver except RuntimeError as exc: - raise exceptions.InvalidDriver(exc) + LOG.exception(exc) + raise exceptions.InvalidDriver(exc) def run(self): self.transport.listen() diff --git a/marconi/transport/auth.py b/marconi/transport/auth.py index 42a85f6c7..5867db493 100644 --- a/marconi/transport/auth.py +++ b/marconi/transport/auth.py @@ -17,8 +17,12 @@ from keystoneclient.middleware import auth_token +from marconi.openstack.common import log + STRATEGIES = {} +LOG = log.getLogger(__name__) + class KeystoneAuth(object): @@ -35,6 +39,7 @@ class KeystoneAuth(object): @classmethod def install(cls, app, conf): """Install Auth check on application.""" + LOG.debug(_("Installing Keystone's auth protocol")) cls._register_opts(conf) conf = dict(conf.get(cls.OPT_GROUP_NAME)) return auth_token.AuthProtocol(app, conf=conf) diff --git a/marconi/transport/wsgi/claims.py b/marconi/transport/wsgi/claims.py index ad4917b34..96ca6d144 100644 --- a/marconi/transport/wsgi/claims.py +++ b/marconi/transport/wsgi/claims.py @@ -35,6 +35,9 @@ class CollectionResource(object): self.claim_controller = claim_controller def on_post(self, req, resp, project_id, queue_name): + LOG.debug(_("Claims collection POST - queue: %(queue)s, " + "project: %(project)s") % + {"queue": queue_name, "project": project_id}) # Check for an explicit limit on the # of messages to claim limit = req.get_param_as_int('limit') claim_options = {} if limit is None else {'limit': limit} @@ -87,6 +90,11 @@ class ItemResource(object): self.claim_controller = claim_controller def on_get(self, req, resp, project_id, queue_name, claim_id): + LOG.debug(_("Claim item GET - claim: %(claim_id)s, " + "queue: %(queue_name)s, project: %(project_id)s") % + {"queue_name": queue_name, + "project_id": project_id, + "claim_id": claim_id}) try: meta, msgs = self.claim_controller.get( queue_name, @@ -119,6 +127,11 @@ class ItemResource(object): resp.status = falcon.HTTP_200 def on_patch(self, req, resp, project_id, queue_name, claim_id): + LOG.debug(_("Claim Item PATCH - claim: %(claim_id)s, " + "queue: %(queue_name)s, project:%(project_id)s") % + {"queue_name": queue_name, + "project_id": project_id, + "claim_id": claim_id}) # Read claim metadata (e.g., TTL) and raise appropriate # HTTP errors as needed. metadata, = wsgi_helpers.filter_stream(req.stream, req.content_length, @@ -140,6 +153,11 @@ class ItemResource(object): raise wsgi_exceptions.HTTPServiceUnavailable(description) def on_delete(self, req, resp, project_id, queue_name, claim_id): + LOG.debug(_("Claim item DELETE - claim: %(claim_id)s, " + "queue: %(queue_name)s, project: %(project_id)s") % + {"queue_name": queue_name, + "project_id": project_id, + "claim_id": claim_id}) try: self.claim_controller.delete(queue_name, claim_id=claim_id, diff --git a/marconi/transport/wsgi/messages.py b/marconi/transport/wsgi/messages.py index 98212f691..372dabccf 100644 --- a/marconi/transport/wsgi/messages.py +++ b/marconi/transport/wsgi/messages.py @@ -128,6 +128,10 @@ class CollectionResource(object): #----------------------------------------------------------------------- def on_post(self, req, resp, project_id, queue_name): + LOG.debug(_("Messages collection POST - queue: %(queue)s, " + "project: %(project)s") % + {"queue": queue_name, "project": project_id}) + uuid = req.get_header('Client-ID', required=True) # Pull out just the fields we care about @@ -187,6 +191,10 @@ class CollectionResource(object): resp.body = helpers.to_json(body) def on_get(self, req, resp, project_id, queue_name): + LOG.debug(_("Messages collection GET - queue: %(queue)s, " + "project: %(project)s") % + {"queue": queue_name, "project": project_id}) + resp.content_location = req.relative_uri ids = req.get_param_as_list('ids') @@ -211,6 +219,11 @@ class ItemResource(object): self.message_controller = message_controller def on_get(self, req, resp, project_id, queue_name, message_id): + LOG.debug(_("Messages item GET - message: %(message)s, " + "queue: %(queue)s, project: %(project)s") % + {"message": message_id, + "queue": queue_name, + "project": project_id}) try: messages = self.message_controller.get( queue_name, @@ -239,6 +252,11 @@ class ItemResource(object): resp.status = falcon.HTTP_200 def on_delete(self, req, resp, project_id, queue_name, message_id): + LOG.debug(_("Messages item DELETE - message: %(message)s, " + "queue: %(queue)s, project: %(project)s") % + {"message": message_id, + "queue": queue_name, + "project": project_id}) try: self.message_controller.delete( queue_name, diff --git a/marconi/transport/wsgi/queues.py b/marconi/transport/wsgi/queues.py index c5ec5fd27..91c2100b7 100644 --- a/marconi/transport/wsgi/queues.py +++ b/marconi/transport/wsgi/queues.py @@ -53,6 +53,9 @@ class ItemResource(object): #----------------------------------------------------------------------- def on_put(self, req, resp, project_id, queue_name): + LOG.debug(_("Queue item PUT - queue: %(queue)s, " + "project: %(project)s") % + {"queue": queue_name, "project": project_id}) # TODO(kgriffs): Migrate this check to input validator middleware if req.content_length > transport.MAX_QUEUE_METADATA_SIZE: description = _('Queue metadata size is too large.') @@ -90,6 +93,9 @@ class ItemResource(object): resp.location = req.path def on_get(self, req, resp, project_id, queue_name): + LOG.debug(_("Queue item GET - queue: %(queue)s, " + "project: %(project)s") % + {"queue": queue_name, "project": project_id}) message_ids = req.get_param_as_list('ids') if message_ids is None: doc = self._get_metadata(project_id, queue_name) @@ -102,6 +108,9 @@ class ItemResource(object): resp.body = helpers.to_json(doc) def on_delete(self, req, resp, project_id, queue_name): + LOG.debug(_("Queue item DELETE - queue: %(queue)s, " + "project: %(project)s") % + {"queue": queue_name, "project": project_id}) try: self.queue_controller.delete(queue_name, project=project_id)