Logging help

Vinay Sajip vinay_sajip at yahoo.co.uk
Thu Jan 22 12:25:56 EST 2009


On Jan 22, 3:40 pm, koranthala <koranth... at gmail.com> wrote:
> Thank you very much Vinay. You have been extremely helpful.
> This was my first design - but then I found that log system was taking
> up quite a huge chunk of the memory.
> That is why I went to rotating file handler.

Using just plain FileHandler takes up less memory than using
RotatingFileHandler (because using the latter imports the "handlers"
module into memory, whereas using the former does not). I'm not aware
of any problem where logging takes up a huge chunk of memory (under
normal usage) - how did you measure the memory usage which was due to
logging?

> Anyways, now I have modified doRollover to append if file is there,
> so, for me it is working.
> What I was thinking was such an option in the basicloggingsystem
> might be of good help.

The solution I suggested is IMO better than using a patched
RotatiingFileHandler, both because it avoids importing an extra module
(if memory really is a concern) and because you don't need to change
your code across Python version updates. How does my suggestion to use
FileHandler not meet your use case?

> Again, Vinay, Thank you very much. You were extremely helpful.

You're welcome.

Best wishes,

Vinay Sajip



More information about the Python-list mailing list