Boost logo

Boost :

From: Caleb Epstein (caleb.epstein_at_[hidden])
Date: 2005-05-05 07:56:51

The proposed Logging library hasn't entered any formal review period
yet, so isn't sending a review like this premature? Or is this
standard practice? The feedback is certainly helpful.

On 5/5/05, Matthew P. Cashdollar <mpc_at_[hidden]> wrote:

> It would be nice to have it automatically rename or append to the old
> log file instead of just replacing it, IMO.

You can do this by passing the second argument to the write_to_file ctor:

write_to_file (const log_types::log_name_string_type& file_name, bool
overwrite = true);

I think this default should be changed to false though, as I suspect
that is what most users would prefer.

> - No log rotation. This library does not support log rotation (at least
> in the version I tried). I didn't need this feature for my project, but
> I'm sure it will be a frequently requested feature.

I have implemented two different classes of rolling appenders for
John's library and sent them to this list on several occasions. I do
so again with this mail in the hopes that John will include them with
the next release. They include:

rolling_file_appender - size-based log rollover. Keeps up to <n>
files each no larger than <m> bytes. Removes the <n>+1st log when
rolling over. Depends on Boost.Filesystem.

periodic_file_appender - time-based log rollover. Rotates logs based
on a rollover period, specified in seconds. The user can specify a
filename "prototype" and a factory method that will be used to
generate the actual log filenames (e.g. filename = filename_factory
(filename_prototype)). I use this, for example, to create
date-stamped log filenames. Includes
{hourly,daily,weekly,monthly,yearly}_file_appender convenience
functions. No logfile backup/removal policy. No external

Caleb Epstein
caleb dot epstein at gmail dot com

Boost list run by bdawes at, gregod at, cpdaniel at, john at