-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Labels
Description
Hi !
For testing the file rotation, I used the dd command to artificially inflate the file size.
But I noticed despite that the file didn't rotate on next log being emitted.
Checking the code here:
supervisor/supervisor/loggers.py
Line 264 in 5732a41
| if not (self.stream.tell() >= self.maxBytes): |
I see it uses the tell function, but I guess it keeps the cursor at the location it emitted its previous log, without taking into account an eventual new log being written in the file externally.
What do you think of adding this for instance right before this check, so that we move the cursor at the end of the line ?
# Seek to end to ensure tell() reflects actual file size
# This handles cases where file was externally modified (e.g., with dd)
self.stream.seek(0, 2) # SEEK_ENDThanks for reading me !