Apache log4cxx Version 0.13.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>
24#include <log4cxx/file.h>
26
27#if defined(_MSC_VER)
28 #pragma warning ( push )
29 #pragma warning ( disable: 4251 )
30#endif
31
32namespace log4cxx
33{
34namespace helpers
35{
36class Pool;
37}
38
46class LOG4CXX_EXPORT FileAppender : public WriterAppender
47{
48 protected:
57
61
65
69
70 public:
76
81
95 FileAppender(const LayoutPtr& layout, const LogString& filename, bool append,
96 bool bufferedIO, int bufferSize);
97
107 FileAppender(const LayoutPtr& layout, const LogString& filename, bool append);
108
115 FileAppender(const LayoutPtr& layout, const LogString& filename);
116
118
128 virtual void setFile(const LogString& file);
129
133 inline bool getAppend() const
134 {
135 return fileAppend;
136 }
137
139 inline LogString getFile() const
140 {
141 return fileName;
142 }
143
151 void setOption(const LogString& option,
152 const LogString& value);
153
161 inline bool getBufferedIO() const
162 {
163 return bufferedIO;
164 }
165
169 inline int getBufferSize() const
170 {
171 return bufferSize;
172 }
173
184 void setAppend(bool fileAppend1);
185
195 void setBufferedIO(bool bufferedIO);
196
200 void setBufferSize(int bufferSize1)
201 {
202 this->bufferSize = bufferSize1;
203 }
204
212
213 protected:
215
236 void setFileInternal(const LogString& file, bool append,
237 bool bufferedIO, size_t bufferSize,
239
240 void setFileInternal(const LogString& file);
241
242 private:
244 FileAppender& operator=(const FileAppender&);
245
246}; // class FileAppender
248
249} // namespace log4cxx
250
251#if defined(_MSC_VER)
252 #pragma warning (pop)
253#endif
254
255#endif
FileAppender appends log events to a file.
Definition: fileappender.h:47
int getBufferSize() const
Get the size of the IO buffer.
Definition: fileappender.h:169
void activateOptions(log4cxx::helpers::Pool &p)
int bufferSize
How big should the IO buffer be? Default is 8K.
Definition: fileappender.h:68
LogString getFile() const
Returns the value of the File option.
Definition: fileappender.h:139
bool bufferedIO
Do we do bufferedIO?
Definition: fileappender.h:64
void setAppend(bool fileAppend1)
The Append option takes a boolean value.
LogString fileName
The name of the log file.
Definition: fileappender.h:60
bool fileAppend
Append to or truncate the file? The default value for this variable is true, meaning that by default ...
Definition: fileappender.h:56
void setBufferSize(int bufferSize1)
Set the size of the IO buffer.
Definition: fileappender.h:200
static LogString stripDuplicateBackslashes(const LogString &name)
Replaces double backslashes with single backslashes for compatibility with paths from earlier XML con...
void setFileInternal(const LogString &file)
void setFileInternal(const LogString &file, bool append, bool bufferedIO, size_t bufferSize, log4cxx::helpers::Pool &p)
Sets and opens the file where the log output will go.
bool getBufferedIO() const
Get the value of the BufferedIO option.
Definition: fileappender.h:161
void activateOptionsInternal(log4cxx::helpers::Pool &p)
void setOption(const LogString &option, const LogString &value)
Set option to value.
void setBufferedIO(bool bufferedIO)
The BufferedIO option takes a boolean value.
WriterAppender appends log events to a standard output stream.
Definition: writerappender.h:43
Definition: pool.h:33
Definition: messagehandler.h:23
std::basic_string< logchar > LogString
Definition: logstring.h:66
std::shared_ptr< Layout > LayoutPtr
Definition: appender.h:48
LOG4CXX_PTR_DEF(Appender)
#define LOG4CXX_CAST_ENTRY(Interface)
Definition: object.h:153
#define END_LOG4CXX_CAST_MAP()
Definition: object.h:147
#define DECLARE_LOG4CXX_OBJECT(object)
Definition: object.h:39
#define LOG4CXX_CAST_ENTRY_CHAIN(Interface)
Definition: object.h:159
#define BEGIN_LOG4CXX_CAST_MAP()
Definition: object.h:141