diff --git a/lib/config/applyrule.cpp b/lib/config/applyrule.cpp index c8f012e23..7bbb8d7e0 100644 --- a/lib/config/applyrule.cpp +++ b/lib/config/applyrule.cpp @@ -158,11 +158,11 @@ std::vector& ApplyRule::GetRules(const String& type) return it->second; } -void ApplyRule::CheckMatches() +void ApplyRule::CheckMatches(bool silent) { for (const RuleMap::value_type& kv : m_Rules) { for (const ApplyRule& rule : kv.second) { - if (!rule.HasMatches()) + if (!rule.HasMatches() && !silent) Log(LogWarning, "ApplyRule") << "Apply rule '" << rule.GetName() << "' (" << rule.GetDebugInfo() << ") for type '" << kv.first << "' does not match anywhere!"; } diff --git a/lib/config/applyrule.hpp b/lib/config/applyrule.hpp index 91623df75..b57d6c565 100644 --- a/lib/config/applyrule.hpp +++ b/lib/config/applyrule.hpp @@ -62,7 +62,7 @@ public: static bool IsValidTargetType(const String& sourceType, const String& targetType); static std::vector GetTargetTypes(const String& sourceType); - static void CheckMatches(); + static void CheckMatches(bool silent); private: String m_TargetType; diff --git a/lib/config/configitem.cpp b/lib/config/configitem.cpp index f435c9481..503491b52 100644 --- a/lib/config/configitem.cpp +++ b/lib/config/configitem.cpp @@ -618,7 +618,7 @@ bool ConfigItem::CommitItems(const ActivationContext::Ptr& context, WorkQueue& u return false; } - ApplyRule::CheckMatches(); + ApplyRule::CheckMatches(silent); if (!silent) { /* log stats for external parsers */ diff --git a/lib/remote/configobjectutility.cpp b/lib/remote/configobjectutility.cpp index fff206328..7feb9e84f 100644 --- a/lib/remote/configobjectutility.cpp +++ b/lib/remote/configobjectutility.cpp @@ -143,7 +143,8 @@ bool ConfigObjectUtility::CreateObject(const Type::Ptr& type, const String& full std::vector newItems; - if (!ConfigItem::CommitItems(ascope.GetContext(), upq, newItems) || !ConfigItem::ActivateItems(upq, newItems, true)) { + /* Disable logging for object creation, but do so ourselves later on. */ + if (!ConfigItem::CommitItems(ascope.GetContext(), upq, newItems, true) || !ConfigItem::ActivateItems(upq, newItems, true, true)) { if (errors) { if (unlink(path.CStr()) < 0 && errno != ENOENT) { BOOST_THROW_EXCEPTION(posix_error() @@ -164,6 +165,10 @@ bool ConfigObjectUtility::CreateObject(const Type::Ptr& type, const String& full } ApiListener::UpdateObjectAuthority(); + + Log(LogInformation, "ConfigObjectUtility") + << "Created and activated object '" << fullName << "' of type '" << type->GetName() << "'."; + } catch (const std::exception& ex) { if (unlink(path.CStr()) < 0 && errno != ENOENT) { BOOST_THROW_EXCEPTION(posix_error()