Apache Log4cxx  Version 1.3.0
Loading...
Searching...
No Matches
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
27namespace LOG4CXX_NS
28{
29namespace helpers
30{
31class Pool;
32}
33
41class 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
113
123 void activateOptions(helpers::Pool& p) override;
124
143 void setOption(const LogString& option, const LogString& value) override;
144
152 bool getBufferedIO() const;
153
157 int getBufferSize() const;
158
169 void setAppend(bool fileAppend1);
170
180 void setBufferedIO(bool bufferedIO);
181
185 void setBufferSize(int bufferSize1);
186
194
195 protected:
196 void activateOptionsInternal(LOG4CXX_NS::helpers::Pool& p);
197
218 void setFileInternal(const LogString& file, bool append,
219 bool bufferedIO, size_t bufferSize,
220 LOG4CXX_NS::helpers::Pool& p);
221
222 void setFileInternal(const LogString& file);
223
224 private:
226 FileAppender& operator=(const FileAppender&);
227 protected:
228 FileAppender(std::unique_ptr<FileAppenderPriv> priv);
229
230}; // class FileAppender
232
233} // namespace log4cxx
234
235#endif
FileAppender appends log events to a file.
Definition fileappender.h:42
void setOption(const LogString &option, const LogString &value) override
Set option to value.
int getBufferSize() const
Get the size of the IO buffer.
LogString getFile() const
Returns the value of the File option.
void setAppend(bool fileAppend1)
The Append option takes a boolean value.
void setBufferSize(int bufferSize1)
Set the size of the IO buffer.
static LogString stripDuplicateBackslashes(const LogString &name)
Replaces double backslashes with single backslashes for compatibility with paths from earlier XML con...
void activateOptions(helpers::Pool &p) override
Activate the options that were previously set with calls to option setters.
FileAppender()
The default constructor does not do anything.
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.
void activateOptionsInternal(log4cxx::helpers::Pool &p)
bool getAppend() const
Returns the value of the Append option.
virtual void setFile(const LogString &file)
The File property takes a string value which should be the name of the file to append to.
void setBufferedIO(bool bufferedIO)
The BufferedIO option takes a boolean value.
void append(const spi::LoggingEventPtr &event, helpers::Pool &p) override
This method is called by the AppenderSkeleton::doAppend method.
WriterAppender()
This default constructor does nothing.
Definition propertysetter.h:27
std::basic_string< logchar > LogString
Definition logstring.h:60
std::shared_ptr< Layout > LayoutPtr
Definition appender.h:42
LOG4CXX_PTR_DEF(Appender)
#define LOG4CXX_CAST_ENTRY(Interface)
Definition object.h:158
#define END_LOG4CXX_CAST_MAP()
Definition object.h:152
#define DECLARE_LOG4CXX_OBJECT(object)
Definition object.h:43
#define LOG4CXX_CAST_ENTRY_CHAIN(Interface)
Definition object.h:164
#define BEGIN_LOG4CXX_CAST_MAP()
Definition object.h:146