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.