'Logback: Very rarely stops writing to current file and resumes in next hour rotated file

I am using logback in spring-boot project to log the json requests received as String in log files. I am seeing a weird issue. Very rarely, I can see some corrupt gz log files with incomplete logs. When I am checking in archived gz log file, I can see incomplete current line (json) in the archived log file and then no logs in that file after that and then I can see proper logs again in the next hour archived gz file. Also, when I am trying to unzip the corrupt file(incomplete file) I am getting error "unexpected end of file". I suspect that logback stops writing to the file and again it picks up and starts writing to new file after hour rotation.

I am using SizeAndTimeBasedRollingPolicy and LoggingEventAsyncDisruptorAppender.

The size of corrupt file is 45 MB which is much lesser than the threshold size for rotation which is 100 MB.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source