Combination of the RotatingFileSink and RotationNamingScheme::DateAndTime #930
Replies: 4 comments
-
|
Yes, this appears to be intentional. The code explicitly skips recovery/cleanup for That said, I agree this can be surprising. While unique filenames prevent collisions, they don't prevent old log files from accumulating across restarts. In practice, Your cleanup workaround seems like a reasonable solution for now. It effectively enforces retention across restarts, which the current |
Beta Was this translation helpful? Give feedback.
-
|
Can documentation at least be enhanced in the section where enum RotationNamingScheme are mentioned so that this behaviour is documented and other devs do not get "surprised" by this 😬 I think this would be useful... There are no any plans in the future to change this behaviour? |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
Thanks for reporting this! The library lets you handle custom behaviours like this by leeting you create your own custom |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
One kinda strange behaviour which I spotted when working with RotatingFileSink and using RotationNamingScheme::DateAndTime for rotation naming scheme is that the log files which have been generated in the previous application/service runs are not cleaned up i.e. taken into account when doing the recovery of the files and performing rotation later on in time. Our problem is that if for any reason let's say any of our services crashed and we used the above mentioned combination with maximum 10 files with 100MB per each logging file then with the next automatic (or even manual) service restart the previously created files will not be taken into account and our service will start accumulating them inside the destination directory where the log files are stored. Is this really intended behaviour? I found this section of the code:
I mean having unique filenames is one thing but not taking them into account when restarting app/service is kinda another thing meaning that they are "left" behind. Is it also meant that this behaviour remains like this or any changes here are gonna happen in the future?
I have this utility function which performs clean up of the files (kinda duplicates the work of the library but this will take into account case when there is a new start of the app/service).
Beta Was this translation helpful? Give feedback.
All reactions