Apache Log4cxx Version 1.0.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
23#include <deque>
25#include <thread>
26#include <condition_variable>
27
28#if defined(NON_BLOCKING)
29 #include <boost/lockfree/queue.hpp>
30#endif
31
32namespace log4cxx
33{
35
50class LOG4CXX_EXPORT AsyncAppender :
51 public virtual spi::AppenderAttachable,
52 public virtual AppenderSkeleton
53{
54 protected:
55 struct AsyncAppenderPriv;
56
57 public:
64
65
69
73 virtual ~AsyncAppender();
74
80 void addAppender(const AppenderPtr newAppender) override;
81
82 void doAppend(const spi::LoggingEventPtr& event,
83 helpers::Pool& pool1) override;
84
85 void append(const spi::LoggingEventPtr& event, helpers::Pool& p) override;
86
92 void close() override;
93
98 AppenderList getAllAppenders() const override;
99
106 AppenderPtr getAppender(const LogString& name) const override;
107
114 bool getLocationInfo() const;
120 bool isAttached(const AppenderPtr appender) const override;
121
122 bool requiresLayout() const override;
123
127 void removeAllAppenders() override;
128
133 void removeAppender(const AppenderPtr appender) override;
138 void removeAppender(const LogString& name) override;
139
145 void setLocationInfo(bool flag);
146
152 void setBufferSize(int size);
153
158 int getBufferSize() const;
159
166 void setBlocking(bool value);
167
175 bool getBlocking() const;
176
177
183 void setOption(const LogString& option, const LogString& value) override;
184
185
186 private:
188 AsyncAppender& operator=(const AsyncAppender&);
189
193 void dispatch();
194
195}; // class AsyncAppender
196LOG4CXX_PTR_DEF(AsyncAppender);
197} // namespace log4cxx
198
199#endif// _LOG4CXX_ASYNC_APPENDER_H
200
Implementation base class for all appenders.
Definition: appenderskeleton.h:41
The AsyncAppender lets users log events asynchronously.
Definition: asyncappender.h:53
This Interface is for attaching Appenders to objects.
Definition: appenderattachable.h:34
std::shared_ptr< LoggingEvent > LoggingEventPtr
Definition: appender.h:32
Definition: configuration.h:25
LOG4CXX_LIST_DEF(AppenderList, AppenderPtr)
std::basic_string< logchar > LogString
Definition: logstring.h:60
std::shared_ptr< Appender > AppenderPtr
Definition: basicconfigurator.h:29
#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