Ignore debug log for now.

This commit is contained in:
Gunnar Beutner 2012-06-20 10:46:18 +02:00
parent 35479407a9
commit 468a0ad5b2
4 changed files with 25 additions and 14 deletions

View File

@ -299,6 +299,10 @@ void Application::Log(LogSeverity severity, const string& facility, const string
{ {
char timestamp[100]; char timestamp[100];
// TODO: make this configurable
if (severity < LogInformation)
return;
string severityStr; string severityStr;
switch (severity) { switch (severity) {
case LogDebug: case LogDebug:

View File

@ -18,7 +18,7 @@ public:
typedef shared_ptr<ThreadPool> Ptr; typedef shared_ptr<ThreadPool> Ptr;
typedef weak_ptr<ThreadPool> WeakPtr; typedef weak_ptr<ThreadPool> WeakPtr;
ThreadPool(long numThreads = 128); ThreadPool(long maxThreads = 128);
~ThreadPool(void); ~ThreadPool(void);
static ThreadPool::Ptr GetDefaultPool(void); static ThreadPool::Ptr GetDefaultPool(void);

View File

@ -76,7 +76,7 @@ void CheckerComponent::CheckTimerHandler(void)
m_Services.pop(); m_Services.pop();
// Application::Log(LogInformation, "checker", "Executing service check for '" + service.GetName() + "'"); Application::Log(LogDebug, "checker", "Executing service check for '" + service.GetName() + "'");
CheckTask::Ptr task = CheckTask::CreateTask(service); CheckTask::Ptr task = CheckTask::CreateTask(service);
task->Enqueue(); task->Enqueue();
@ -90,7 +90,7 @@ void CheckerComponent::CheckTimerHandler(void)
stringstream msgbuf; stringstream msgbuf;
msgbuf << "CheckTimerHandler: created " << tasks << " tasks"; msgbuf << "CheckTimerHandler: created " << tasks << " tasks";
Application::Log(LogDebug, "checker", msgbuf.str()); Application::Log(LogInformation, "checker", msgbuf.str());
} }
void CheckerComponent::ResultTimerHandler(void) void CheckerComponent::ResultTimerHandler(void)
@ -100,7 +100,7 @@ void CheckerComponent::ResultTimerHandler(void)
time_t now; time_t now;
time(&now); time(&now);
long min_latency = -1, max_latency = 0, avg_latency = 0, results = 0; long min_latency = -1, max_latency = 0, avg_latency = 0, results = 0, failed = 0;
vector<CheckTask::Ptr> finishedTasks = CheckTask::GetFinishedTasks(); vector<CheckTask::Ptr> finishedTasks = CheckTask::GetFinishedTasks();
@ -110,7 +110,7 @@ void CheckerComponent::ResultTimerHandler(void)
Service service = task->GetService(); Service service = task->GetService();
CheckResult result = task->GetResult(); CheckResult result = task->GetResult();
// Application::Log(LogInformation, "checker", "Got result! Plugin output: " + result.Output); Application::Log(LogDebug, "checker", "Got result for service '" + service.GetName() + "'");
long latency = result.EndTime - result.StartTime; long latency = result.EndTime - result.StartTime;
avg_latency += latency; avg_latency += latency;
@ -123,13 +123,16 @@ void CheckerComponent::ResultTimerHandler(void)
results++; results++;
if (result.State != StateOK)
failed++;
service.SetNextCheck(now + service.GetCheckInterval()); service.SetNextCheck(now + service.GetCheckInterval());
m_Services.push(service); m_Services.push(service);
} }
stringstream msgbuf; stringstream msgbuf;
msgbuf << "ResultTimerHandler: " << results << " results; latency: avg=" << avg_latency / (results ? results : 1) << ", min=" << min_latency << ", max: " << max_latency; msgbuf << "ResultTimerHandler: " << results << " results (" << failed << " failed); latency: avg=" << avg_latency / (results ? results : 1) << ", min=" << min_latency << ", max: " << max_latency;
Application::Log(LogDebug, "checker", msgbuf.str()); Application::Log(LogInformation, "checker", msgbuf.str());
} }
void CheckerComponent::AssignServiceRequestHandler(const Endpoint::Ptr& sender, const RequestMessage& request) void CheckerComponent::AssignServiceRequestHandler(const Endpoint::Ptr& sender, const RequestMessage& request)
@ -146,7 +149,7 @@ void CheckerComponent::AssignServiceRequestHandler(const Endpoint::Ptr& sender,
Service service(object); Service service(object);
m_Services.push(service); m_Services.push(service);
Application::Log(LogInformation, "checker", "Accepted delegation for service '" + service.GetName() + "'"); Application::Log(LogDebug, "checker", "Accepted delegation for service '" + service.GetName() + "'");
/* force a service check */ /* force a service check */
m_CheckTimer->Reschedule(0); m_CheckTimer->Reschedule(0);
@ -189,7 +192,7 @@ void CheckerComponent::RevokeServiceRequestHandler(const Endpoint::Ptr& sender,
for (it = services.begin(); it != services.end(); it++) for (it = services.begin(); it != services.end(); it++)
m_Services.push(*it); m_Services.push(*it);
Application::Log(LogInformation, "checker", "Revoked delegation for service '" + name + "'"); Application::Log(LogDebug, "checker", "Revoked delegation for service '" + name + "'");
string id; string id;
if (request.GetID(&id)) { if (request.GetID(&id)) {
@ -204,7 +207,7 @@ void CheckerComponent::RevokeServiceRequestHandler(const Endpoint::Ptr& sender,
void CheckerComponent::ClearServicesRequestHandler(const Endpoint::Ptr& sender, const RequestMessage& request) void CheckerComponent::ClearServicesRequestHandler(const Endpoint::Ptr& sender, const RequestMessage& request)
{ {
Application::Log(LogInformation, "checker", "Clearing service delegations."); Application::Log(LogDebug, "checker", "Clearing service delegations.");
m_Services = ServiceQueue(); m_Services = ServiceQueue();
string id; string id;

View File

@ -72,7 +72,7 @@ void DelegationComponent::AssignService(const Service& service)
params.SetProperty("service", service.GetConfigObject()->GetProperties()); params.SetProperty("service", service.GetConfigObject()->GetProperties());
request.SetParams(params); request.SetParams(params);
Application::Log(LogInformation, "delegation", "Trying to delegate service '" + service.GetName() + "'"); Application::Log(LogDebug, "delegation", "Trying to delegate service '" + service.GetName() + "'");
GetEndpointManager()->SendAPIMessage(m_DelegationEndpoint, request, GetEndpointManager()->SendAPIMessage(m_DelegationEndpoint, request,
boost::bind(&DelegationComponent::AssignServiceResponseHandler, this, service, _2, _5)); boost::bind(&DelegationComponent::AssignServiceResponseHandler, this, service, _2, _5));
@ -81,10 +81,10 @@ void DelegationComponent::AssignService(const Service& service)
void DelegationComponent::AssignServiceResponseHandler(Service& service, const Endpoint::Ptr& sender, bool timedOut) void DelegationComponent::AssignServiceResponseHandler(Service& service, const Endpoint::Ptr& sender, bool timedOut)
{ {
if (timedOut) { if (timedOut) {
Application::Log(LogInformation, "delegation", "Service delegation for service '" + service.GetName() + "' timed out."); Application::Log(LogDebug, "delegation", "Service delegation for service '" + service.GetName() + "' timed out.");
} else { } else {
service.SetChecker(sender->GetIdentity()); service.SetChecker(sender->GetIdentity());
Application::Log(LogInformation, "delegation", "Service delegation for service '" + service.GetName() + "' was successful."); Application::Log(LogDebug, "delegation", "Service delegation for service '" + service.GetName() + "' was successful.");
} }
} }
@ -100,6 +100,7 @@ void DelegationComponent::RevokeServiceResponseHandler(Service& service, const E
void DelegationComponent::DelegationTimerHandler(void) void DelegationComponent::DelegationTimerHandler(void)
{ {
ConfigObject::Set::Iterator it; ConfigObject::Set::Iterator it;
long delegated = 0;
for (it = m_AllServices->Begin(); it != m_AllServices->End(); it++) { for (it = m_AllServices->Begin(); it != m_AllServices->End(); it++) {
Service service = *it; Service service = *it;
@ -108,9 +109,12 @@ void DelegationComponent::DelegationTimerHandler(void)
continue; continue;
AssignService(service); AssignService(service);
delegated++;
} }
m_DelegationTimer->Stop(); stringstream msgbuf;
msgbuf << "Delegated " << delegated << " services";
Application::Log(LogInformation, "delegation", msgbuf.str());
} }
EXPORT_COMPONENT(delegation, DelegationComponent); EXPORT_COMPONENT(delegation, DelegationComponent);