How to handle disk full errors while logging in logback?

前端 未结 3 1736
眼角桃花
眼角桃花 2021-02-08 12:36

I am using slf4j+logback for logging in our application. Earlier we were using jcl+log4j and moved recently.

Due to the high amount of logging in our application, there

3条回答
  •  执念已碎
    2021-02-08 13:29

    You do not have to do or configure anything. Logback is designed to handle this situation quite nicely. Once target disk is full, logback's FileAppender will stop writing to it for a certain short amount of time. Once that delay elapses, it will attempt to recover. If the recovery attempt fails, the waiting period is increased gradually up to a maximum of 1 hour. If the recovery attempt succeeds, FileAppender will start logging again.

    The process is entirely automatic and extends seamlessly to RollingFileAppender. See also graceful recovery.

    On a more personal note, graceful recovery is one my favorite logback features.

提交回复
热议问题