2 * @file time_and_size_based_rolling_policy.h
3 * @brief log4cxx's rolling policy class. (time + size)
5 * L7VSD: Linux Virtual Server for Layer7 Load Balancing
6 * Copyright (C) 2009 NTT COMWARE Corporation.
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
23 **********************************************************************/
25 #ifndef __TIME_AND_SIZE_BASED_ROLLING_POLICY_H__
26 #define __TIME_AND_SIZE_BASED_ROLLING_POLICY_H__
28 #include <log4cxx/portability.h>
29 #include "strict_time_based_rolling_policy.h"
30 #include "logger_rotation_enum.h"
35 * log4cxx time and size based rolling policy class.
36 * this policy class is delivered from StrictTimeBasedRollingPolicy.
37 * so it can size specify in addition to strict time specify.
39 class LOG4CXX_EXPORT TimeAndSizeBasedRollingPolicy :
40 public StrictTimeBasedRollingPolicy
42 DECLARE_LOG4CXX_OBJECT(TimeAndSizeBasedRollingPolicy)
43 BEGIN_LOG4CXX_CAST_MAP()
44 LOG4CXX_CAST_ENTRY(TimeAndSizeBasedRollingPolicy)
45 LOG4CXX_CAST_ENTRY_CHAIN(StrictTimeBasedRollingPolicy)
46 END_LOG4CXX_CAST_MAP()
49 //! maximum size of file
53 //! default constructor
54 TimeAndSizeBasedRollingPolicy();
56 void setOption(const LogString&, const LogString&);
57 //! maxFileSize getter
58 size_t getMaxFileSize();
59 //! maxFileSize setter
60 void setMaxFileSize(size_t);
62 //! returns do rollover or not
63 virtual bool isTriggeringEvent(
65 const log4cxx::spi::LoggingEventPtr& event,
66 const LogString& filename,
70 LOG4CXX_PTR_DEF(TimeAndSizeBasedRollingPolicy);
74 #endif //__TIME_AND_SIZE_BASED_ROLLING_POLICY_H__