Tony Cappellini wrote: > > > I want to purge (empty) or delete the logfile created by the logging > module, and reopen it for a new session. > > There is reference to a close function in the 2.3 docs, but I don't see > how I can purge or delete the file, since I don't have access to the > file descriptor. > > *close*( ) > > Tidy up any resources used by the handler. This version does nothing > and is intended to be implemented by subclasses. > > How can I purge/delete & reopen the logfile?
FileHandler has a close() method that presumably does something useful. So I guess you have to get ahold of the FileHandler. One way to do that would be to configure the logging in code instead of in a config file or basicConfig(). There is an example of doing this with a SocketHandler here: http://docs.python.org/lib/network-logging.html The code to set up a FileHandler would be very similar. Kent _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
