I have a python script that launches a number of user processes using subprocess.Popen. Each process stdout is redirected to a unique file. For example the I launch each process as follows
proc = my_proc
for p in range(1, max_p, 1):
log_file = proc + "_" + str(p) + ".log"
log = open(log_file, "w+")
subprocess.Popen([my_proc, p], shell = False, stdout = log)
I would like to rotate these files when they become too big. What would the best way of doing this? I would like to use the logging module but I dont think this is its intended use
Thanks