def test5(self, ctxt, arg): transport = messaging.get_transport(cfg.CONF) target = messaging.Target(topic='test', version='2.0') client = messaging.RPCClient(transport, target, retry=None) client.call(ctxt, 'sync') try: client.prepare(retry=0).cast(ctxt, 'ping') except messaging.MessageDeliveryFailure: LOG.error("Failed to send ping message")
def default_exception_handler(ex, req, resp, params): """ Catch-all execption handler for standardized output. If this is a standard falcon HTTPError, rethrow it for handling """ if isinstance(ex, falcon.HTTPError): # allow the falcon http errors to bubble up and get handled raise ex else: # take care of the uncaught stuff exc_string = traceback.format_exc() logging.error('Unhanded Exception being handled: \n%s', exc_string) format_error_resp(req, resp, falcon.HTTP_500, error_type=ex.__class__.__name__, message="Unhandled Exception raised: %s" % str(ex), retry=True)
#!/usr/bin/env python # -*- coding:utf-8 -*- from oslo_config import cfg from oslo_log import log LOG = log.getLogger(__name__) CONF = cfg.CONF DOMAIN = "demo" log.register_options(CONF) log.setup(CONF, DOMAIN) log.info("oslo info") log.warn("oslo warning") log.error("oslo error")