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:
Mehdi Abaakouk 2018-05-18 17:31:53 +02:00
parent f5bc9f5faf
commit 61ae4a2cd3
3 changed files with 3 additions and 3 deletions

View File

@ -206,7 +206,7 @@ class Connection(base.Connection):
session.execute(model.__table__.insert(),
trait_map[dtype])
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:
LOG.exception('Failed to record event: %s', e)
except Exception as e:

View File

@ -63,7 +63,7 @@ class Connection(base.Connection):
'timestamp': event_model.generated,
'traits': traits, 'raw': event_model.raw})
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:
LOG.exception("Failed to record event: %s", ex)
error = ex

View File

@ -90,7 +90,7 @@ class EventTest(EventTestBase):
with mock.patch('%s.LOG' %
self.conn.record_events.__module__) as log:
self.conn.record_events(m)
self.assertEqual(1, log.info.call_count)
self.assertEqual(1, log.debug.call_count)
def test_bad_event(self):
now = datetime.datetime.utcnow()