]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Avoid printing log options multiple times
authorSalvatore Orlando <salv.orlando@gmail.com>
Fri, 24 Jul 2015 12:21:43 +0000 (05:21 -0700)
committerSalvatore Orlando <salv.orlando@gmail.com>
Fri, 24 Jul 2015 12:26:58 +0000 (05:26 -0700)
This patch ensures log_opt_values is invoked only once, thus
avoiding annoying multiple dumps of options values.

Note that is rpc_workers is greater than 0 a second dump will
be logged. This patch does not address this as REST and RPC
servers are going to be separated as a part of the feature/pecan
work.

Closes-Bug: #1477975

Change-Id: Ia5dcb609241de6ad30d9831c5fb98a9e2be6ad7f

neutron/service.py
neutron/wsgi.py

index ee8432dea50db129b6e039e1f30f152a3e16446d..4cec3357078159930ff469f2baeed304ce23387a 100644 (file)
@@ -14,7 +14,6 @@
 #    under the License.
 
 import inspect
-import logging as std_logging
 import os
 import random
 
@@ -92,8 +91,6 @@ class NeutronApiService(WsgiService):
         # Log the options used when starting if we're in debug mode...
 
         config.setup_logging()
-        # Dump the initial option values
-        cfg.CONF.log_opt_values(LOG, std_logging.DEBUG)
         service = cls(app_name)
         return service
 
@@ -186,8 +183,6 @@ def _run_wsgi(app_name):
     server = wsgi.Server("Neutron")
     server.start(app, cfg.CONF.bind_port, cfg.CONF.bind_host,
                  workers=_get_api_workers())
-    # Dump all option values here after all options are parsed
-    cfg.CONF.log_opt_values(LOG, std_logging.DEBUG)
     LOG.info(_LI("Neutron service started, listening on %(host)s:%(port)s"),
              {'host': cfg.CONF.bind_host, 'port': cfg.CONF.bind_port})
     return server
index a207c35d24f38128be5dbadd13b82aaa82c6de99..dd71a9b907cc726cccd36f00e2bc242eba0d7270 100644 (file)
@@ -19,6 +19,7 @@ Utility methods for working with WSGI servers
 from __future__ import print_function
 
 import errno
+import logging as std_logging
 import os
 import socket
 import ssl
@@ -238,6 +239,8 @@ class Server(object):
         if workers < 1:
             # The API service should run in the current process.
             self._server = service
+            # Dump the initial option values
+            cfg.CONF.log_opt_values(LOG, std_logging.DEBUG)
             service.start()
             systemd.notify_once()
         else: