[cpp-log4shib] 02/02: SSPCPP-712 - Shibd leaks file handles on config reload

Scott Cantor cantor.2 at osu.edu
Mon Apr 16 20:51:38 EDT 2018


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch master
in repository cpp-log4shib.

View the commit online:
http://git.shibboleth.net/view/?p=cpp-log4shib.git;a=commit;h=fab5488bd879d0c4b6e9cee7297bcd923b0611a2

commit fab5488bd879d0c4b6e9cee7297bcd923b0611a2
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Apr 16 20:51:26 2018 -0400

    SSPCPP-712 - Shibd leaks file handles on config reload
    
    https://issues.shibboleth.net/jira/browse/SSPCPP-712
    
    Add a log4j.ownAppenders.<category> log config property.
---
 src/PropertyConfiguratorImpl.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/PropertyConfiguratorImpl.cpp b/src/PropertyConfiguratorImpl.cpp
index 86a9ae6..0acb81c 100644
--- a/src/PropertyConfiguratorImpl.cpp
+++ b/src/PropertyConfiguratorImpl.cpp
@@ -171,6 +171,11 @@ namespace log4shib {
         bool additive = _properties.getBool("additivity." + categoryName, true);
         category.setAdditivity(additive);
 
+        // Hack to assign ownership of related Appenders to this Category
+        // Defaults to true for rootCategory, false otherwise.
+        bool ownAppenders = _properties.getBool("ownAppenders." + categoryName,
+            categoryName == "rootCategory");
+
         category.removeAllAppenders();
         for(/**/; i != iEnd; ++i) {           
             std::string appenderName = StringUtil::trim(*i);
@@ -180,7 +185,7 @@ namespace log4shib {
                 // appender not found;
                 throw ConfigureFailure(std::string("Appender '") +
                     appenderName + "' not found for category '" + categoryName + "'");
-            } else if (categoryName == "rootCategory") {
+            } else if (ownAppenders) {
 
                 /* pass by pointer, i.e. transfer ownership */
                 category.addAppender((*appIt).second);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list