I am trying to configure logging using Boost.Log (v1.55.0), and I cannot find a way to configure the file collector on the backend, so it will only support the last 20 logs.
namespace sinks = boost::log::sinks;
namespace keywords = boost::log::keywords;
typedef sinks::text_file_backend TextFileBackend;
typedef boost::shared_ptr<TextFileBackend> TextFileBackendPtr;
TextFileBackendPtr pBackend =
boost::make_shared<TextFileBackend>
(
keywords::file_name = "BoostLogTest_%Y%m%d.log",
keywords::auto_flush = true
);
pBackend->set_file_collector
(
sinks::file::make_collector
(
keywords::target = "..\\Logs"
)
);
There are several keywords in the sinks :: file :: make_collector call that I found as max_size and min_free_space, but both of them are not what I am looking for. I just want something like max_files, so I can say that it only stores the last 20 logs, no matter how much disk space they occupy. The only link I could find on something like this was this ticket: https://svn.boost.org/trac/boost/ticket/8746 .
, . , , , .