Turning off logging in Paramiko

前端 未结 3 744
广开言路
广开言路 2021-02-05 07:38

I am using the ssh client provided by Paramiko to create a function call remoteSSH (the file name is remoteConnect.py):

import paramiko         


        
3条回答
  •  盖世英雄少女心
    2021-02-05 08:05

    Paramiko names its logggers. It seems to function as the logging modules in other languages (JDK logging comes to mind) do.

    I've found that

    logging.getLogger("paramiko").setLevel(logging.WARNING) helps.

    (You can put this inside the module that's importing paramiko - just make sure the 'logging' module is enabled as well).

    It took me a while to figure out how to do this (in fact, it wasn't until I actually started dealing with Java logging that this answer came to mind)

提交回复
热议问题