diff --git a/ansible_collections/arista/cvp/plugins/module_utils/cv_api2019.py b/ansible_collections/arista/cvp/plugins/module_utils/cv_api2019.py index e5d9a3997..4047a25ce 100644 --- a/ansible_collections/arista/cvp/plugins/module_utils/cv_api2019.py +++ b/ansible_collections/arista/cvp/plugins/module_utils/cv_api2019.py @@ -895,7 +895,7 @@ def get_container_by_name(self, name): container (dict): Container info in dictionary format or None ''' self.log.debug('Get info for container %s' % name) - logging.debug( + self.log.debug( '* cv_api2019 - get_container_by_name - container name is: %s', str(name)) containers = self.clnt.get('/provisioning/searchTopology.do?queryParam=%s' '&startIndex=0&endIndex=0' % qplus(name)) diff --git a/ansible_collections/arista/cvp/plugins/module_utils/cv_client.py b/ansible_collections/arista/cvp/plugins/module_utils/cv_client.py index 69e928d4b..889e34e72 100644 --- a/ansible_collections/arista/cvp/plugins/module_utils/cv_client.py +++ b/ansible_collections/arista/cvp/plugins/module_utils/cv_client.py @@ -89,6 +89,7 @@ import inspect import traceback from logging.handlers import SysLogHandler +import ansible_collections.arista.cvp.plugins.module_utils.logger from itertools import cycle from ansible_collections.arista.cvp.plugins.module_utils.cv_client_errors import CvpApiError, CvpLoginError, CvpRequestError, CvpSessionLogOutError REQUESTS_IMP_ERR = None @@ -144,8 +145,8 @@ def __init__(self, logger='cv_apiClient', syslog=False, filename=None, self.headers = {'Accept': 'application/json', 'Content-Type': 'application/json'} - self.log = logging.getLogger(logger) - self.set_log_level(log_level) + self.log = logging.getLogger('arista.cvp.cv_client') + self.log.info('Start cv_client API execution') if syslog: # Enables sending logging messages to the local syslog server. self.log.addHandler(SysLogHandler()) @@ -278,6 +279,7 @@ def connect(self, nodes, username, password, connect_timeout=10, self._create_session(all_nodes=True) # Verify that we can connect to at least one node if not self.session: + self.log.error(' error connecting cvp: %s', str(self.error_msg)) raise CvpLoginError(self.error_msg) else: # Instantiate the CvpApi class