Boost Log V2 循环保留一个文件为 "master"

Boost Log V2 rotation keep one file as "master"

我正在使用 Boost Log V2 从我的应用程序创建日志文件。

我已使用此命名配置将日志文件配置为按大小轮换:

keywords::file_name = "application_%N.log",
keywords::rotation_size = 5 * 1024 * 1024,
keywords::max_size = 16 * 1024 * 1024,

这将确保轮换命名它们的文件:

application_1.log, application_2.log, application_3.log .... application_N.log 

最新的文件是第N个文件。 是否有任何选项可以使最新的文件始终是同一个文件(如 'application_0.log')?

我需要能够查看最新的日志文件以了解更改,而在此配置中,它总是会更改。

Is there any option to make the newest file always be the same one (like 'application_0.log')?

不,不支持。您将必须实现自己的文件收集器,该文件收集器派生自 collector 接口并对文件轮换执行必要的操作。注意文件名是sink后端生成的,也就是说你可能也需要修改。