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
This commit is contained in:
Maru Newby 2013-11-27 07:57:48 +00:00
parent 522ec7de54
commit 5b61df1f53
2 changed files with 6 additions and 6 deletions

View File

@ -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):

View File

@ -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',