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 <[email protected]>
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();

Reply via email to