How to configure boost log, for writing with rotating and appending?
And after restart program, don\'t clear log file.
int init_log()
{
typedef sinks
Please try this out (the key is adding the log name using some pattern and not fixing its name like "app.log") this will enable flre rotation and the data will be appended to each created file. Regarding the log clearing, as long as you haven't specified custom file_collector, your logs should remain intact :)
typedef sinks::synchronous_sink< sinks::text_file_backend > file_sink;
boost::shared_ptr< file_sink > sink( new file_sink(
keywords::file_name = "app%m%d%Y_%H%M%S_%5N.log", // file name pattern
keywords::rotation_size = 10*1024 // rotation size, in characters
));