XLL+ Class Library (7.0)

RollingFileAppender Class

An implementation of Appender that appends to a file on disk. A new file is opened at the start of each rolling time period, which may be an hour, a day or a week. This approach prevents the log file from building up to a huge size.

class psl::log::RollingFileAppender : public Appender

Rolling log file name

The name of the log file is constructed by the appender object by substituting the current date/time for the characters %t. The formats shown below are used for the substitutions.

Period Format
Hour YYYYMMDD_HH
Day YYYYMMDD
Month YYYYMM

Thus, for example, log files with the periods and names below might be expanded as shown at 2:00 pm on 12th April 2013.

Period Unexpanded Expanded
Hour C:\log_%t.txt C:\log_20130412_14.txt
Day %TMP%\excel_addin_log%t.log C:\Temp\excel_addin_log20130412.log
Day %TMP%\logs\log_for_%t.log C:\Users\MyName\AppData\Local\Temp\log_for_201304.log

Requirements

Header: cpplog.h
Namespace: psl::log

See Also

RollingFileAppender Methods | cpplog.h | Logging (User Guide) | Appender class