handlers create formatter for the console handler console_formatter logging formatter('%(asctime) %(funcname) %(message) 'console_handler setformatter(console_formatteradd the handlers to logger logger addhandler(console_handlerlogger addhandler(file_handler'applicationcode def do_something()logger debug('debug message'logger info('info message'logger warning('warn message'logger error('error message'logger critical('critical message'logger info('starting'do_something(logger info('done'the output from this program is now split between the log file and the console outas shown below filters filters can be used by handlers to provide finer grained control of the log output filter can be added to logger using the logger addfilter(method filter can be created by extending the logging filter class and