easyloggingpp icon indicating copy to clipboard operation
easyloggingpp copied to clipboard

Reopen log file after logrotate

Open bhjortsberg opened this issue 7 years ago • 3 comments

When using logrotate to limit log file size in a linux system I cannot get easyloggingpp to reopen the log file after it has been rotated.

I've tried to just do Logger::reconfigure() but seems that is not enough. Then I tried Helpers::validateFileRolling() but I call it after the file has been rotated so it will not do the fs->close() fs->open().

Any idea how to do this?

bhjortsberg avatar Dec 06 '17 15:12 bhjortsberg

After a little investigation I found that log files seem to be open due to a shared_ptr is never releasing the FileStream object and hence the file is never closed.

I made a fix here: https://github.com/muflihun/easyloggingpp/pull/595

bhjortsberg avatar Dec 08 '17 10:12 bhjortsberg

Why is this important repair not integrated?

mingzhenliu avatar Apr 20 '18 02:04 mingzhenliu

I had the same problem when using Logger::reconfigure()

AlbertGithubHome avatar May 16 '23 02:05 AlbertGithubHome