← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1520536] [NEW] syslog logging is broken in neutron-server

 

Public bug reported:

When use_syslog = True, neutron server cannot start:

Traceback (most recent call last):
  File "/usr/bin/neutron-server", line 10, in <module>
    sys.exit(main_wsgi_eventlet())
  File "/usr/lib/python2.7/dist-packages/neutron/cmd/eventlet/server/__init__.py", line 19, in main_wsgi_eventlet
    wsgi_eventlet.main()
  File "/usr/lib/python2.7/dist-packages/neutron/server/wsgi_eventlet.py", line 51, in main
    server.boot_server(_eventlet_wsgi_server)
  File "/usr/lib/python2.7/dist-packages/neutron/server/__init__.py", line 35, in boot_server
    server_func()
  File "/usr/lib/python2.7/dist-packages/neutron/server/wsgi_eventlet.py", line 28, in _eventlet_wsgi_server
    neutron_api = service.serve_wsgi(service.NeutronApiService)
  File "/usr/lib/python2.7/dist-packages/neutron/service.py", line 106, in serve_wsgi
    LOG.exception(_LE('Unrecoverable error: please check log '
  File "/usr/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 195, in __exit__
    six.reraise(self.type_, self.value, self.tb)
  File "/usr/lib/python2.7/dist-packages/neutron/service.py", line 102, in serve_wsgi
    service = cls.create()
  File "/usr/lib/python2.7/dist-packages/neutron/service.py", line 94, in create
    config.setup_logging()
  File "/usr/lib/python2.7/dist-packages/neutron/common/config.py", line 214, in setup_logging
    logging.setup(cfg.CONF, product_name)
  File "/usr/lib/python2.7/dist-packages/oslo_log/log.py", line 245, in setup
    _setup_logging_from_conf(conf, product_name, version)
  File "/usr/lib/python2.7/dist-packages/oslo_log/log.py", line 337, in _setup_logging_from_conf
    facility = _find_facility(conf.syslog_log_facility)
  File "/usr/lib/python2.7/dist-packages/oslo_log/log.py", line 301, in _find_facility
    for fac in valid_facilities))x

Seems the problem is that in oslo_log/log.py, functon _setup_logging_from_conf, 
           syslog = handlers.OSSysLogHandler(
            facility=facility,
            use_syslog_rfc_format=conf.use_syslog_rfc_format)

overwrites the global syslog object, and if this function called twice,
then all functions which expects the original syslog object, fails.

So I think:
- neutron should not initialize logging twice
- oslo_log should not overwrite the global syslog object

** Affects: neutron
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1520536

Title:
  syslog logging is broken in neutron-server

Status in neutron:
  New

Bug description:
  When use_syslog = True, neutron server cannot start:

  Traceback (most recent call last):
    File "/usr/bin/neutron-server", line 10, in <module>
      sys.exit(main_wsgi_eventlet())
    File "/usr/lib/python2.7/dist-packages/neutron/cmd/eventlet/server/__init__.py", line 19, in main_wsgi_eventlet
      wsgi_eventlet.main()
    File "/usr/lib/python2.7/dist-packages/neutron/server/wsgi_eventlet.py", line 51, in main
      server.boot_server(_eventlet_wsgi_server)
    File "/usr/lib/python2.7/dist-packages/neutron/server/__init__.py", line 35, in boot_server
      server_func()
    File "/usr/lib/python2.7/dist-packages/neutron/server/wsgi_eventlet.py", line 28, in _eventlet_wsgi_server
      neutron_api = service.serve_wsgi(service.NeutronApiService)
    File "/usr/lib/python2.7/dist-packages/neutron/service.py", line 106, in serve_wsgi
      LOG.exception(_LE('Unrecoverable error: please check log '
    File "/usr/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 195, in __exit__
      six.reraise(self.type_, self.value, self.tb)
    File "/usr/lib/python2.7/dist-packages/neutron/service.py", line 102, in serve_wsgi
      service = cls.create()
    File "/usr/lib/python2.7/dist-packages/neutron/service.py", line 94, in create
      config.setup_logging()
    File "/usr/lib/python2.7/dist-packages/neutron/common/config.py", line 214, in setup_logging
      logging.setup(cfg.CONF, product_name)
    File "/usr/lib/python2.7/dist-packages/oslo_log/log.py", line 245, in setup
      _setup_logging_from_conf(conf, product_name, version)
    File "/usr/lib/python2.7/dist-packages/oslo_log/log.py", line 337, in _setup_logging_from_conf
      facility = _find_facility(conf.syslog_log_facility)
    File "/usr/lib/python2.7/dist-packages/oslo_log/log.py", line 301, in _find_facility
      for fac in valid_facilities))x

  Seems the problem is that in oslo_log/log.py, functon _setup_logging_from_conf, 
             syslog = handlers.OSSysLogHandler(
              facility=facility,
              use_syslog_rfc_format=conf.use_syslog_rfc_format)

  overwrites the global syslog object, and if this function called
  twice, then all functions which expects the original syslog object,
  fails.

  So I think:
  - neutron should not initialize logging twice
  - oslo_log should not overwrite the global syslog object

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1520536/+subscriptions


Follow ups