taz taz - 1 year ago 82
Python Question

Log disabling in python

I am new to this logging module.

logging.disable = True

As per my understanding this should disable debug logs. But when it is executed it prints debug logs also.

I have only debug logs to print. I dont have critical or info logs. So how i can disable this debug logs.

Answer Source

logging.disable is method, not a configurable attribute.

You can disable logging with :


To disable all, call:


This will disable all logs of level DEBUG and below.

To enable all logging, do logging.disable(logging.NOTSET) as it is the lowest level.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download