Apache Log4cxx  Version 1.1.0
fileappender.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 #ifndef _LOG4CXX_FILE_APPENDER_H
19 #define _LOG4CXX_FILE_APPENDER_H
20 
21 #include <log4cxx/logger.h>
22 #include <log4cxx/logstring.h>
23 #include <log4cxx/writerappender.h>
24 #include <log4cxx/file.h>
25 #include <log4cxx/helpers/pool.h>
26 
27 namespace log4cxx
28 {
29 namespace helpers
30 {
31 class Pool;
32 }
33 
41 class LOG4CXX_EXPORT FileAppender : public WriterAppender
42 {
43  protected:
44  struct FileAppenderPriv;
45 
46  public:
52 
53 
57 
71  FileAppender(const LayoutPtr& layout, const LogString& filename, bool append,
72  bool bufferedIO, int bufferSize);
73 
83  FileAppender(const LayoutPtr& layout, const LogString& filename, bool append);
84 
91  FileAppender(const LayoutPtr& layout, const LogString& filename);
92 
94 
104  virtual void setFile(const LogString& file);
105 
109  bool getAppend() const;
110 
112  LogString getFile() const;
113 
120  void activateOptions(helpers::Pool& p) override;
121  void setOption(const LogString& option, const LogString& value) override;
122 
130  bool getBufferedIO() const;
131 
135  int getBufferSize() const;
136 
147  void setAppend(bool fileAppend1);
148 
158  void setBufferedIO(bool bufferedIO);
159 
163  void setBufferSize(int bufferSize1);
164 
171  static LogString stripDuplicateBackslashes(const LogString& name);
172 
173  protected:
174  void activateOptionsInternal(log4cxx::helpers::Pool& p);
175 
196  void setFileInternal(const LogString& file, bool append,
197  bool bufferedIO, size_t bufferSize,
198  log4cxx::helpers::Pool& p);
199 
200  void setFileInternal(const LogString& file);
201 
202  private:
203  FileAppender(const FileAppender&);
204  FileAppender& operator=(const FileAppender&);
205  protected:
206  FileAppender(std::unique_ptr<FileAppenderPriv> priv);
207 
208 }; // class FileAppender
210 
211 } // namespace log4cxx
212 
213 #endif
FileAppender appends log events to a file.
Definition: fileappender.h:42
WriterAppender appends log events to a standard output stream.
Definition: writerappender.h:37
Definition: appender.h:27
std::basic_string< logchar > LogString
Definition: logstring.h:60
std::shared_ptr< Layout > LayoutPtr
Definition: appender.h:41
LOG4CXX_PTR_DEF(Appender)
#define LOG4CXX_CAST_ENTRY(Interface)
Definition: object.h:157
#define END_LOG4CXX_CAST_MAP()
Definition: object.h:151
#define DECLARE_LOG4CXX_OBJECT(object)
Definition: object.h:42
#define LOG4CXX_CAST_ENTRY_CHAIN(Interface)
Definition: object.h:163
#define BEGIN_LOG4CXX_CAST_MAP()
Definition: object.h:145