1
TimedRotatingFileHandler(filename, when='W', interval=0, backupCount=0)

Produces:

ValueError: Unable to configure handler 'fichierSemaineStandard': You must specify a day for weekly rollover from 0 to 6 (0 is Monday): W

But the python documentation tells

value: 'W', type of interval: Week day (0=Monday)

So what's wrong?

4

1 回答 1

4

It seems that this section of documentation is not clear about this. After having a peek in the code, to make the week rotation work, the 'W' argument is not sufficient. The weekday number must be placed just after the letter W:

TimedRotatingFileHandler(filename, when='W0', backupCount=0)

Note that the "interval" argument is useless.

于 2013-01-13T15:33:57.053 回答