Skip to content

Commit 5994499

Browse files
committed
use SSHClient.set_log_channel
1 parent f7489f3 commit 5994499

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

dvc/remote/ssh/connection.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99

1010
try:
1111
import paramiko
12-
13-
logging.getLogger("paramiko.transport").disabled = True
1412
except ImportError:
1513
paramiko = None
1614

@@ -43,6 +41,14 @@ def __init__(self, host, *args, **kwargs):
4341
self.timeout = kwargs.get("timeout", 1800)
4442

4543
self._ssh = paramiko.SSHClient()
44+
45+
# Explicitly disable paramiko logger. Due to how paramiko dynamically
46+
# loads loggers, it is not disabled by DVC disable_other_loggers().
47+
# See https://github.com/iterative/dvc/issues/3482
48+
self._ssh.set_log_channel("dvc.paramiko")
49+
logging.getLogger("dvc.paramiko").disabled = True
50+
logging.getLogger("dvc.paramiko.sftp").disabled = True
51+
4652
self._ssh.load_system_host_keys()
4753
self._ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
4854

0 commit comments

Comments
 (0)