Commit fab5488b authored by Scott Cantor's avatar Scott Cantor
Browse files

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.
parent 973472e6
......@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment