I use boost 1.62. I init boost logger this way:
logging::add_file_log
(
keywords::file_name = "myfile.log",
keywords::rotation_size = 1024,
keywords::format = expr::stream
<< "["
<< expr::format_date_time< boost::posix_time::ptime >("TimeStamp", "%Y-%m-%d, %H:%M:%S.%f")
<< "] <" << expr::attr< severity_level >("Severity")
<< "> " << expr::message
);
logging::add_common_attributes();
For the above code rotation works fine but when program starts a log file is created from the begining. When I add:
keywords::open_mode = (std::ios::out | std::ios::app)
to add_file_log
new logs are appended to the existing log file, but rotation doesn't work. I need one log file which is rotated. A new data should be appended when a file already exists. How to fix that ?