From 5994499f4cb754ee746f39f3b3f646f1853d18a9 Mon Sep 17 00:00:00 2001 From: Peter Rowlands Date: Mon, 27 Apr 2020 12:59:58 +0900 Subject: [PATCH] use SSHClient.set_log_channel --- dvc/remote/ssh/connection.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/dvc/remote/ssh/connection.py b/dvc/remote/ssh/connection.py index 07b4bc2530..5a5669c351 100644 --- a/dvc/remote/ssh/connection.py +++ b/dvc/remote/ssh/connection.py @@ -9,8 +9,6 @@ try: import paramiko - - logging.getLogger("paramiko.transport").disabled = True except ImportError: paramiko = None @@ -43,6 +41,14 @@ def __init__(self, host, *args, **kwargs): self.timeout = kwargs.get("timeout", 1800) self._ssh = paramiko.SSHClient() + + # Explicitly disable paramiko logger. Due to how paramiko dynamically + # loads loggers, it is not disabled by DVC disable_other_loggers(). + # See https://github.com/iterative/dvc/issues/3482 + self._ssh.set_log_channel("dvc.paramiko") + logging.getLogger("dvc.paramiko").disabled = True + logging.getLogger("dvc.paramiko.sftp").disabled = True + self._ssh.load_system_host_keys() self._ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())