如何配置 boost 日志,用于旋转和追加写入?
并且重新启动程序后,不要清除日志文件。
int init_log()
{
typedef sinks::synchronous_sink< sinks::text_file_backend > file_sink;
boost::shared_ptr< file_sink > sink( new file_sink (
keywords::file_name = "app.log", // only one files
// keywords::open_mode = (std::ios::out | std::ios::app), // is not append
keywords::open_mode = (std::ios::out | std::ios::app), // is not rotated
keywords::rotation_size = 10 * 1024
));
}