Kent Johnson wrote: > Hans Fangohr wrote: > >> (i) is this (as in the log.conf file) the right use of the logging >> module to achieve what I need? > > I think you understand the module correctly. > >> (ii) in particular, it appears we have two filehandlers that write to >> the same file (in mode 'a+'). While this seems to work fine in the >> examples I have tested, I'd like some independent advice on whether >> this is 'legal' (or whether it works by chance). > > I don't know the answer, but it has nothing to do with the logging > module. The question is, can the same file reliably be opened twice for > writing in the same module. > > Another option: If you configure logging in code, you could create two > StreamHandlers that log to the same file - open the file yourself and > pass it to both handlers. If you do this you will have to close the file > yourself somehow. > > Kent >
Well, the question would actually be if the logging module is smart enough to find out that both your filehandlers are referring to the same file and open it only once. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor