Apache Log4cxx  Version 1.4.0
Loading...
Searching...
No Matches
asyncappender.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_ASYNC_APPENDER_H
19#define _LOG4CXX_ASYNC_APPENDER_H
20
24
25namespace LOG4CXX_NS
26{
28
65class LOG4CXX_EXPORT AsyncAppender :
66 public virtual spi::AppenderAttachable,
67 public virtual AppenderSkeleton
68{
69 protected:
70 struct AsyncAppenderPriv;
71
72 public:
79
80
84
88 virtual ~AsyncAppender();
89
95 void addAppender(const AppenderPtr newAppender) override;
96
97 void doAppend(const spi::LoggingEventPtr& event,
98 helpers::Pool& pool1) override;
99
100 void append(const spi::LoggingEventPtr& event, helpers::Pool& p) override;
101
107 void close() override;
108
113 AppenderList getAllAppenders() const override;
114
121 AppenderPtr getAppender(const LogString& name) const override;
122
129 bool getLocationInfo() const;
135 bool isAttached(const AppenderPtr appender) const override;
136
137 bool requiresLayout() const override;
138
142 void removeAllAppenders() override;
143
148 void removeAppender(const AppenderPtr appender) override;
153 void removeAppender(const LogString& name) override;
154
160 void setLocationInfo(bool flag);
161
167 void setBufferSize(int size);
168
173 int getBufferSize() const;
174
181 void setBlocking(bool value);
182
190 bool getBlocking() const;
191
192
204 void setOption(const LogString& option, const LogString& value) override;
205
206
207 private:
209 AsyncAppender& operator=(const AsyncAppender&);
210
214 void dispatch();
215
216}; // class AsyncAppender
218} // namespace log4cxx
219
220#endif// _LOG4CXX_ASYNC_APPENDER_H
221
AppenderSkeleton(LOG4CXX_PRIVATE_PTR(AppenderSkeletonPrivate) priv)
The AsyncAppender decouples logging event creation from output by processing log events asynchronousl...
Definition asyncappender.h:68
void setLocationInfo(bool flag)
The LocationInfo attribute is provided for compatibility with log4j and has no effect on the log outp...
AsyncAppender()
Create new instance.
void removeAllAppenders() override
Removes and closes all attached appenders.
void setOption(const LogString &option, const LogString &value) override
Set option to value.
void append(const spi::LoggingEventPtr &event, helpers::Pool &p) override
Subclasses of AppenderSkeleton should implement this method to perform actual logging.
bool requiresLayout() const override
Configurators call this method to determine if the appender requires a layout.
bool getBlocking() const
Gets whether appender should block calling thread when buffer is full.
void setBlocking(bool value)
Sets whether appender should wait if there is no space available in the event buffer or immediately r...
AppenderList getAllAppenders() const override
Get iterator over attached appenders.
void removeAppender(const AppenderPtr appender) override
Removes an appender.
void doAppend(const spi::LoggingEventPtr &event, helpers::Pool &pool1) override
This method performs threshold checks and invokes filters before delegating actual logging to the sub...
AppenderPtr getAppender(const LogString &name) const override
Get appender by name.
void addAppender(const AppenderPtr newAppender) override
Add appender.
int getBufferSize() const
Gets the current buffer size.
void close() override
Close this AsyncAppender by interrupting the dispatcher thread which will process all pending events ...
void setBufferSize(int size)
The BufferSize option takes a non-negative integer value.
bool isAttached(const AppenderPtr appender) const override
Determines if specified appender is attached.
bool getLocationInfo() const
Gets whether the location of the logging request call should be captured.
This Interface is for attaching Appenders to objects.
Definition appenderattachable.h:33
Definition propertysetter.h:27
Definition appender.h:30
std::shared_ptr< LoggingEvent > LoggingEventPtr
Definition appender.h:32
LOG4CXX_LIST_DEF(AppenderList, AppenderPtr)
std::basic_string< logchar > LogString
Definition logstring.h:60
LOG4CXX_PTR_DEF(Appender)
std::shared_ptr< Appender > AppenderPtr
Definition basicconfigurator.h:29
#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