You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by sw...@apache.org on 2026/03/29 01:59:36 UTC

(logging-log4cxx) branch async_appender_buffer_resize created (now e0767337)

This is an automated email from the ASF dual-hosted git repository.

swebb2066 pushed a change to branch async_appender_buffer_resize
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git


      at e0767337 Prevent AsyncAppender buffer size change while active

This branch includes the following new commits:

     new e0767337 Prevent AsyncAppender buffer size change while active

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(logging-log4cxx) 01/01: Prevent AsyncAppender buffer size change while active

Posted by sw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

swebb2066 pushed a commit to branch async_appender_buffer_resize
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git

commit e076733799144c07cdb37605e482dbdace92ca67
Author: Stephen Webb <sw...@gmail.com>
AuthorDate: Sun Mar 29 12:58:55 2026 +1100

    Prevent AsyncAppender buffer size change while active
---
 src/main/cpp/asyncappender.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/main/cpp/asyncappender.cpp b/src/main/cpp/asyncappender.cpp
index 3ba0dd01..b0ebc0f4 100644
--- a/src/main/cpp/asyncappender.cpp
+++ b/src/main/cpp/asyncappender.cpp
@@ -519,6 +519,10 @@ void AsyncAppender::setBufferSize(int size)
 	}
 
 	std::lock_guard<std::mutex> lock(priv->bufferMutex);
+	if (0 < priv->eventCount)
+	{
+		throw RuntimeException(LOG4CXX_STR("AsyncAppender buffer size cannot be changed now"));
+	}
 	priv->bufferSize = (size < 1) ? 1 : size;
 	priv->buffer.resize(priv->bufferSize);
 	priv->bufferNotFull.notify_all();