@@ -42,10 +42,11 @@ to prevent undefined behaviour when using this appender.
42
42
43
43
This appender is useful when outputting to a slow event sink,
44
44
for example, a remote SMTP server or a database.
45
- Attaching a FileAppender to AsyncAppender
46
- to reduce logging overhead is not recommended
45
+ Note that configuring a FileAppender to use [buffered output](@ref log4cxx::FileAppender::setOption)
46
+ usually results in lower overhead than
47
+ attaching the FileAppender to an AsyncAppender
47
48
as the inter-thread communication overhead
48
- can exceed the time to write directly to a file .
49
+ can exceed the time to add a message to a buffer .
49
50
50
51
You can attach multiple appenders to an AsyncAppender by:
51
52
- calling AsyncAppender::addAppender repeatedly when progammatically configuring Log4cxx.
@@ -58,13 +59,13 @@ Here is a sample configuration file:
58
59
59
60
### Configurable properties
60
61
61
- When the application produces logging events faster
62
+ \anchor BlockingProperty When the application produces logging events faster
62
63
than the background thread is able to process,
63
64
the bounded buffer can become full.
64
65
In this situation AsyncAppender will either
65
66
block until the bounded buffer has a free slot or
66
67
discard the event.
67
- The <b> Blocking</b> property controls which behaviour is used.
68
+ The [ Blocking property](@ref AsyncAppender::setOption) controls which behaviour is used.
68
69
When events are discarded,
69
70
the logged output will indicate this
70
71
with a log message prefixed with <i>Discarded</i>.
@@ -100,7 +101,7 @@ class LOG4CXX_EXPORT AsyncAppender :
100
101
AsyncAppender ();
101
102
102
103
/* *
103
- * Destructor .
104
+ * If not closed, calls AsyncAppender::close .
104
105
*/
105
106
virtual ~AsyncAppender ();
106
107
@@ -112,9 +113,17 @@ class LOG4CXX_EXPORT AsyncAppender :
112
113
*/
113
114
void addAppender (const AppenderPtr newAppender) override ;
114
115
116
+ /* *
117
+ * Call AppenderSkeleton#doAppendImpl without acquiring a lock.
118
+ */
115
119
void doAppend (const spi::LoggingEventPtr& event,
116
120
helpers::Pool& pool1) override ;
117
121
122
+ /* *
123
+ * Add \c event to a ring buffer.
124
+ * The behaviour when the ring buffer is full
125
+ * is controlled by the [Blocking property](@ref BlockingProperty) value.
126
+ */
118
127
void append (const spi::LoggingEventPtr& event, helpers::Pool& p) override ;
119
128
120
129
/* *
@@ -149,6 +158,8 @@ class LOG4CXX_EXPORT AsyncAppender :
149
158
*/
150
159
bool isAttached (const AppenderPtr appender) const override ;
151
160
161
+ /* * Return false
162
+ */
152
163
bool requiresLayout () const override ;
153
164
154
165
/* *
0 commit comments