import logging logging basicconfig(level=logging infologging debug('this message will be ignored'this will not print logging info('this should be logged'it'll print logging warning('and thistoo'it'll print above we are logging messages on severity level first we import the modulecall basicconfig and set the logging level level we set above is info then we have three different statementdebug statementinfo statement and warning statement output of logging py info:root:this should be logged warning:root:and thistoo as the info statement is below debug statementwe are not able to see the debug message to get the debug statement too in the output terminalall we need to change is the basicconfig level logging basicconfig(level=logging debugand in the output we can seedebug:root:this message will be ignored info:root:this should be logged warning:root:and thistoo also the default behavior means if we don' set any logging level is warning just comment out the second line from the above program and run the code #logging basicconfig(level=logging debugoutput warning:root:and thistoo python built in logging level are actually integers import logging logging debug logging critical