From e065f4469d7a986069e8a46c098e70dfff114325 Mon Sep 17 00:00:00 2001 From: Maru Newby Date: Wed, 27 Nov 2013 07:57:48 +0000 Subject: [PATCH] Stop logging unnecessary warning on context create The context was previously logging at the 'warn' level when unknown kwargs were being passed to its __init__(). Since the agents were passing tenant=None with each rpc request, this was generating an unreasonable amount of log chatter that would not be useful to an operator. The fix is to log at the debug level instead so that the operators don't see the output by default but developers can still choose to. Change-Id: I5c328f628c597eb949c1fe67b23120d2b5d1c7da Related-Bug: #1254530 Partial-Bug: #1255441 --- neutron/context.py | 4 ++-- neutron/tests/unit/test_neutron_context.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/neutron/context.py b/neutron/context.py index 1dadd4c4b0..af24696631 100644 --- a/neutron/context.py +++ b/neutron/context.py @@ -80,8 +80,8 @@ class ContextBase(common_context.RequestContext): # Log only once the context has been configured to prevent # format errors. if kwargs: - LOG.warn(_('Arguments dropped when creating ' - 'context: %s'), kwargs) + LOG.debug(_('Arguments dropped when creating ' + 'context: %s'), kwargs) @property def project_id(self): diff --git a/neutron/tests/unit/test_neutron_context.py b/neutron/tests/unit/test_neutron_context.py index a756e8f2bb..5a36c850e0 100644 --- a/neutron/tests/unit/test_neutron_context.py +++ b/neutron/tests/unit/test_neutron_context.py @@ -43,10 +43,10 @@ class TestNeutronContext(base.BaseTestCase): self.assertIsNone(ctx.user_name) self.assertIsNone(ctx.tenant_name) - def test_neutron_context_create_logs_unknown_kwargs(self): - with mock.patch.object(context.LOG, 'warn') as mock_warn: - context.Context('user_id', 'tenant_id', foo='bar') - self.assertEqual(mock_warn.call_count, 1) + def test_neutron_context_create_logs_unknown_kwarg(self): + with mock.patch.object(context.LOG, 'debug') as mock_log: + context.Context('user_id', 'tenant_id', foo=None) + self.assertEqual(mock_log.call_count, 1) def test_neutron_context_create_with_name(self): ctx = context.Context('user_id', 'tenant_id',