mcollina / pino-roll

A Pino transport that automatically rolls your log files
MIT License
41 stars 11 forks source link

Incorrect File Pointing Upon Application Restart #75

Open bkvishe opened 6 months ago

bkvishe commented 6 months ago

Below is my Pino configuration that utilizes the Pino-roll plugin for file rotation based on specified criteria. However, an issue arises upon application restart where the logger continues pointing to the old file, even after it has exceeded the rotation criteria.

image

Please refer to the below screenshot, where despite the file combine.1.log surpassing the rotation criteria and a new file combine.2.log being created by pino-roll, upon the application restart, the logger reverts back the pointing to the old file combine.1.log.

image

ivan-tymoshenko commented 6 months ago

I think it works as expected, but IMHO that makes sense to change the default behavior.

https://github.com/mcollina/pino-roll?tab=readme-ov-file#options Please not that limit only considers created log files. It will not consider any pre-existing files. Therefore, starting your logger with a limit will never tries deleting older log files, created during previous executions.