Boost logger add to file

I have an initialized receiver that writes to a file:

logging::add_file_log
            (
            keywords::file_name = "sample_%N.log",                                        /*< file name pattern >*/
            keywords::rotation_size = 10 * 1024 * 1024,                                   /*< rotate files every 10 MiB... >*/
            keywords::time_based_rotation = sinks::file::rotation_at_time_point(0, 0, 0), /*< ...or at midnight >*/
            keywords::format = "[%TimeStamp%]: %Message%",                                 /*< log record format >*/
            keywords::auto_flush = true
            );

It looks like it overwrites the file while the program restarts. How to make it attached to a file?

+4
source share
1 answer

The documentation states

open_mode Mask describing the open mode for the file. See Std :: ios_base :: openmode.

Openmode keywords::open_modefor append - std::ios_base::appso it looks like you need to add it.

+4
source

All Articles