-/*\r
- * @file strict_time_based_rolling_policy.h\r
- * @brief log4cxx's rolling policy class. (time)\r
- *\r
- * L7VSD: Linux Virtual Server for Layer7 Load Balancing\r
- * Copyright (C) 2008 NTT COMWARE Corporation.\r
- *\r
- * This program is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU Lesser General Public\r
- * License as published by the Free Software Foundation; either\r
- * version 2.1 of the License, or (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
- * Lesser General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU Lesser General Public\r
- * License along with this library; if not, write to the Free Software\r
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\r
- * 02110-1301 USA\r
- *\r
- **********************************************************************/\r
-\r
-#ifndef __STRICT_TIME_BASED_ROLLING_POLICY_H__\r
-#define __STRICT_TIME_BASED_ROLLING_POLICY_H__\r
-\r
-#include <log4cxx/portability.h>\r
-#include <log4cxx/rolling/rollingpolicybase.h>\r
-#include <log4cxx/rolling/triggeringpolicy.h>\r
-#include <log4cxx/rolling/fixedwindowrollingpolicy.h>\r
-#include "logger_enum.h"\r
-\r
-namespace log4cxx {\r
- namespace rolling {\r
- /*!\r
- * log4cxx time based rolling policy class.\r
- * this policy class can specify rolling time more strictly\r
- * than normal TimeBasedRollingPolicy.\r
- */\r
- class LOG4CXX_EXPORT StrictTimeBasedRollingPolicy :\r
- public FixedWindowRollingPolicy,\r
- public TriggeringPolicy\r
- {\r
- DECLARE_LOG4CXX_OBJECT(StrictTimeBasedRollingPolicy)\r
- BEGIN_LOG4CXX_CAST_MAP()\r
- LOG4CXX_CAST_ENTRY(StrictTimeBasedRollingPolicy)\r
- LOG4CXX_CAST_ENTRY_CHAIN(FixedWindowRollingPolicy)\r
- LOG4CXX_CAST_ENTRY_CHAIN(TriggeringPolicy)\r
- END_LOG4CXX_CAST_MAP()\r
-\r
- protected:\r
- //! time of next rollover\r
- time_t nextCheck;\r
- /*!\r
- * rotation timing\r
- * LOG_TIM_YEAR = yearly\r
- * LOG_TIM_MONTH = monthly\r
- * LOG_TIM_WEEK = weekly\r
- * LOG_TIM_DATE = daily\r
- * LOG_TIM_HOUR = hourly\r
- */\r
- LOG_ROTATION_TIMING_TAG rotationTiming;\r
- /*!\r
- * rotation timing value \r
- *\r
- * rotation timing value\r
- * -------------------------------------------------\r
- * LOG_TIM_YEAR "03051500" (3/5 15:00)\r
- * LOG_TIM_MONTH "051100" (5 11:00)\r
- * LOG_TIM_WEEK "12000" (mon 20:00) sun = 0, sat = 6\r
- * LOG_TIM_DATE "1500" (15:00)\r
- * LOG_TIM_HOUR "45" (45)\r
- */\r
- std::string rotationTimingValue;\r
- //! calculate next rollover timing\r
- time_t getNextCheck(time_t now_time);\r
- \r
- public:\r
- //! default constructor\r
- StrictTimeBasedRollingPolicy();\r
- //! increase reffernce count\r
- void addRef() const;\r
- //! decrease reffernce count\r
- void releaseRef() const;\r
- //! option setter\r
- void setOption(const LogString&, const LogString&);\r
- //! evaluate and activate options\r
- void activateOptions(log4cxx::helpers::Pool& );\r
-\r
- //! rotationTiming getter\r
- LOG_ROTATION_TIMING_TAG getRotationTiming();\r
- //! rotationTiming setter\r
- void setRotationTiming(const LOG_ROTATION_TIMING_TAG);\r
- //! rotatioTimingValue getter\r
- std::string getRotationTimingValue();\r
- //! rotatioTimingValue setter\r
- void setRotationTimingValue(const std::string&);\r
- \r
- //! rolling policy initialize\r
- RolloverDescriptionPtr initialize(\r
- const LogString& file,\r
- const bool append,\r
- log4cxx::helpers::Pool& pool);\r
- //! invoke when rollover event\r
- RolloverDescriptionPtr rollover(const LogString& activeFile,\r
- log4cxx::helpers::Pool& pool);\r
- \r
- //! returns do rollover or not \r
- virtual bool isTriggeringEvent(\r
- Appender* appender,\r
- const log4cxx::spi::LoggingEventPtr& event,\r
- const LogString& filename,\r
- size_t fileLength);\r
- \r
- };\r
- LOG4CXX_PTR_DEF(StrictTimeBasedRollingPolicy);\r
- }\r
-}\r
-\r
-#endif //__STRICT_TIME_BASED_ROLLING_POLICY_H__\r
-\r
+/*
+ * @file strict_time_based_rolling_policy.h
+ * @brief log4cxx's rolling policy class. (time)
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2008 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#ifndef __STRICT_TIME_BASED_ROLLING_POLICY_H__
+#define __STRICT_TIME_BASED_ROLLING_POLICY_H__
+
+#include <log4cxx/portability.h>
+#include <log4cxx/rolling/rollingpolicybase.h>
+#include <log4cxx/rolling/triggeringpolicy.h>
+#include <log4cxx/rolling/fixedwindowrollingpolicy.h>
+#include "logger_enum.h"
+
+namespace log4cxx {
+ namespace rolling {
+ /*!
+ * log4cxx time based rolling policy class.
+ * this policy class can specify rolling time more strictly
+ * than normal TimeBasedRollingPolicy.
+ */
+ class LOG4CXX_EXPORT StrictTimeBasedRollingPolicy :
+ public FixedWindowRollingPolicy,
+ public TriggeringPolicy
+ {
+ DECLARE_LOG4CXX_OBJECT(StrictTimeBasedRollingPolicy)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(StrictTimeBasedRollingPolicy)
+ LOG4CXX_CAST_ENTRY_CHAIN(FixedWindowRollingPolicy)
+ LOG4CXX_CAST_ENTRY_CHAIN(TriggeringPolicy)
+ END_LOG4CXX_CAST_MAP()
+
+ protected:
+ //! time of next rollover
+ time_t nextCheck;
+ /*!
+ * rotation timing
+ * LOG_TIM_YEAR = yearly
+ * LOG_TIM_MONTH = monthly
+ * LOG_TIM_WEEK = weekly
+ * LOG_TIM_DATE = daily
+ * LOG_TIM_HOUR = hourly
+ */
+ LOG_ROTATION_TIMING_TAG rotationTiming;
+ /*!
+ * rotation timing value
+ *
+ * rotation timing value
+ * -------------------------------------------------
+ * LOG_TIM_YEAR "03051500" (3/5 15:00)
+ * LOG_TIM_MONTH "051100" (5 11:00)
+ * LOG_TIM_WEEK "12000" (mon 20:00) sun = 0, sat = 6
+ * LOG_TIM_DATE "1500" (15:00)
+ * LOG_TIM_HOUR "45" (45)
+ */
+ std::string rotationTimingValue;
+ //! calculate next rollover timing
+ time_t getNextCheck(time_t now_time);
+
+ public:
+ //! default constructor
+ StrictTimeBasedRollingPolicy();
+ //! increase reffernce count
+ void addRef() const;
+ //! decrease reffernce count
+ void releaseRef() const;
+ //! option setter
+ void setOption(const LogString&, const LogString&);
+ //! evaluate and activate options
+ void activateOptions(log4cxx::helpers::Pool& );
+
+ //! rotationTiming getter
+ LOG_ROTATION_TIMING_TAG getRotationTiming();
+ //! rotationTiming setter
+ void setRotationTiming(const LOG_ROTATION_TIMING_TAG);
+ //! rotatioTimingValue getter
+ std::string getRotationTimingValue();
+ //! rotatioTimingValue setter
+ void setRotationTimingValue(const std::string&);
+
+ //! rolling policy initialize
+ RolloverDescriptionPtr initialize(
+ const LogString& file,
+ const bool append,
+ log4cxx::helpers::Pool& pool);
+ //! invoke when rollover event
+ RolloverDescriptionPtr rollover(const LogString& activeFile,
+ log4cxx::helpers::Pool& pool);
+
+ //! returns do rollover or not
+ virtual bool isTriggeringEvent(
+ Appender* appender,
+ const log4cxx::spi::LoggingEventPtr& event,
+ const LogString& filename,
+ size_t fileLength);
+
+ };
+ LOG4CXX_PTR_DEF(StrictTimeBasedRollingPolicy);
+ }
+}
+
+#endif //__STRICT_TIME_BASED_ROLLING_POLICY_H__
+