Lets say I create a rotating file logger with python using RotatingFileHandler. I set number of files to 10, and each file size to 1 MB. My question is related to how the rotation happens. Is it that the rotation happens by keeping all the 10 files open and ensuring the contents of each file is modified as and when a line gets added to the latest file? If that is so, then there should be at least 10 file descriptors that are always open.
Say each file has 100 KB chunk rows, so each has just 10 rows. So when another row (of 100 KB) is inserted through this rotating log handler, wouldn't the last row of each file be put at the top of the next file (from newer to older)? So it makes sense to keep all the file descriptors open all the time, doesn't it?