18 #ifndef _LOG4CXX_ASYNC_APPENDER_H 19 #define _LOG4CXX_ASYNC_APPENDER_H 22 #pragma warning ( push ) 23 #pragma warning ( disable: 4231 4251 4275 4786 ) 27 #include <log4cxx/appenderskeleton.h> 28 #include <log4cxx/helpers/appenderattachableimpl.h> 30 #include <log4cxx/spi/loggingevent.h> 31 #include <log4cxx/helpers/thread.h> 32 #include <log4cxx/helpers/mutex.h> 33 #include <log4cxx/helpers/condition.h> 35 #if defined(NON_BLOCKING) 36 #include <boost/lockfree/queue.hpp> 63 BEGIN_LOG4CXX_CAST_MAP()
67 END_LOG4CXX_CAST_MAP()
80 void releaseRef()
const;
105 AppenderList getAllAppenders()
const;
113 AppenderPtr getAppender(
const LogString& name)
const;
121 bool getLocationInfo()
const;
127 bool isAttached(
const AppenderPtr& appender)
const;
129 virtual bool requiresLayout()
const;
134 void removeAllAppenders();
145 void removeAppender(
const LogString& name);
152 void setLocationInfo(
bool flag);
159 void setBufferSize(
int size);
165 int getBufferSize()
const;
173 void setBlocking(
bool value);
182 bool getBlocking()
const;
190 void setOption(
const LogString& option,
const LogString& value);
199 enum { DEFAULT_BUFFER_SIZE = 128 };
204 #if defined(NON_BLOCKING) 205 boost::lockfree::queue<log4cxx::spi::LoggingEvent* > buffer;
206 std::atomic<size_t> discardedCount;
208 LoggingEventList buffer;
214 SHARED_MUTEX bufferMutex;
216 #if defined(NON_BLOCKING) 217 ::log4cxx::helpers::Semaphore bufferNotFull;
218 ::log4cxx::helpers::Semaphore bufferNotEmpty;
242 DiscardSummary(const ::log4cxx::spi::LoggingEventPtr& event);
244 DiscardSummary(
const DiscardSummary& src);
246 DiscardSummary& operator=(
const DiscardSummary& src);
253 void add(const ::log4cxx::spi::LoggingEventPtr& event);
264 size_t discardedCount);
270 typedef std::map<LogString, DiscardSummary> DiscardMap;
271 DiscardMap* discardMap;
281 helpers::AppenderAttachableImplPtr appenders;
301 static void* LOG4CXX_THREAD_FUNC dispatch(apr_thread_t* thread,
void* data);
307 #if defined(_MSC_VER) 308 #pragma warning ( pop ) 312 #endif// _LOG4CXX_ASYNC_APPENDER_H This class implements an approximation of java.util.Thread.
Definition: thread.h:59
Implementation base class for all appenders.
Definition: appenderskeleton.h:45
This Interface is for attaching Appenders to objects.
Definition: appenderattachable.h:39
The AsyncAppender lets users log events asynchronously.
Definition: asyncappender.h:57
This class provides a means for one thread to suspend exception until notified by another thread to r...
Definition: condition.h:39
Definition: appender.h:33