v.22.8Improvement

Fix log rotation behavior during restart

Fix incorrect behavior of log rotation during restart. #39558 (Nikolay Degterinsky).
Fixes incorrect behavior of log rotation during ClickHouse server restart to ensure proper log file management.

Why it matters

This fix addresses issues where log rotation did not function correctly when the ClickHouse server was restarted, preventing potential log loss or improper log file handling. It improves reliability and consistency in log management.

How to use it

Users benefit from this fix automatically after upgrading to the version including this change. No additional configuration or manual intervention is needed to enable proper log rotation on restart.