Vinay Sajip <vinay_sa...@yahoo.co.uk> added the comment:

> Well, there is nothing in the documentation that would say the logrotation 
> can be only performed by continously running scripts, thats why. :)

Well, what's the need to rotate based on time when you just run scripts 
sporadically or they're very short-lived? Not trying to argue, just trying to 
understand.

> There are scripts or even daemons written in Python that need to be restarted 
> from time to time. If the logrotate period is greater than restart period the 
> log files will never be rotated, however they could be.

Yes, but generally daemons are long-lived relative to the rotation interval, 
aren't they? "From time to time" certainly implies that to me.

> What is the logic behind checking the MTIME instead of CTIME when one is 
> calculating the age of a file when tries to calculate whether it has to be 
> rotated or not?

I can't remember, that code is over 12 years old and that specific decision 
wasn't documented :-(

> From the code I have to assume that the original author also tried to prepare 
> for the cases where the execution is interrupted and/or restarted and (s)he 
> wanted the TimedLogrotateHandler to be resumed where it was during the 
> previous execution. Dnn't you agree?

I take it you mean TimedRotatingFileHandler. Certainly it assumes that the 
script might be restarted, which is why it opens the file in append mode.

If the computation using MTIME were changed to use CTIME, that would be a 
behaviour change, which could conceivably break someone's code that relied on 
current behaviour (unlikely, but you just never know). I've no other objection 
to using CTIME rather than MTIME - perhaps I'm just being hyper-cautious about 
breakage?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40469>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to