diff --git a/lib/base/logger.cpp b/lib/base/logger.cpp index 710c54211..5ad98aa28 100644 --- a/lib/base/logger.cpp +++ b/lib/base/logger.cpp @@ -88,12 +88,12 @@ void icinga::Log(LogSeverity severity, const String& facility, bool processed = false; BOOST_FOREACH(const Logger::Ptr& logger, Logger::GetLoggers()) { - if (!logger->IsActive()) - continue; - { ObjectLock llock(logger); + if (!logger->IsActive()) + continue; + if (entry.Severity >= logger->GetMinSeverity()) logger->ProcessLogEntry(entry); } diff --git a/lib/icinga/timeperiod.cpp b/lib/icinga/timeperiod.cpp index 4b081af79..44ff1dde5 100644 --- a/lib/icinga/timeperiod.cpp +++ b/lib/icinga/timeperiod.cpp @@ -32,17 +32,20 @@ REGISTER_TYPE(TimePeriod); static Timer::Ptr l_UpdateTimer; +INITIALIZE_ONCE(&TimePeriod::StaticInitialize); + +void TimePeriod::StaticInitialize(void) +{ + l_UpdateTimer = make_shared(); + l_UpdateTimer->SetInterval(300); + l_UpdateTimer->OnTimerExpired.connect(boost::bind(&TimePeriod::UpdateTimerHandler)); + l_UpdateTimer->Start(); +} + void TimePeriod::Start(void) { DynamicObject::Start(); - if (!l_UpdateTimer) { - l_UpdateTimer = make_shared(); - l_UpdateTimer->SetInterval(300); - l_UpdateTimer->OnTimerExpired.connect(boost::bind(&TimePeriod::UpdateTimerHandler)); - l_UpdateTimer->Start(); - } - /* Pre-fill the time period for the next 24 hours. */ double now = Utility::GetTime(); UpdateRegion(now, now + 24 * 3600, true); diff --git a/lib/icinga/timeperiod.h b/lib/icinga/timeperiod.h index 8062b5c7d..bdc210b61 100644 --- a/lib/icinga/timeperiod.h +++ b/lib/icinga/timeperiod.h @@ -38,6 +38,8 @@ public: DECLARE_PTR_TYPEDEFS(TimePeriod); DECLARE_TYPENAME(TimePeriod); + static void StaticInitialize(void); + virtual void Start(void); void UpdateRegion(double begin, double end, bool clearExisting);