From 61ae4a2cd304b76a4383725b4db4065c8f3b544f Mon Sep 17 00:00:00 2001 From: Mehdi Abaakouk Date: Fri, 18 May 2018 17:31:53 +0200 Subject: [PATCH] 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 --- panko/storage/impl_sqlalchemy.py | 2 +- panko/storage/pymongo_base.py | 2 +- panko/tests/functional/storage/test_storage_scenarios.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/panko/storage/impl_sqlalchemy.py b/panko/storage/impl_sqlalchemy.py index 29b5b970..abe30157 100644 --- a/panko/storage/impl_sqlalchemy.py +++ b/panko/storage/impl_sqlalchemy.py @@ -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: diff --git a/panko/storage/pymongo_base.py b/panko/storage/pymongo_base.py index 0d238c6f..5cc16a0a 100644 --- a/panko/storage/pymongo_base.py +++ b/panko/storage/pymongo_base.py @@ -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 diff --git a/panko/tests/functional/storage/test_storage_scenarios.py b/panko/tests/functional/storage/test_storage_scenarios.py index 30e2dba5..71b60600 100644 --- a/panko/tests/functional/storage/test_storage_scenarios.py +++ b/panko/tests/functional/storage/test_storage_scenarios.py @@ -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()