Remove unnecessary ERROR logging

Some API calls lead to ERROR logging of expected and unexceptional
events (e.g., non-existant resource name/ID supplied by API call.).
These "normal errors" are indicated by API response and do not
belong in the ERROR logging consumed by deployer.

This patch removes the ERROR logging or downgrades to DEBUG logging.

Change-Id: I6e33471e2c28d229dc0f8647a1e59f7fd711df7b
This commit is contained in:
Eric K 2018-05-11 10:45:29 -07:00
parent 7a6ce94630
commit 305d25d5e2
7 changed files with 22 additions and 19 deletions

View File

@ -62,7 +62,7 @@ class DatasourceModel(base.APIModel):
datasource = self.bus.get_datasource(id_)
return datasource
except exception.DatasourceNotFound as e:
LOG.exception("Datasource '%s' not found", id_)
LOG.debug("Datasource '%s' not found", id_)
raise webservice.DataModelException(e.code, str(e),
http_status_code=e.code)
@ -90,7 +90,7 @@ class DatasourceModel(base.APIModel):
exception.DatasourceNameInUse,
exception.DriverNotFound,
exception.DatasourceCreationError) as e:
LOG.exception(_("Datasource creation failed."))
LOG.debug(_("Datasource creation failed."))
raise webservice.DataModelException(
e.code, webservice.original_msg(e), http_status_code=e.code)
@ -126,7 +126,7 @@ class DatasourceModel(base.APIModel):
# Note(thread-safety): blocking call
self.invoke_rpc(caller, 'request_refresh', args)
except exception.CongressException as e:
LOG.exception(e)
LOG.debug(e)
raise webservice.DataModelException.create(e)
# Note(thread-safety): blocking function

View File

@ -89,7 +89,7 @@ class RowModel(base.APIModel):
except exception.CongressException as e:
m = ("Error occurred while processing source_id '%s' for row "
"data of the table '%s'" % (source_id, table_id))
LOG.exception(m)
LOG.debug(m)
raise webservice.DataModelException.create(e)
if gen_trace and caller is base.ENGINE_SERVICE_ID:
@ -117,7 +117,7 @@ class RowModel(base.APIModel):
LOG.info("replace_items(context=%s)", context)
# Note(thread-safety): blocking call
caller, source_id = api_utils.get_id_from_context(context)
# FIXME(threod-safety): in DSE2, the returned caller can be a
# FIXME(thread-safety): in DSE2, the returned caller can be a
# datasource name. But the datasource name may now refer to a new,
# unrelated datasource. Causing the rest of this code to operate on
# an unintended datasource.
@ -131,9 +131,9 @@ class RowModel(base.APIModel):
# Note(thread-safety): blocking call
self.invoke_rpc(caller, 'replace_entire_table_data', args)
except exception.CongressException as e:
LOG.exception("Error occurred while processing updating rows "
"for source_id '%s' and table_id '%s'",
source_id, table_id)
LOG.debug("Error occurred while processing updating rows "
"for source_id '%s' and table_id '%s'",
source_id, table_id, exc_info=True)
raise webservice.DataModelException.create(e)
LOG.info("finish replace_items(context=%s)", context)
LOG.debug("replaced table %s with row items: %s",

View File

@ -54,8 +54,8 @@ class TableModel(base.APIModel):
# Note(thread-safety): blocking call
tablename = self.invoke_rpc(caller, 'get_tablename', args)
except exception.CongressException as e:
LOG.exception("Exception occurred while retrieving table %s"
"from datasource %s", id_, source_id)
LOG.debug("Exception occurred while retrieving table %s"
"from datasource %s", id_, source_id)
raise webservice.DataModelException.create(e)
if tablename:
@ -90,8 +90,8 @@ class TableModel(base.APIModel):
tablenames = self.invoke_rpc(caller, 'get_tablenames',
{'source_id': source_id})
except exception.CongressException as e:
LOG.exception("Exception occurred while retrieving tables"
"from datasource %s", source_id)
LOG.debug("Exception occurred while retrieving tables"
"from datasource %s", source_id)
raise webservice.DataModelException.create(e)
# when the source_id doesn't have any table, 'tablenames' is set([])
if isinstance(tablenames, set) or isinstance(tablenames, list):

View File

@ -622,7 +622,7 @@ class DataSourceDriver(data_service.DataService):
table_state = self.state[table_id]
except KeyError:
m = ("tablename '%s' does not exist'" % (table_id))
LOG.exception(m)
LOG.debug(m)
raise exception.NotFound(m)
for tup in table_state:

View File

@ -72,7 +72,8 @@ class DSManagerService(data_service.DataService):
except db_exc.DBDuplicateEntry:
raise exception.DatasourceNameInUse(value=req['name'])
except db_exc.DBError:
LOG.exception('Creating a new datasource failed.')
LOG.exception('Creating a new datasource failed due to '
'database backend error.')
raise exception.DatasourceCreationError(value=req['name'])
new_id = datasource['id']
@ -85,8 +86,8 @@ class DSManagerService(data_service.DataService):
engine.synchronizer.sync_one_policy(req['name'])
# TODO(dse2): also broadcast to all PE nodes to synch
except exception.DataServiceError:
LOG.exception('the datasource service is already '
'created in the node')
LOG.debug('the datasource service is already '
'created in the node')
except Exception:
LOG.exception(
'Unexpected exception encountered while registering '

View File

@ -128,7 +128,8 @@ class LibraryService (data_service.DataService):
policy = db_library_policies.add_policy(policy_dict=policy_dict)
return policy.to_dict()
except db_exc.DBError:
LOG.exception('Creating a new library policy failed.')
LOG.exception('Creating a new library policy failed due to '
'backend database error.')
raise
def get_policies(self, include_rules=True):

View File

@ -298,7 +298,8 @@ class Runtime (object):
raise
except Exception:
policy_name = policy_obj.name
msg = "Error thrown while adding policy %s into DB." % policy_name
msg = ("Unexpected error while adding policy %s into DB."
% policy_name)
LOG.exception(msg)
raise exception.PolicyException(msg)
if db_session:
@ -793,7 +794,7 @@ class Runtime (object):
except KeyError:
msg = ("policy with name or id '%s' doesn't exist" % source_id)
LOG.exception(msg)
LOG.debug(msg)
raise exception.NotFound(msg)
return self._create_status_dict(target, keys)