logging in python in addition there are several methods that are used to manage handlers and filtersaddfilter(filterthis method adds the specified filter filter to this logger removefilter(filterthe specified filter is removed from this logger object addhandler(handlerthe specified handler is added to this logger removehandler(handlerremoves the specified handler from this logger default logger default (or rootlogger is always available from the logging framework this logger can be accessed via the functions defined in the logging module these functions allow messages to be logged at different levels using methods such as info()error()warning(but without the need to obtain reference to logger object first for exampleimport logging set the root logger level logging basicconfig(level=logging debuguse root (defaultlogger logging debug('this is to help with debugging'logging info('this is just for information'logging warning('this is warning!'logging error('this should be used with something unexpectedlogging critical('something serious'this example sets the logging level for the root or default logger to debug (the default is warningit then uses the default logger to generate range of log messages at different levels (from debug up to criticalthe output from this program is given belowdebug:root:this is to help with debugging info:root:this is just for information warning:root:this is warningerror:root:this should be used with something unexpected critical:root:something serious note that the format used by default with the root logger prints the log levelthe name of the logger generating the output and the message from this you can see that it is the root longer that is generating the output