@@ -234,6 +234,19 @@ need to override.
234234 return the same output every time for a given input, otherwise the
235235 rollover behaviour may not work as expected.
236236
237+ It's also worth noting that care should be taken when using a namer to
238+ preserve certain attributes in the filename which are used during rotation.
239+ For example, :class: `RotatingFileHandler ` expects to have a set of log files
240+ whose names contain successive integers, so that rotation works as expected,
241+ and :class: `TimedRotatingFileHandler ` deletes old log files (based on the
242+ ``backupCount `` parameter passed to the handler's initializer) by determining
243+ the oldest files to delete. For this to happen, the filenames should be
244+ sortable using the date/time portion of the filename, and a namer needs to
245+ respect this. (If a namer is wanted that doesn't respect this scheme, it will
246+ need to be used in a subclass of :class: `TimedRotatingFileHandler ` which
247+ overrides the :meth: `~TimedRotatingFileHandler.getFilesToDelete ` method to
248+ fit in with the custom naming scheme.)
249+
237250 .. versionadded :: 3.3
238251
239252
@@ -443,6 +456,10 @@ timed intervals.
443456
444457 Outputs the record to the file, catering for rollover as described above.
445458
459+ .. method :: getFilesToDelete()
460+
461+ Returns a list of filenames which should be deleted as part of rollover. These
462+ are the absolute paths of the oldest backup log files written by the handler.
446463
447464.. _socket-handler :
448465
0 commit comments