Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #31975 > unrolled thread

Re: Getting a TimedRotatingFileHandler not to put two dates in the same file?

Started byDave Angel <d@davea.name>
First post2012-10-23 19:46 -0400
Last post2012-10-23 19:46 -0400
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Getting a TimedRotatingFileHandler not to put two dates in the same file? Dave Angel <d@davea.name> - 2012-10-23 19:46 -0400

#31975 — Re: Getting a TimedRotatingFileHandler not to put two dates in the same file?

FromDave Angel <d@davea.name>
Date2012-10-23 19:46 -0400
SubjectRe: Getting a TimedRotatingFileHandler not to put two dates in the same file?
Message-ID<mailman.2703.1351036027.27098.python-list@python.org>
On 10/23/2012 11:23 AM, David M Chess wrote:
> We have a TimedRotatingFileHandler with when='midnight'

You give us no clue what's in this class, or how it comes up with the
filenames used.

> . 
>
> This works great, splitting the log information across files by date, as 
> long as the process is actually up at midnight.
>
> But now the users have noticed that if the process isn't up at midnight, 
> they can end up with lines from two (or I guess potentially more) dates in 
> the same log file.
>
> Is there some way to fix this, either with cleverer arguments into the 
> TimedRotatingFileHandler, or by some plausible subclassing of it or its 
> superclass?

Why not use the date itself to derive the filename?  And check whether
the date has changed since the last update, and if so, close and
reopen.  Midnight is irrelevant.

> Or am I misinterpreting the symptoms somehow?
>
> Tx much!
> DC
>
>

-- 

DaveA

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web