diff --git a/uaclient/actions.py b/uaclient/actions.py index 4270542551..2abab28a1d 100644 --- a/uaclient/actions.py +++ b/uaclient/actions.py @@ -65,7 +65,7 @@ def attach_with_token( ) except exceptions.UrlError as e: with util.disable_log_to_console(): - logging.exception(str(e)) + LOG.exception(str(e)) raise exceptions.ConnectivityError() cfg.machine_token_file.write(new_machine_token) diff --git a/uaclient/entitlements/base.py b/uaclient/entitlements/base.py index 32eb629b00..57d395098e 100644 --- a/uaclient/entitlements/base.py +++ b/uaclient/entitlements/base.py @@ -555,7 +555,7 @@ def handle_required_packages(self) -> bool: package_names = [package["name"] for package in required_packages] msg = messages.INSTALLING_PACKAGES.format(" ".join(package_names)) - logging.debug(msg) + LOG.debug(msg) event.info(msg) apt.run_apt_install_command(package_names) @@ -581,7 +581,7 @@ def handle_removing_required_packages(self) -> bool: ] package_names_str = " ".join(package_names) msg = messages.UNINSTALLING_PACKAGES.format(package_names_str) - logging.debug(msg) + LOG.debug(msg) event.info(msg) apt.remove_packages( package_names, diff --git a/uaclient/entitlements/landscape.py b/uaclient/entitlements/landscape.py index e09c9f52c5..e3680f6556 100644 --- a/uaclient/entitlements/landscape.py +++ b/uaclient/entitlements/landscape.py @@ -6,6 +6,7 @@ from uaclient.entitlements.base import UAEntitlement from uaclient.entitlements.entitlement_status import ApplicationStatus +LOG = logging.getLogger(util.replace_top_level_logger_name(__name__)) event = event_logger.get_event_logger() LANDSCAPE_CLIENT_PACKAGE_NAME = "landscape-client" @@ -26,7 +27,7 @@ def _perform_enable(self, silent: bool = False) -> bool: if self.assume_yes and "--silent" not in cmd: cmd += ["--silent"] - logging.debug(messages.EXECUTING_COMMAND.format(" ".join(cmd))) + LOG.debug(messages.EXECUTING_COMMAND.format(" ".join(cmd))) event.info( util.redact_sensitive_logs( messages.EXECUTING_COMMAND.format(" ".join(cmd)) @@ -65,7 +66,7 @@ def _perform_disable(self, silent: bool = False) -> bool: system.subp(cmd) except exceptions.ProcessExecutionError as e: with util.disable_log_to_console(): - logging.error(e) + LOG.error(e) event.info(str(e).strip()) event.warning(str(e), self.name) @@ -73,7 +74,7 @@ def _perform_disable(self, silent: bool = False) -> bool: original=LANDSCAPE_CLIENT_CONFIG_PATH, backup=LANDSCAPE_CLIENT_CONFIG_PATH_DISABLE_BACKUP, ) - logging.debug(msg) + LOG.debug(msg) event.info(msg) try: os.rename( @@ -82,7 +83,7 @@ def _perform_disable(self, silent: bool = False) -> bool: ) except FileNotFoundError as e: with util.disable_log_to_console(): - logging.error(e) + LOG.error(e) event.info(str(e)) event.warning(str(e), self.name)