Boost log to limit log file maximum file size

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Boost log to limit log file maximum file size

Boost - Dev mailing list
H Andrey and all,

Can the log file be configured to set up the file size cap, when the
log file reaches to the maximum file size, it deletes it and starts a
new log file not rotates it?

Thank you.

- jupiter

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Boost log to limit log file maximum file size

Boost - Dev mailing list
On 7/20/19 1:09 AM, JH wrote:
> H Andrey and all,
>
> Can the log file be configured to set up the file size cap, when the
> log file reaches to the maximum file size, it deletes it and starts a
> new log file not rotates it?

You can write your own file collector that will just delete the file on
rotation. You will have to implement the `collector` interface:

https://github.com/boostorg/log/blob/ca227bc2f30d65f14719a674247728647caa2b2f/include/boost/log/sinks/text_file_backend.hpp#L74

Then you can set your collector to the sink backend and use the
rotation_size named parameter to limit the file size.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost