1

In python, the RotatingFileHandler keeps on changing file extensions every time a rotation takes place.

I would really like filenames / filename extensions to be fixed instead - after creation then never change.

Example of how it would work:

Time 0:

  • Log file is created with application_name.20210301_130601
  • Application logs to application_name.20210301_130601

Time 1:

  • application_name.20210301_130601 reaches 5MB in size
  • Existing application_name.20210301_130601 log is closed.
  • New log file is created with application_name.20210301_140803
  • Application logs to application_name.20210301_140803 NOTE: NO RENAMING OF EXISTING LOGS HAS TAKEN PLACE

Time 2:

  • Same as time 1

Time 3-9:

  • Same as time 1

Time 10:

  • Total size of logs is 50MB
  • First log application_name.20210301_130601 is deleted

How can I achieve this? Is the only way to override doRollover ?

lucid_dreamer
  • 362
  • 4
  • 9

0 Answers0