我正在使用Boost 1.64日志,并且日志正确地写入了所需的文件中(time_based_rotation-每天),但问题是前一天的日志文件中仅写入了特定的一天的日志。例如,19/03/19的日志写在error_18-03-19_56而不是error_19-03-19文件中。20-03-19的日志写在20-03-19中。
我通过以下方式初始化日志记录:
boost::shared_ptr< sinks::text_file_backend > backend = boost::make_shared< sinks::text_file_backend >(
keywords::file_name = filePattern, // file name pattern
keywords::rotation_size = 30 * 1024 * 1024, // rotation size, in characters
keywords::time_based_rotation = sinks::file::rotation_at_time_point(0, 0, 0),
keywords::format = "[%TimeStamp%]: %Message%",
keywords::open_mode = std::ios_base::app,
keywords::auto_flush = true
));
typedef sinks::synchronous_sink< sinks::text_file_backend > sink_t;
boost::shared_ptr< sink_t > sink(new sink_t(backend));
logging::core::get()->add_sink(sink_t);
任何人都知道那里发生了什么事