Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
531 views
in Technique[技术] by (71.8m points)

python - No handlers could be found for logger paramiko

I am using paramiko module for ssh connection.I am facing below problem:

No handlers could be found for logger I am not getting the reason of this problem.I tried to get solution from below link but not able to get reason. No handlers could be found for logger "paramiko.transport"

I am using below code:

           1.ssh = paramiko.SSHClient()
       2.ssh.set_missing_host_key_policy(
       3.paramiko.AutoAddPolicy())

       4.ssh.connect(serverip, username=username, 
       5.password=password,timeout=None)
       6.transport = ssh.get_transport()
       7.transport.set_keepalive(30)

       8.stdin, stdout, stderr =ssh.exec_command(cmd)
       9.tables=stdout.readlines()
       10.ssh.close()

I think i am getting this problem at line no 8.Please advice how can i solve this.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I found the solution from this website.

Basically, you just need to add a line:

paramiko.util.log_to_file("filename.log")

Then all connection will be logged to the file.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...