handlers rotatingfilehandler(filename [mode [maxbytes [backupcount [encoding [delay]]]]]writes log messages to the file filename howeverif the file exceeds the size specified by maxbytesthe file is rotated to filename and new log filefilenameis opened backupcount specifies the maximum number of backup files to create by defaultthe value of backupcount is howeverwhen specifiedbackup files are rotated through the sequence filename filename ,filename nwhere filename is always the most recent backup and filename is always the oldest backup mode specifies the file mode to use when opening the log file the default mode is 'aif maxbytes is (the default)the log file is never rolled over and is allowed to grow indefinitely encoding and delay have the same meaning as with filehandler handlers smtphandler(mailhostfromaddrtoaddrssubject [credentials]sends log messages to remote host using email mailhost is the address of an smtp server that can receive the message the address can be simple host name specified as string or tuple (hostportfromaddr is the from addresstoaddrs is the destination addressand subject is the subject to use in the message credentials is tuple (usernamepasswordwith the username and password handlers sockethandler(hostportsends log messages to remote host using tcp socket connection host and port specify the destination messages are sent in the same format as described for datagramhandler unlike datagramhandlerthis handler reliably delivers log messages streamhandler([fileobj]writes log messages to an already open file-like objectfileobj if no argument is providedmessages are written to sys stderr handlers sysloghandler([address [facility]]sends log messages to unix system logging daemon address specifies the destination as (hostporttuple if omitteda destination of ('localhost' is used facility is an integer facility code and is set to sysloghandler log_user by default full list of facility codes can be found in the definition of sysloghandler handlers timedrotatingfilehandler(filename [when [interval [backupcount [encoding [delay [utc]]]]]]the same as rotatingfilehandlerbut the rotation of files is controlled by time instead of file size interval is numberand when is string that specifies units possible values for when are ' (seconds)' (minutes)' (hours)' (days)' (weeks)and 'midnight(roll over at midnightfor examplesetting interval to and when to 'drolls the log every three days backupcount specifies the maximum number of backup files to keep utc is boolean flag that determines whether or not to use local time (the defaultor utc time handlers watchedfilehandler(filename [mode [encoding [delay]]]the same as filehandlerbut the inode and device of the opened log file is monitored if it changes since the last log message was issuedthe file is closed and reopened lib fl ff