operating system services again using the same filename these changes might occur if log file has been deleted or moved as result of log rotation operation carried out externally to the running program this handler only works on unix systems handler configuration each handler object can be configured with its own level and filtering the following methods are used to do thish setlevel(levelsets the threshold of messages to be handled level is numeric code such as error or critical addfilter(filtadds filter objectfiltto the handler see the addfilter(method of logger objects for more information removefilter(filtremoves filter objectfiltfrom the handler it is important to stress that levels and filters can be set on handlers independently from any settings used on the logger objects to which handlers are attached here is an example that illustrates thisimport logging import sys create handler that prints critical level messages to stderr crit_hand logging streamhandler(sys stderrcrit_hand setlevel(logging criticalcreate top-level logger called 'appapp_log logging getlogger("app"app_log setlevel(logging infoapp_log addhandler(logging filehandler('app log')app_log addhandler(crit_handlerin this examplethere is single logger called 'appwith level of info two handlers are attached to itbut one of the handlers (crit_handlerhas its own level setting of critical although this handler will receive log messages with level of info or higherit selectively discards those that are not critical handler cleanup the following methods are used on handlers to perform cleanup flush(flushes all logging output close(closes the handler message formatting by defaulthandler objects emit log messages exactly as they are formatted in logging calls howeversometimes you want to add additional contextual information to the messages such as timestampsfilenamesline numbersand so forth this section lib fl ff