Reputation: 47
I am new to this logging module.
logging.basicConfig(level=logging.DEBUG)
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.
Upvotes: 0
Views: 1202
Reputation: 386
You can change to level=logging.CRITICAL
and receive only critical logs
Upvotes: 0
Reputation: 43235
logging.disable is method, not a configurable attribute.
You can disable logging with :
https://docs.python.org/2/library/logging.html#logging.disable
To disable all, call:
logging.disable(logging.DEBUG)
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.
Upvotes: 2
Reputation: 1
the level
argument in logging.basicConfig
you've set to logging.DEBUG
is the lowest level of logging which will be displayed.
the order of logging levels is documented here.
if you don't want to display DEBUG, you can either set logging.basicConfig(level=logging.INFO)
, or specify levels to be disabled via logging.disable(logging.DEBUG)
Upvotes: 0