Use self.ks_logger instead of ks_logger
Currently with '--debug' option any cinder command only logs the request from keystoneauth and not the main cinder service request. Added keystoneauth logger to self.ks_logger so that logs can be logged as expected. Closes-Bug: #1606814 Change-Id: I7193aa6f43cb3186c49fc409b6e1ce7a36f596f9
This commit is contained in:
		| @@ -469,8 +469,8 @@ class OpenStackCinderShell(object): | ||||
|         if hasattr(requests, 'logging'): | ||||
|             requests.logging.getLogger(requests.__name__).addHandler(ch) | ||||
|  | ||||
|         ks_logger = logging.getLogger("keystoneauth") | ||||
|         ks_logger.setLevel(logging.DEBUG) | ||||
|         self.ks_logger = logging.getLogger("keystoneauth") | ||||
|         self.ks_logger.setLevel(logging.DEBUG) | ||||
|  | ||||
|     def _delimit_metadata_args(self, argv): | ||||
|         """This function adds -- separator at the appropriate spot | ||||
|   | ||||
| @@ -228,6 +228,17 @@ class ShellTest(utils.TestCase): | ||||
|  | ||||
|         self.assertEqual(False, _shell.cs.client.verify_cert) | ||||
|  | ||||
|     @mock.patch.object(cinderclient.client.SessionClient, 'authenticate', | ||||
|                        side_effect=exceptions.Unauthorized('No')) | ||||
|     def test_session_client_debug_logger(self, mock_session): | ||||
|         _shell = shell.OpenStackCinderShell() | ||||
|         # This "fails" but instantiates the client. | ||||
|         self.assertRaises(exceptions.CommandError, _shell.main, | ||||
|                           ['--debug', 'list']) | ||||
|         # In case of SessionClient when --debug switch is specified | ||||
|         # 'keystoneauth' logger should be initialized. | ||||
|         self.assertEqual('keystoneauth', _shell.cs.client.logger.name) | ||||
|  | ||||
|     @mock.patch('keystoneauth1.session.Session.__init__', | ||||
|                 side_effect=RuntimeError()) | ||||
|     def test_http_client_with_cert(self, mock_session): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 dineshbhor
					dineshbhor