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

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

commit e2ece7da32e784f081a846c0e9384822b07b8964
Author: Stephen Webb <[email protected]>
AuthorDate: Mon Jan 27 14:37:21 2025 +1100

    Support changes to the buffering properties of an active file appender
---
 src/main/cpp/fileappender.cpp | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/main/cpp/fileappender.cpp b/src/main/cpp/fileappender.cpp
index d8a55aca..0ecd3d03 100644
--- a/src/main/cpp/fileappender.cpp
+++ b/src/main/cpp/fileappender.cpp
@@ -192,6 +192,8 @@ void FileAppender::activateOptionsInternal(Pool& p)
        if (errors == 0)
        {
                WriterAppender::activateOptions(p);
+               if (auto p = _priv->taskManager.lock())
+                       p->value().removePeriodicTask(getName());
 
                if (!_priv->bufferedIO)
                        ;
@@ -204,11 +206,6 @@ void FileAppender::activateOptionsInternal(Pool& p)
                                );
                        _priv->taskManager = taskManager;
                }
-               else if (0 == _priv->bufferedSeconds)
-               {
-                       if (auto p = _priv->taskManager.lock())
-                               p->value().removePeriodicTask(getName());
-               }
        }
 }
 

Reply via email to