log4cpp 1.1
|
00001 /* 00002 * DailyRollingFileAppender.hh 00003 * 00004 * See the COPYING file for the terms of usage and distribution. 00005 */ 00006 00007 #ifndef _LOG4CPP_DAILYROLLINGFILEAPPENDER_HH 00008 #define _LOG4CPP_DAILYROLLINGFILEAPPENDER_HH 00009 00010 #include <log4cpp/Portability.hh> 00011 #include <log4cpp/FileAppender.hh> 00012 #include <string> 00013 #include <stdarg.h> 00014 00015 namespace log4cpp { 00016 00022 class LOG4CPP_EXPORT DailyRollingFileAppender : public FileAppender { 00023 public: 00024 DailyRollingFileAppender(const std::string& name, 00025 const std::string& fileName, 00026 unsigned int maxDaysToKeep = maxDaysToKeepDefault, 00027 bool append = true, 00028 mode_t mode = 00644); 00029 00030 virtual void setMaxDaysToKeep(unsigned int maxDaysToKeep); 00031 virtual unsigned int getMaxDaysToKeep() const; 00032 00033 virtual void rollOver(); 00034 00035 static unsigned int maxDaysToKeepDefault; 00036 protected: 00037 virtual void _append(const LoggingEvent& event); 00038 00039 unsigned int _maxDaysToKeep; 00040 // last log's file creation time (or last modification if appender just created) 00041 struct tm _logsTime; 00042 }; 00043 } 00044 00045 #endif // _LOG4CPP_DAILYROLLINGFILEAPPENDER_HH