[log] Patch: rotating file collector (Was: Boost.Log: Any Comments?)
Hi, Just to remind the context, I'm pasting content from previous mail thread. On Tuesday 09 April 2013 18:43:05 Alexander Arhipenko wrote:
... [snip] ...
It would be very nice to have rotation feature work the same way as in e.g. python logging library or Apache web server: * latest file has the name filename.log * previous file has the name filename.log.1 or filename.log.YYYY-MM-DD AFAIK, it's impossible to achieve in current implementation.
Andrey, what do you think about this?
The library does not provide this behavior out of the box. But the file sink uses a file collector object to collect rotated files. This collector can be implemented by the user (it should derive from sinks::file::collector interface) and it should be possible to implement it the way you describe. Would you like to submit such implementation?
I've added implementation of rotating file collector - the patch against boost log trunk attached. This is not the final version, I'm going at least to finish most of the TODOs. However, it would be nice to receive feedback and questions from library author as well as from people interested in this feature. Andrey, could you please find several minutes to review the attached patch? Also, I would like to discuss following question with you : rotate_file invocation in ~text_file_backend - I would prefer to have this call during text_file_backend construction phase. Regards
participants (1)
-
Alexander Arhipenko