Apache log4cxx  Version 0.12.1
rollingpolicybase.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #if !defined(_LOG4CXX_ROLLING_ROLLING_POLICY_BASE_H)
19 #define _LOG4CXX_ROLLING_ROLLING_POLICY_BASE_H
20 
21 #if defined(_MSC_VER)
22  #pragma warning ( push )
23  #pragma warning ( disable: 4231 4251 4275 4786 )
24 #endif
25 
26 
27 #include <log4cxx/helpers/object.h>
28 #include <log4cxx/logger.h>
29 #include <log4cxx/logmanager.h>
34 
35 namespace log4cxx
36 {
37 namespace rolling
38 {
39 LOG4CXX_LIST_DEF(PatternConverterList, log4cxx::pattern::PatternConverterPtr);
41 
49 class LOG4CXX_EXPORT RollingPolicyBase :
50  public virtual RollingPolicy,
51  public virtual helpers::Object
52 {
53  protected:
59 
60 
61  private:
65  PatternConverterList patternConverters;
66 
70  FormattingInfoList patternFields;
71 
75  LogString fileNamePatternStr;
76 
77 
78  public:
80  virtual ~RollingPolicyBase();
83 
84  virtual void setOption(const LogString& option,
85  const LogString& value);
86 
91  void setFileNamePattern(const LogString& fnp);
92 
98 
99 
100 #ifdef LOG4CXX_MULTI_PROCESS
101  PatternConverterList getPatternConverterList()
102  {
103  return patternConverters;
104  }
105 #endif
106  protected:
111 
120  LogString& buf, log4cxx::helpers::Pool& p) const;
121 
122  log4cxx::pattern::PatternConverterPtr getIntegerPatternConverter() const;
123  log4cxx::pattern::PatternConverterPtr getDatePatternConverter() const;
124 
125 
126 };
127 }
128 }
129 
130 
131 #if defined(_MSC_VER)
132  #pragma warning ( pop )
133 #endif
134 
135 #endif
base class for java-like objects.
Definition: object.h:102
Definition: pool.h:33
Implements methods common to most, it not all, rolling policies.
Definition: rollingpolicybase.h:52
virtual void setOption(const LogString &option, const LogString &value)
Set option to value.
log4cxx::pattern::PatternConverterPtr getIntegerPatternConverter() const
void parseFileNamePattern()
Parse file name pattern.
LogString getFileNamePattern() const
Get file name pattern.
log4cxx::pattern::PatternConverterPtr getDatePatternConverter() const
virtual log4cxx::pattern::PatternMap getFormatSpecifiers() const =0
virtual void activateOptions(log4cxx::helpers::Pool &p)=0
Activate the options that were previously set with calls to option setters.
void setFileNamePattern(const LogString &fnp)
Set file name pattern.
void formatFileName(log4cxx::helpers::ObjectPtr &obj, LogString &buf, log4cxx::helpers::Pool &p) const
Format file name.
A RollingPolicy is responsible for performing the rolling over of the active log file.
Definition: rollingpolicy.h:44
A string based interface to configure package components.
Definition: optionhandler.h:35
std::shared_ptr< Object > ObjectPtr
Definition: propertysetter.h:28
std::map< LogString, PatternConstructor > PatternMap
Definition: patternparser.h:41
std::shared_ptr< FormattingInfo > FormattingInfoPtr
Definition: formattinginfo.h:31
LOG4CXX_LIST_DEF(PatternConverterList, log4cxx::pattern::PatternConverterPtr)
Definition: appender.h:33
std::basic_string< logchar > LogString
Definition: logstring.h:66
#define LOG4CXX_CAST_ENTRY(Interface)
Definition: object.h:148
#define DECLARE_ABSTRACT_LOG4CXX_OBJECT(object)
Definition: object.h:26
#define END_LOG4CXX_CAST_MAP()
Definition: object.h:142
#define BEGIN_LOG4CXX_CAST_MAP()
Definition: object.h:136