Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup and compress on application closing #39

Closed
ghost opened this issue Jun 28, 2019 · 3 comments
Closed

Cleanup and compress on application closing #39

ghost opened this issue Jun 28, 2019 · 3 comments
Assignees

Comments

@ghost
Copy link

ghost commented Jun 28, 2019

Is there a way to cleanup when the application is closing. I am currently calling the writable.end() method but that doesn't handle the compression of the current stream?

@iccicci
Copy link
Owner

iccicci commented Jun 30, 2019

Hi @jspaeth20 ,

that it is the right method to close the stream; probably its better to wait for the close event to be sure everything is done.
If you mean you expected an additional compression on stream close, this is not expected: rotations, and eventual compressions, happen only at time limit or size limit.

Hope this helps,
iCC

@iccicci iccicci self-assigned this Jun 30, 2019
@puzsol
Copy link

puzsol commented Oct 8, 2019

I am having a similar issue, in that when the application shuts down (cancelled), the last file it was writing to is not recorded in the history file - which is a problem, because I am using the immutable flag with a filename based on date-time to the millisecond, so when it starts up, it generates a new file name and starts writing to it, when that file is rotated it is added to the history file, but it skips the one that was open when the application died - so it is never cleaned up.

Eg run 1:
FileA.log
FileB.log
FileC.log
were created but only FileA and FileB are recorded in the history file (as history is only appended to on stream close, not stream open)
run 2:
FileD.log is created
FileE.log is created, as we hit the limit, FileA is removed
FileF.log is created, FileB is removed
FileG.log is created, FileD is removed

Result is that FileC is never removed because it was never recorded in the history file.
Repeat this a few times and the log files start to pile up.

Is there some event I should be hooking into to ensure the last open log file is recorded before the application ends?

@iccicci
Copy link
Owner

iccicci commented Oct 8, 2019

Hi @puzsol ,

crystal clear! I'll check it soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants