-/*\r
- * @file time_and_size_based_rolling_policy.cpp\r
- * @brief log4cxx's rolling policy class. (time + size)\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
-#include <log4cxx/logstring.h>\r
-#include <log4cxx/pattern/filedatepatternconverter.h>\r
-#include <log4cxx/helpers/date.h>\r
-#include <log4cxx/rolling/filerenameaction.h>\r
-#include <log4cxx/helpers/loglog.h>\r
-#include <log4cxx/helpers/exception.h>\r
-#include <log4cxx/helpers/stringhelper.h>\r
-#include <log4cxx/helpers/optionconverter.h>\r
-#include <time.h>\r
-#include "time_and_size_based_rolling_policy.h"\r
-#include "lexical_cast.h"\r
-\r
-#define DEFAULT_MAX_FILE_SIZE (10 * 1024 * 1024)\r
-\r
-using namespace log4cxx;\r
-using namespace log4cxx::rolling;\r
-using namespace log4cxx::helpers;\r
-using namespace log4cxx::pattern;\r
-\r
-IMPLEMENT_LOG4CXX_OBJECT(TimeAndSizeBasedRollingPolicy)\r
-\r
-/*!\r
- * default constructor.\r
- * initialize member valiables\r
- * @param void\r
- * @return void\r
- */\r
-TimeAndSizeBasedRollingPolicy::TimeAndSizeBasedRollingPolicy() :\r
- maxFileSize(DEFAULT_MAX_FILE_SIZE)\r
-{\r
-}\r
-\r
-/*!\r
- * maxFileSize getter\r
- * @param void\r
- * @return maxFileSize\r
- */\r
-size_t TimeAndSizeBasedRollingPolicy::getMaxFileSize()\r
-{\r
- return maxFileSize;\r
-}\r
-\r
-/*!\r
- * maxFileSize setter\r
- * @param maxFileSize\r
- * @return void\r
- */ \r
-void TimeAndSizeBasedRollingPolicy::setMaxFileSize(size_t size)\r
-{\r
- maxFileSize = size;\r
-}\r
-\r
-/*!\r
- * option setter\r
- * @param option name\r
- * @param value\r
- * @return void\r
- */\r
-void TimeAndSizeBasedRollingPolicy::setOption(const LogString& option, const LogString& value)\r
-{\r
- if (StringHelper::equalsIgnoreCase(option,\r
- LOG4CXX_STR("MAXFILESIZE"),\r
- LOG4CXX_STR("maxfilesize"))) {\r
- maxFileSize = OptionConverter::toFileSize(value, DEFAULT_MAX_FILE_SIZE);\r
- }\r
- else {\r
- StrictTimeBasedRollingPolicy::setOption(option, value);\r
- }\r
-}\r
-\r
-/*!\r
- * returns do rollover or not\r
- * @param appender (not use)\r
- * @param event (not use)\r
- * @param filename (not use)\r
- * @param fileLength\r
- * @retval true do rollover\r
- * @retval false not rollover yet\r
- */\r
-bool TimeAndSizeBasedRollingPolicy::isTriggeringEvent(\r
- Appender* appender,\r
- const log4cxx::spi::LoggingEventPtr& event,\r
- const LogString& filename,\r
- size_t fileLength) \r
-{\r
-\r
- return (fileLength >= maxFileSize || \r
- StrictTimeBasedRollingPolicy::isTriggeringEvent(appender, event, filename, fileLength));\r
-}\r
+/*
+ * @file time_and_size_based_rolling_policy.cpp
+ * @brief log4cxx's rolling policy class. (time + size)
+ *
+ * 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
+ *
+ **********************************************************************/
+
+#include <log4cxx/logstring.h>
+#include <log4cxx/pattern/filedatepatternconverter.h>
+#include <log4cxx/helpers/date.h>
+#include <log4cxx/rolling/filerenameaction.h>
+#include <log4cxx/helpers/loglog.h>
+#include <log4cxx/helpers/exception.h>
+#include <log4cxx/helpers/stringhelper.h>
+#include <log4cxx/helpers/optionconverter.h>
+#include <time.h>
+#include "time_and_size_based_rolling_policy.h"
+#include "lexical_cast.h"
+
+#define DEFAULT_MAX_FILE_SIZE (10 * 1024 * 1024)
+
+using namespace log4cxx;
+using namespace log4cxx::rolling;
+using namespace log4cxx::helpers;
+using namespace log4cxx::pattern;
+
+IMPLEMENT_LOG4CXX_OBJECT(TimeAndSizeBasedRollingPolicy)
+
+/*!
+ * default constructor.
+ * initialize member valiables
+ * @param void
+ * @return void
+ */
+TimeAndSizeBasedRollingPolicy::TimeAndSizeBasedRollingPolicy() :
+ maxFileSize(DEFAULT_MAX_FILE_SIZE)
+{
+}
+
+/*!
+ * maxFileSize getter
+ * @param void
+ * @return maxFileSize
+ */
+size_t TimeAndSizeBasedRollingPolicy::getMaxFileSize()
+{
+ return maxFileSize;
+}
+
+/*!
+ * maxFileSize setter
+ * @param maxFileSize
+ * @return void
+ */
+void TimeAndSizeBasedRollingPolicy::setMaxFileSize(size_t size)
+{
+ maxFileSize = size;
+}
+
+/*!
+ * option setter
+ * @param option name
+ * @param value
+ * @return void
+ */
+void TimeAndSizeBasedRollingPolicy::setOption(const LogString& option, const LogString& value)
+{
+ if (StringHelper::equalsIgnoreCase(option,
+ LOG4CXX_STR("MAXFILESIZE"),
+ LOG4CXX_STR("maxfilesize"))) {
+ maxFileSize = OptionConverter::toFileSize(value, DEFAULT_MAX_FILE_SIZE);
+ }
+ else {
+ StrictTimeBasedRollingPolicy::setOption(option, value);
+ }
+}
+
+/*!
+ * returns do rollover or not
+ * @param appender (not use)
+ * @param event (not use)
+ * @param filename (not use)
+ * @param fileLength
+ * @retval true do rollover
+ * @retval false not rollover yet
+ */
+bool TimeAndSizeBasedRollingPolicy::isTriggeringEvent(
+ Appender* appender,
+ const log4cxx::spi::LoggingEventPtr& event,
+ const LogString& filename,
+ size_t fileLength)
+{
+
+ return (fileLength >= maxFileSize ||
+ StrictTimeBasedRollingPolicy::isTriggeringEvent(appender, event, filename, fileLength));
+}