diff --git a/manila/tests/wsgi/test_wsgi.py b/manila/tests/wsgi/test_wsgi.py index 2f887afa0f..5a15262673 100644 --- a/manila/tests/wsgi/test_wsgi.py +++ b/manila/tests/wsgi/test_wsgi.py @@ -22,10 +22,10 @@ from manila.wsgi import wsgi class WSGITestCase(test.TestCase): def test_initialize_application(self): - self.mock_object(wsgi.log, 'register_options') + self.mock_object(wsgi.logging, 'register_options') self.mock_object(wsgi.cfg.ConfigOpts, '__call__') self.mock_object(wsgi.config, 'verify_share_protocols') - self.mock_object(wsgi.log, 'setup') + self.mock_object(wsgi.logging, 'setup') self.mock_object(wsgi.rpc, 'init') self.mock_object(wsgi.wsgi, 'Loader') wsgi.sys.argv = ['--verbose', '--debug'] @@ -34,11 +34,11 @@ class WSGITestCase(test.TestCase): self.assertEqual( wsgi.wsgi.Loader.return_value.load_app.return_value, result) - wsgi.log.register_options.assert_called_once_with(mock.ANY) + wsgi.logging.register_options.assert_called_once_with(mock.ANY) wsgi.cfg.ConfigOpts.__call__.assert_called_once_with( mock.ANY, project="manila", version=wsgi.version.version_string()) wsgi.config.verify_share_protocols.assert_called_once_with() - wsgi.log.setup.assert_called_once_with(mock.ANY, "manila") + wsgi.logging.setup.assert_called_once_with(mock.ANY, "manila") wsgi.rpc.init.assert_called_once_with(mock.ANY) wsgi.wsgi.Loader.assert_called_once_with(mock.ANY) wsgi.wsgi.Loader.return_value.load_app.assert_called_once_with( diff --git a/manila/wsgi/wsgi.py b/manila/wsgi/wsgi.py index 4a9e37203d..f36957fa1a 100644 --- a/manila/wsgi/wsgi.py +++ b/manila/wsgi/wsgi.py @@ -16,7 +16,7 @@ import sys from oslo_config import cfg -from oslo_log import log +from oslo_log import log as logging from oslo_reports import guru_meditation_report as gmr from oslo_reports import opts as gmr_opts from oslo_service import wsgi @@ -28,17 +28,20 @@ from manila import service from manila import version CONF = cfg.CONF +LOG = logging.getLogger(__name__) def initialize_application(): - log.register_options(CONF) + logging.register_options(CONF) gmr_opts.set_defaults(CONF) CONF(sys.argv[1:], project="manila", version=version.version_string()) config.verify_share_protocols() config.set_lib_defaults() - log.setup(CONF, "manila") + logging.setup(CONF, "manila") + CONF.log_opt_values(LOG, logging.DEBUG) gmr.TextGuruMeditation.setup_autorun(version, conf=CONF) rpc.init(CONF) service.setup_profiler("manila-api", CONF.host) + return wsgi.Loader(CONF).load_app(name='osapi_share') diff --git a/releasenotes/notes/manila-wsgi-debug-log-opts-691a7647655b4778.yaml b/releasenotes/notes/manila-wsgi-debug-log-opts-691a7647655b4778.yaml new file mode 100644 index 0000000000..27c7a0d1d0 --- /dev/null +++ b/releasenotes/notes/manila-wsgi-debug-log-opts-691a7647655b4778.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Now the ``manila-wsgi`` WSGI application records all options and loaded + values to its log file, when debug log is enabled.