Boost logger追加到文件 [英] Boost logger append to file
本文介绍了Boost logger追加到文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经初始化了记录到文件的接收器:
I have initialized sink that logs to file:
logging::add_file_log
(
keywords::file_name = "sample_%N.log", /*< file name pattern >*/
keywords::rotation_size = 10 * 1024 * 1024, /*< rotate files every 10 MiB... >*/
keywords::time_based_rotation = sinks::file::rotation_at_time_point(0, 0, 0), /*< ...or at midnight >*/
keywords::format = "[%TimeStamp%]: %Message%", /*< log record format >*/
keywords::auto_flush = true
);
它看起来在程序重新启动期间正在重写文件.如何使其附加到文件?
It looks it rewrites file during program restart. How to make it append to file?
推荐答案
文档说
open_mode描述文件打开模式的掩码.参见std :: ios_base :: openmode.
open_mode The mask that describes the open mode for the file. See std::ios_base::openmode.
用于追加的开放模式keywords::open_mode
是std::ios_base::app
,因此您似乎需要添加它.
The openmode keywords::open_mode
for append is std::ios_base::app
, so it looks like you need to add it.
这篇关于Boost logger追加到文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文