storage: hide useless logs
Logging the sqlalchemy DuplicateEntry error message on each event is useless. And people may though it's an error. This change moves the log level to debug. Change-Id: I86b64e5cf370386dab6f962b09029feeb35a9dbf
This commit is contained in:
parent
f5bc9f5faf
commit
61ae4a2cd3
|
@ -206,7 +206,7 @@ class Connection(base.Connection):
|
||||||
session.execute(model.__table__.insert(),
|
session.execute(model.__table__.insert(),
|
||||||
trait_map[dtype])
|
trait_map[dtype])
|
||||||
except dbexc.DBDuplicateEntry as e:
|
except dbexc.DBDuplicateEntry as e:
|
||||||
LOG.info("Duplicate event detected, skipping it: %s", e)
|
LOG.debug("Duplicate event detected, skipping it: %s", e)
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
LOG.exception('Failed to record event: %s', e)
|
LOG.exception('Failed to record event: %s', e)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
@ -63,7 +63,7 @@ class Connection(base.Connection):
|
||||||
'timestamp': event_model.generated,
|
'timestamp': event_model.generated,
|
||||||
'traits': traits, 'raw': event_model.raw})
|
'traits': traits, 'raw': event_model.raw})
|
||||||
except pymongo.errors.DuplicateKeyError as ex:
|
except pymongo.errors.DuplicateKeyError as ex:
|
||||||
LOG.info("Duplicate event detected, skipping it: %s", ex)
|
LOG.debug("Duplicate event detected, skipping it: %s", ex)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
LOG.exception("Failed to record event: %s", ex)
|
LOG.exception("Failed to record event: %s", ex)
|
||||||
error = ex
|
error = ex
|
||||||
|
|
|
@ -90,7 +90,7 @@ class EventTest(EventTestBase):
|
||||||
with mock.patch('%s.LOG' %
|
with mock.patch('%s.LOG' %
|
||||||
self.conn.record_events.__module__) as log:
|
self.conn.record_events.__module__) as log:
|
||||||
self.conn.record_events(m)
|
self.conn.record_events(m)
|
||||||
self.assertEqual(1, log.info.call_count)
|
self.assertEqual(1, log.debug.call_count)
|
||||||
|
|
||||||
def test_bad_event(self):
|
def test_bad_event(self):
|
||||||
now = datetime.datetime.utcnow()
|
now = datetime.datetime.utcnow()
|
||||||
|
|
Loading…
Reference in New Issue