Remove initialization of logger if logger is None

If default_log_level=keystoneauth=WARN is enabled in nova.conf,
then these log messages [1][2][3] are logged using cinderclient.v3.client
logger name instead of keystoneauth.session. This is because cinderclient
initializes logger if not passed by nova and since debug=True is set in
nova.conf it’s uses root logger log level.

This patch removes initialization of logger code to ensure log
messages[1][2][3] are logged only when keystoneauth=DEBUG is enabled
in nova.conf. This will also enable us to consume split_logger config
option [4] when enabled in nova without making any additional changes
in client code.

[1] REQ: https://review.openstack.org/#/c/505764/8/keystoneauth1/session.py@391
[2] RESP: https://review.openstack.org/#/c/505764/8/keystoneauth1/session.py@422
[3] RESP BODY: https://review.openstack.org/#/c/505764/8/keystoneauth1/session.py@454
[4] https://review.openstack.org/#/c/568878/

Change-Id: I937c6ac2f6e254c438ee2f36eb6c291f62c0f411
This commit is contained in:
Neha Alhat
2018-06-06 15:14:23 +05:30
parent 35b99baf6e
commit ebb3b675ad

View File

@@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import logging
from cinderclient import api_versions
from cinderclient import client
from cinderclient.v3 import attachments
@@ -112,9 +110,6 @@ class Client(object):
setattr(self, extension.name,
extension.manager_class(self))
if not logger:
logger = logging.getLogger(__name__)
self.client = client._construct_http_client(
username=username,
password=password,