How to use paramiko logging?

匿名 (未验证) 提交于 2019-12-03 02:53:02

问题:

I'm using 'paramiko' in python to run command on a box through SSH. How to use paramiko logging? I mean force it to make logs (in a file or terminal) and set the log level.

回答1:

paramiko names its loggers, so simply:

import logging import paramiko  logging.getLogger("paramiko").setLevel(logging.WARNING) # for example 

See the logging cookbook for some more examples.

You can also use log_to_file from paramiko.util to log directly to a file.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!