From: Evert H. <ev...@zu...> - 2002-01-10 08:15:57
|
Alex, Maybe I'm picking nits here, but in log4j the RollingFileAppender is different: it just rolls over when it reaches a certain maximum size. What you've made looks more like their DailyFileAppender. Maybe you should rename it? Otherwise, it compiles with Borland C++ Builder - if you have a test program, I'll test that it actually works with the Builder, too. Ta, Evert -----Original Message----- From: log...@li... [mailto:log...@li...]On Behalf Of Alex Tapaccos Sent: Wednesday, January 09, 2002 16:27 PM To: 'log...@li...' Subject: [Log4cpp-devel] Rolling File Appender v2 How to make a fool of one'self Here are the correct files -----Original Message----- From: Alex Tapaccos [mailto:ATa...@re...] Sent: 09 January 2002 15:24 To: 'log...@li...' Subject: [Log4cpp-devel] Rolling File Appender Dear All Here is my first attempt for a rolling file appender so that log files can change on specified periods <<RollingFileAppender.cpp>> <<RemoteSyslogAppender.hh>> These lines need to be added to the simpleconfigurator else if (appenderName.compare("rolling") == 0) std::string logFileNameFormat; std::string rollingDuration; if (!(initFile >> logFileNameFormat)) throw ConfigureFailure("Missing filename for rolling log file format logging configuration file for category: " + categoryName); } if (!(initFile >> rollingDuration)) throw ConfigureFailure("Missing duration for rolling log file format logging configuration file for category: " + categoryName); } appender = new log4cpp::RollingFileAppender(categoryName, logFileNameFormat,RollingFileAppender::getDuration(rollingDuration)); } Features 1. Hourly,daily,weekly,monthly changes 2. Allows you to specify format of file name, uses the method strftime to achieve this 3. Can be accessed by the simple configurator by using following syntax appender Category pattern rolling %d%m%Y.log hourly %r %c %p %m%n ^ ^ ^ how often to change file | name of log to generate this example 09012002.log | appender name Apologies for any bugs!!! Look forward to comments Regards Alex |