python how to disable multiple imported module logging

744 Views Asked by At

i have imported 2 modules paramiko and pyftpdlib in my python code.

i am able to suppress paramiko SSH logging to console by using the following line.

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

i then tried to disable console outputs from pyftpdlib by placing this line in my function code for starting my ftp server for pyftpdlib

logging.basicConfig(level=logging.WARNING)

when i do this it caused paramiko log suppression to stop working and see info messages printed to console from paramiko.

i'm trying to figure how to disable BOTH from logging to console?

1

There are 1 best solutions below

0
john johnson On

i figured it, i had to, import config_logging form pyftpdlib

import logging
from pyftpdlib.log import config_logging
config_logging(level=logging.ERROR)