'Ensure that logs still emit under unexpected failure.
If we get an unexpected failure all the way up to the top, we should
still have a record of that request via the except block.'

@mock.patch('nova.api.openstack.compute.versions.Versions.index')
@mock.patch('nova.api.openstack.requestlog.RequestLog._should_emit')
def test_logs_under_exception(self, emit, v_index):

    emit.return_value = True
    v_index.side_effect = Exception('Unexpected    Error')
    self.useFixture(fixtures.OutputStreamCapture())
    log = fixtures.StandardLogging()
    self.useFixture(log)
    self.useFixture(conf_fixture.ConfFixture())
    self.useFixture(fixtures.RPCFixture('nova.test'))
    api = self.useFixture(fixtures.OSAPIFixture()).api
    api.api_request('/', strip_version=True)
    log1 = 'INFO    [nova.api.openstack.requestlog]    127.0.0.1    "GET    /"    status:    500    len:    0    microversion:    -    time:'
    self.assertIn(log1, log.logger.output)
