From ba2cb93b2975ec8151c95944ce4961fd7d28e326 Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Thu, 8 Oct 2015 15:48:12 +0200 Subject: [PATCH] Remove usage of WritableLogger from oslo_log With Eventlet 0.17.2, we can directly pass the logger instance. This allows us to deprecate/remove the WritableLogger class from oslo.log. Closes-Bug: #1440773 Change-Id: I3985b30b499a1e676d39c2a6cd3a31ac13c0ab47 --- neutron/agent/linux/utils.py | 3 +-- neutron/tests/unit/test_wsgi.py | 4 +--- neutron/wsgi.py | 3 +-- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/neutron/agent/linux/utils.py b/neutron/agent/linux/utils.py index f3c8da772..8d78a7d63 100644 --- a/neutron/agent/linux/utils.py +++ b/neutron/agent/linux/utils.py @@ -29,7 +29,6 @@ from eventlet.green import subprocess from eventlet import greenthread from oslo_config import cfg from oslo_log import log as logging -from oslo_log import loggers from oslo_rootwrap import client from oslo_utils import excutils import six @@ -418,4 +417,4 @@ class UnixDomainWSGIServer(wsgi.Server): application, max_size=self.num_threads, protocol=UnixDomainHttpProtocol, - log=loggers.WritableLogger(logger)) + log=logger) diff --git a/neutron/tests/unit/test_wsgi.py b/neutron/tests/unit/test_wsgi.py index c7a403e2d..f70ed6300 100644 --- a/neutron/tests/unit/test_wsgi.py +++ b/neutron/tests/unit/test_wsgi.py @@ -176,8 +176,7 @@ class TestWSGIServer(base.BaseTestCase): server.stop() @mock.patch.object(wsgi, 'eventlet') - @mock.patch.object(wsgi, 'loggers') - def test__run(self, logging_mock, eventlet_mock): + def test__run(self, eventlet_mock): server = wsgi.Server('test') server._run("app", "socket") eventlet_mock.wsgi.server.assert_called_once_with( @@ -188,7 +187,6 @@ class TestWSGIServer(base.BaseTestCase): keepalive=CONF.wsgi_keep_alive, socket_timeout=server.client_socket_timeout ) - self.assertTrue(len(logging_mock.mock_calls)) class SerializerTest(base.BaseTestCase): diff --git a/neutron/wsgi.py b/neutron/wsgi.py index dacbadf8e..89d7b8340 100644 --- a/neutron/wsgi.py +++ b/neutron/wsgi.py @@ -29,7 +29,6 @@ import eventlet.wsgi from oslo_config import cfg import oslo_i18n from oslo_log import log as logging -from oslo_log import loggers from oslo_serialization import jsonutils from oslo_service import service as common_service from oslo_service import systemd @@ -288,7 +287,7 @@ class Server(object): """Start a WSGI server in a new green thread.""" eventlet.wsgi.server(socket, application, max_size=self.num_threads, - log=loggers.WritableLogger(LOG), + log=LOG, keepalive=CONF.wsgi_keep_alive, socket_timeout=self.client_socket_timeout) -- 2.45.2