treasure-data / serverengine

A framework to implement robust multiprocess servers like Unicorn
Apache License 2.0
759 stars 86 forks source link

Reopen log file when rotation is detected #127

Closed ashie closed 2 years ago

ashie commented 2 years ago

This is another solution for #106 to avoid using inotify.

In the previous vesions, there was no way to detect log rotation event when log file was rotated.

It causes that rotated log file was grabbed by DaemonLogger. This was unexpected behavior.

This commit fixes by reopening log file correctly.

NOTE: This PR depends on inotify so only linux was supported.

Fix #106

kenhys commented 2 years ago

I'll review this PR, just wait for a while.

ashie commented 2 years ago

It may be useful to explain why extending behavior with a module and that intention a bit in the commit message.

Added in 88420811ac563225a5420371b295968f99f9cfa5

ashie commented 2 years ago

I've noticed that the current patch isn't enough. @ino should be also updated when reopen is called directly by applications.

ashie commented 2 years ago

I've noticed that the current patch isn't enough. @ino should be also updated when reopen is called directly by applications.

Fixed in e2e8824ddd039adaea22f5f9ba71cecd5ba67523