Apache Log4cxx  Version 1.5.0
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 
25 namespace LOG4CXX_NS
26 {
28 
82 class LOG4CXX_EXPORT AsyncAppender :
83  public virtual spi::AppenderAttachable,
84  public virtual AppenderSkeleton
85 {
86  protected:
87  struct AsyncAppenderPriv;
88 
89  public:
96 
97 
101 
105  virtual ~AsyncAppender();
106 
113  void addAppender(const AppenderPtr newAppender) override;
114 
115  void doAppend(const spi::LoggingEventPtr& event,
116  helpers::Pool& pool1) override;
117 
118  void append(const spi::LoggingEventPtr& event, helpers::Pool& p) override;
119 
125  void close() override;
126 
131  AppenderList getAllAppenders() const override;
132 
139  AppenderPtr getAppender(const LogString& name) const override;
140 
144  bool getLocationInfo() const;
150  bool isAttached(const AppenderPtr appender) const override;
151 
152  bool requiresLayout() const override;
153 
157  void removeAllAppenders() override;
158 
163  void removeAppender(const AppenderPtr appender) override;
168  void removeAppender(const LogString& name) override;
169 
174  bool replaceAppender(const AppenderPtr& oldAppender, const AppenderPtr& newAppender) LOG4CXX_16_VIRTUAL_SPECIFIER;
175 
179  void replaceAppenders(const AppenderList& newList) LOG4CXX_16_VIRTUAL_SPECIFIER;
180 
186  void setLocationInfo(bool flag);
187 
193  void setBufferSize(int size);
194 
199  int getBufferSize() const;
200 
207  void setBlocking(bool value);
208 
216  bool getBlocking() const;
217 
218 
229  void setOption(const LogString& option, const LogString& value) override;
230 
231 
232  private:
234  AsyncAppender& operator=(const AsyncAppender&);
235 
239  void dispatch();
240 
241 }; // class AsyncAppender
243 } // namespace log4cxx
244 
245 #endif// _LOG4CXX_ASYNC_APPENDER_H
246 
#define LOG4CXX_16_VIRTUAL_SPECIFIER
Definition: appenderattachable.h:99
Implementation base class for all appenders.
Definition: appenderskeleton.h:41
The AsyncAppender decouples logging event creation from output by processing log events asynchronousl...
Definition: asyncappender.h:85
This Interface is for attaching Appenders to objects.
Definition: appenderattachable.h:33
std::shared_ptr< LoggingEvent > LoggingEventPtr
Definition: appender.h:31
LOG4CXX_LIST_DEF(LoggingEventList, spi::LoggingEventPtr)
LOG4CXX_PTR_DEF(AsyncAppender)
std::basic_string< logchar > LogString
Definition: logstring.h:60
std::shared_ptr< Appender > AppenderPtr
Definition: basicconfigurator.h:28
#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