Apache log4cxx Version 0.13.0
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
28#include <log4cxx/logger.h>
29#include <log4cxx/logmanager.h>
34
35namespace log4cxx
36{
37namespace rolling
38{
39LOG4CXX_LIST_DEF(PatternConverterList, log4cxx::pattern::PatternConverterPtr);
41
49class 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 bool createIntermediateDirectories;
78
79
80 public:
85
86 virtual void setOption(const LogString& option,
87 const LogString& value);
88
93 void setFileNamePattern(const LogString& fnp);
94
100
102 void setCreateIntermediateDirectories(bool createIntermediate);
103
104
105#ifdef LOG4CXX_MULTI_PROCESS
106 PatternConverterList getPatternConverterList()
107 {
108 return patternConverters;
109 }
110#endif
111 protected:
116
125 LogString& buf, log4cxx::helpers::Pool& p) const;
126
127 log4cxx::pattern::PatternConverterPtr getIntegerPatternConverter() const;
128 log4cxx::pattern::PatternConverterPtr getDatePatternConverter() const;
129
130
131};
132}
133}
134
135
136#if defined(_MSC_VER)
137 #pragma warning ( pop )
138#endif
139
140#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
void setCreateIntermediateDirectories(bool createIntermediate)
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:29
std::map< LogString, PatternConstructor > PatternMap
Definition: patternparser.h:41
std::shared_ptr< FormattingInfo > FormattingInfoPtr
Definition: formattinginfo.h:32
LOG4CXX_LIST_DEF(PatternConverterList, log4cxx::pattern::PatternConverterPtr)
Definition: messagehandler.h:23
std::basic_string< logchar > LogString
Definition: logstring.h:66
#define LOG4CXX_CAST_ENTRY(Interface)
Definition: object.h:153
#define DECLARE_ABSTRACT_LOG4CXX_OBJECT(object)
Definition: object.h:26
#define END_LOG4CXX_CAST_MAP()
Definition: object.h:147
#define BEGIN_LOG4CXX_CAST_MAP()
Definition: object.h:141