handle a log file.

Peter L Hansen peter at engcorp.com
Thu Oct 7 07:04:00 EDT 2004


Zunbeltz Izaola wrote:
> I've a GUI program (wxPython) that comunicates with a machine with UDP
> sockets. Every sended socket is writted to file for inspection if
> there is problem. What ocurs is that sometimes the file grows to much
> (32Mb) and the program has problems to manage it. Is any way to
> control the size of the file?

Use the standard logging module.  It provides the capability for
an automatically "rotating" log file which will handle rolling
over and deleting/renaming the previous file automatically.

You may need to write your own formatter, depending on the
nature of your log entries...
-Peter



More information about the Python-list mailing list