diff --git a/lib/base/configobject.cpp b/lib/base/configobject.cpp index 4317771d1..fee6e4374 100644 --- a/lib/base/configobject.cpp +++ b/lib/base/configobject.cpp @@ -419,6 +419,18 @@ void ConfigObject::OnAllConfigLoaded() if (!zoneName.IsEmpty()) m_Zone = ctype->GetObject(zoneName); + + std::vector toDo {this}; + + do { + auto current (toDo.back()); + + toDo.pop_back(); + + if (m_AllParentsAffectingLogging.emplace(current.get()).second) { + current->GetParentsAffectingLogging(toDo); + } + } while (!toDo.empty()); } void ConfigObject::CreateChildObjects(const Type::Ptr& childType) diff --git a/lib/base/configobject.hpp b/lib/base/configobject.hpp index 559636370..a091c0a3a 100644 --- a/lib/base/configobject.hpp +++ b/lib/base/configobject.hpp @@ -9,6 +9,7 @@ #include "base/type.hpp" #include "base/dictionary.hpp" #include +#include namespace icinga { @@ -81,6 +82,7 @@ public: private: ConfigObject::Ptr m_Zone; + std::set m_AllParentsAffectingLogging; static void RestoreObject(const String& message, int attributeTypes); };