Apache Log4cxx  Version 1.7.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
90class LOG4CXX_EXPORT AsyncAppender :
91 public virtual spi::AppenderAttachable,
92#if LOG4CXX_ABI_VERSION <= 15
93 public virtual AppenderSkeleton
94#else
95 public AppenderSkeleton
96#endif
97{
98 protected:
99 struct AsyncAppenderPriv;
100
101 public:
108
109
113
117 virtual ~AsyncAppender();
118
125 void addAppender(const AppenderPtr newAppender) override;
126
130 void doAppend(const spi::LoggingEventPtr& event,
131 helpers::Pool& pool1) override;
132
138 void append(const spi::LoggingEventPtr& event, helpers::Pool& p) override;
139
145 void close() override;
146
151 AppenderList getAllAppenders() const override;
152
159 AppenderPtr getAppender(const LogString& name) const override;
160
164 bool getLocationInfo() const;
170 bool isAttached(const AppenderPtr appender) const override;
171
174 bool requiresLayout() const override;
175
179 void removeAllAppenders() override;
180
185 void removeAppender(const AppenderPtr appender) override;
190 void removeAppender(const LogString& name) override;
191
196 bool replaceAppender(const AppenderPtr& oldAppender, const AppenderPtr& newAppender) LOG4CXX_16_VIRTUAL_SPECIFIER;
197
201 void replaceAppenders(const AppenderList& newList) LOG4CXX_16_VIRTUAL_SPECIFIER;
202
208 void setLocationInfo(bool flag);
209
215 void setBufferSize(int newSize);
216
221 int getBufferSize() const;
222
229 void setBlocking(bool newValue);
230
238 bool getBlocking() const;
239
240
251 void setOption(const LogString& option, const LogString& value) override;
252
253
254 private:
256 AsyncAppender& operator=(const AsyncAppender&);
257
258}; // class AsyncAppender
260} // namespace log4cxx
261
262#endif// _LOG4CXX_ASYNC_APPENDER_H
263
AppenderSkeleton(LOG4CXX_PRIVATE_PTR(AppenderSkeletonPrivate) priv)
The AsyncAppender decouples logging event creation from output by processing log events asynchronousl...
Definition asyncappender.h:97
void setLocationInfo(bool flag)
The LocationInfo attribute is provided for compatibility with log4j and has no effect on the log outp...
void append(const spi::LoggingEventPtr &event, helpers::Pool &1) override
Add event to a ring buffer.
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.
bool requiresLayout() const override
Return false.
bool getBlocking() const
Gets whether appender should block calling thread when ring buffer is full.
void setBufferSize(int newSize)
Use newSize (a non-negative integer value) for the number of logging events the ring buffer can hold.
void replaceAppenders(const AppenderList &newList) LOG4CXX_16_VIRTUAL_SPECIFIER
Replace any previously added appenders with newList.
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
Call AppenderSkeleton::doAppendImpl without acquiring a lock.
bool replaceAppender(const AppenderPtr &oldAppender, const AppenderPtr &newAppender) LOG4CXX_16_VIRTUAL_SPECIFIER
Replace oldAppender with newAppender.
AppenderPtr getAppender(const LogString &name) const override
Get appender by name.
void addAppender(const AppenderPtr newAppender) override
Ensure newAppender receives any logging event added to this 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 setBlocking(bool newValue)
Use newValue for whether appender should block the calling thread if there is no space in the ring bu...
bool isAttached(const AppenderPtr appender) const override
Determines if specified appender is attached.
bool getLocationInfo() const
The current value of the (unused) LocationInfo option.
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:154
#define END_LOG4CXX_CAST_MAP()
Definition object.h:148
#define DECLARE_LOG4CXX_OBJECT(object)
Definition object.h:41
#define LOG4CXX_CAST_ENTRY_CHAIN(Interface)
Definition object.h:160
#define BEGIN_LOG4CXX_CAST_MAP()
Definition object.h:142
#define LOG4CXX_16_VIRTUAL_SPECIFIER
Definition socket.h:90