: : , error an error has occurred logging critical('the program is unable to recover!' : : , critical the program is unable to recoverthe benefit of logging levels is that you can change what priority of logging message you want to see passing logging debug to the basicconfig(function' level keyword argument will show messages from all the logging levels (debug being the lowest levelbut after developing your program some moreyou may be interested only in errors in that caseyou can set basicconfig()' level argument to logging error this will show only error and critical messages and skip the debuginfoand warning messages disabling logging after you've debugged your programyou probably don' want all these log messages cluttering the screen the logging disable(function disables these so that you don' have to go into your program and remove all the logging calls by hand you simply pass logging disable( logging leveland it will suppress all log messages at that level or lower so if you want to disable logging entirelyjust add logging disable(logging criticalto your program for exampleenter the following into the interactive shellimport logging logging basicconfig(level=logging infoformat=%(asctime) %(levelname) %(message) 'logging critical('critical errorcritical error!' : : , critical critical errorcritical errorlogging disable(logging criticallogging critical('critical errorcritical error!'logging error('errorerror!'since logging disable(will disable all messages after ityou will probably want to add it near the import logging line of code in your program this wayyou can easily find it to comment out or uncomment that call to enable or disable logging messages as needed logging to file instead of displaying the log messages to the screenyou can write them to text file the logging basicconfig(function takes filename keyword argumentlike soimport logging logging basicconfig(filename='myprogramlog txt'level=logging debugformat=%(asctime) %(levelname) %(message) 'the log messages will be saved to myprogramlog txt while logging messages are helpfulthey can clutter your screen and make it hard to read debugging