Where the oldest log file is archived with python protocol

I have set python logging with RotatingFileHandler

c backupCount

as 3 and maxBytes

as 1024 * 1024 with the main log file name as test.log

.

What happens test.log.3

after filling it out. Is it archived? If so, how do I find this location.

+3


source to share


2 answers


The rolling FileHandler calls the doRollover () method , which checks backupCount

and then removes test.log.3

with os.remove()

.

The functionality of os.remove depends on your system. According to the Python docs os.remove()

will call the operating system unlock functionality and remove the file from disk.



The filesystem probably just marks the sectors as free and removes the file entry from the directory. It all depends on your OS / filesystem implementation.

Edit: For finding deleted files on Linux, you can try debugfs .

+1


source


backupCount

is the number of files that are stored. Old files are deleted.

When filled test.log

, it is renamed to test.log.1

.



It is then test.log.1

renamed to test.log.2

, and when it reaches test.log.3

, it is removed on the next rollover.

0


source







All Articles