diff --git a/components/checker/checkercomponent.cpp b/components/checker/checkercomponent.cpp index fb8b70926..abb4ac973 100644 --- a/components/checker/checkercomponent.cpp +++ b/components/checker/checkercomponent.cpp @@ -86,7 +86,7 @@ void CheckerComponent::Start(void) void CheckerComponent::Stop(void) { - Log(LogInformation, "checker", "Checker stopped."); + Log(LogInformation, "CheckerComponent", "Checker stopped."); { boost::mutex::scoped_lock lock(m_Mutex); @@ -135,7 +135,7 @@ void CheckerComponent::CheckThreadProc(void) if (!forced) { if (!checkable->IsReachable(DependencyCheckExecution)) { - Log(LogNotice, "icinga", "Skipping check for object '" + checkable->GetName() + "': Dependency failed."); + Log(LogNotice, "CheckerComponent", "Skipping check for object '" + checkable->GetName() + "': Dependency failed."); check = false; } @@ -144,18 +144,18 @@ void CheckerComponent::CheckThreadProc(void) tie(host, service) = GetHostService(checkable); if (host && !service && (!checkable->GetEnableActiveChecks() || !IcingaApplication::GetInstance()->GetEnableHostChecks())) { - Log(LogNotice, "checker", "Skipping check for host '" + host->GetName() + "': active host checks are disabled"); + Log(LogNotice, "CheckerComponent", "Skipping check for host '" + host->GetName() + "': active host checks are disabled"); check = false; } if (host && service && (!checkable->GetEnableActiveChecks() || !IcingaApplication::GetInstance()->GetEnableServiceChecks())) { - Log(LogNotice, "checker", "Skipping check for service '" + service->GetName() + "': active service checks are disabled"); + Log(LogNotice, "CheckerComponent", "Skipping check for service '" + service->GetName() + "': active service checks are disabled"); check = false; } TimePeriod::Ptr tp = checkable->GetCheckPeriod(); if (tp && !tp->IsInside(Utility::GetTime())) { - Log(LogNotice, "checker", "Skipping check for object '" + checkable->GetName() + "': not in check_period"); + Log(LogNotice, "CheckerComponent", "Skipping check for object '" + checkable->GetName() + "': not in check_period"); check = false; } } @@ -181,7 +181,7 @@ void CheckerComponent::CheckThreadProc(void) checkable->SetForceNextCheck(false); } - Log(LogDebug, "checker", "Executing check for '" + checkable->GetName() + "'"); + Log(LogDebug, "CheckerComponent", "Executing check for '" + checkable->GetName() + "'"); CheckerComponent::Ptr self = GetSelf(); Utility::QueueAsyncCallback(boost::bind(&CheckerComponent::ExecuteCheckHelper, self, checkable)); @@ -230,7 +230,7 @@ void CheckerComponent::ExecuteCheckHelper(const Checkable::Ptr& checkable) } } - Log(LogDebug, "checker", "Check finished for object '" + checkable->GetName() + "'"); + Log(LogDebug, "CheckerComponent", "Check finished for object '" + checkable->GetName() + "'"); } void CheckerComponent::ResultTimerHandler(void) @@ -244,7 +244,7 @@ void CheckerComponent::ResultTimerHandler(void) << (CIB::GetActiveHostChecksStatistics(5) + CIB::GetActiveServiceChecksStatistics(5)) / 5.0; } - Log(LogNotice, "checker", msgbuf.str()); + Log(LogNotice, "CheckerComponent", msgbuf.str()); } void CheckerComponent::ObjectHandler(const DynamicObject::Ptr& object) diff --git a/components/compat/checkresultreader.cpp b/components/compat/checkresultreader.cpp index 095b9b8dc..d9d9a198d 100644 --- a/components/compat/checkresultreader.cpp +++ b/components/compat/checkresultreader.cpp @@ -118,7 +118,7 @@ void CheckResultReader::ProcessCheckResultFile(const String& path) const Host::Ptr host = Host::GetByName(attrs["host_name"]); if (!host) { - Log(LogWarning, "compat", "Ignoring checkresult file for host '" + attrs["host_name"] + + Log(LogWarning, "CheckResultReader", "Ignoring checkresult file for host '" + attrs["host_name"] + "': Host does not exist."); return; @@ -127,7 +127,7 @@ void CheckResultReader::ProcessCheckResultFile(const String& path) const Service::Ptr service = host->GetServiceByShortName(attrs["service_description"]); if (!service) { - Log(LogWarning, "compat", "Ignoring checkresult file for host '" + attrs["host_name"] + + Log(LogWarning, "CheckResultReader", "Ignoring checkresult file for host '" + attrs["host_name"] + "', service '" + attrs["service_description"] + "': Service does not exist."); return; @@ -143,7 +143,7 @@ void CheckResultReader::ProcessCheckResultFile(const String& path) const service->ProcessCheckResult(result); - Log(LogDebug, "compat", "Processed checkresult file for host '" + attrs["host_name"] + + Log(LogDebug, "CheckResultReader", "Processed checkresult file for host '" + attrs["host_name"] + "', service '" + attrs["service_description"] + "'"); { diff --git a/components/compat/compatlogger.cpp b/components/compat/compatlogger.cpp index d610af96e..de9ef7564 100644 --- a/components/compat/compatlogger.cpp +++ b/components/compat/compatlogger.cpp @@ -321,7 +321,7 @@ void CompatLogger::FlappingHandler(const Checkable::Ptr& checkable, FlappingStat flapping_state_str = "DISABLED"; break; default: - Log(LogCritical, "compat", "Unknown flapping state: " + Convert::ToString(flapping_state)); + Log(LogCritical, "CompatLogger", "Unknown flapping state: " + Convert::ToString(flapping_state)); return; } @@ -434,7 +434,7 @@ void CompatLogger::ReopenFile(bool rotate) if (rotate) { String archiveFile = GetLogDir() + "/archives/icinga-" + Utility::FormatDateTime("%m-%d-%Y-%H", Utility::GetTime()) + ".log"; - Log(LogNotice, "compat", "Rotating compat log file '" + tempFile + "' -> '" + archiveFile + "'"); + Log(LogNotice, "CompatLogger", "Rotating compat log file '" + tempFile + "' -> '" + archiveFile + "'"); (void) rename(tempFile.CStr(), archiveFile.CStr()); } } @@ -442,7 +442,7 @@ void CompatLogger::ReopenFile(bool rotate) m_OutputFile.open(tempFile.CStr(), std::ofstream::app); if (!m_OutputFile.good()) { - Log(LogWarning, "icinga", "Could not open compat log file '" + tempFile + "' for writing. Log output will be lost."); + Log(LogWarning, "CompatLogger", "Could not open compat log file '" + tempFile + "' for writing. Log output will be lost."); return; } @@ -536,7 +536,7 @@ void CompatLogger::ScheduleNextRotation(void) time_t ts = mktime(&tmthen); - Log(LogNotice, "compat", "Rescheduling rotation timer for compat log '" + Log(LogNotice, "CompatLogger", "Rescheduling rotation timer for compat log '" + GetName() + "' to '" + Utility::FormatDateTime("%Y/%m/%d %H:%M:%S %z", ts) + "'"); m_RotationTimer->Reschedule(ts); } diff --git a/components/compat/externalcommandlistener.cpp b/components/compat/externalcommandlistener.cpp index 8308281b1..eb9deb85a 100644 --- a/components/compat/externalcommandlistener.cpp +++ b/components/compat/externalcommandlistener.cpp @@ -130,13 +130,13 @@ void ExternalCommandListener::CommandPipeThread(const String& commandPath) String command = line; try { - Log(LogInformation, "compat", "Executing external command: " + command); + Log(LogInformation, "ExternalCommandListener", "Executing external command: " + command); ExternalCommandProcessor::Execute(command); } catch (const std::exception& ex) { std::ostringstream msgbuf; msgbuf << "External command failed: " << DiagnosticInformation(ex); - Log(LogWarning, "compat", msgbuf.str()); + Log(LogWarning, "ExternalCommandListener", msgbuf.str()); } } diff --git a/components/compat/statusdatawriter.cpp b/components/compat/statusdatawriter.cpp index e23842344..5e9687872 100644 --- a/components/compat/statusdatawriter.cpp +++ b/components/compat/statusdatawriter.cpp @@ -693,7 +693,7 @@ void StatusDataWriter::UpdateObjectsCache(void) Checkable::Ptr parent = dep->GetParent(); if (!parent) { - Log(LogDebug, "compat", "Missing parent for dependency '" + dep->GetName() + "'."); + Log(LogDebug, "StatusDataWriter", "Missing parent for dependency '" + dep->GetName() + "'."); continue; } @@ -705,7 +705,7 @@ void StatusDataWriter::UpdateObjectsCache(void) if (!child) { continue; - Log(LogDebug, "compat", "Missing child for dependency '" + dep->GetName() + "'."); + Log(LogDebug, "StatusDataWriter", "Missing child for dependency '" + dep->GetName() + "'."); } Host::Ptr child_host; @@ -840,5 +840,5 @@ void StatusDataWriter::StatusTimerHandler(void) << boost::errinfo_file_name(statuspathtmp)); } - Log(LogNotice, "compat", "Writing status.dat file took " + Utility::FormatDuration(Utility::GetTime() - start)); + Log(LogNotice, "StatusDataWriter", "Writing status.dat file took " + Utility::FormatDuration(Utility::GetTime() - start)); } diff --git a/components/db_ido_mysql/idomysqlconnection.cpp b/components/db_ido_mysql/idomysqlconnection.cpp index bc5443a34..7bacf3f53 100644 --- a/components/db_ido_mysql/idomysqlconnection.cpp +++ b/components/db_ido_mysql/idomysqlconnection.cpp @@ -94,7 +94,7 @@ void IdoMysqlConnection::Pause(void) void IdoMysqlConnection::ExceptionHandler(boost::exception_ptr exp) { - Log(LogWarning, "db_ido_mysql", "Exception during database operation: " + DiagnosticInformation(exp)); + Log(LogWarning, "IdoMysqlConnection", "Exception during database operation: " + DiagnosticInformation(exp)); boost::mutex::scoped_lock lock(m_ConnectionMutex); @@ -228,7 +228,7 @@ void IdoMysqlConnection::Reconnect(void) std::ostringstream msgbuf; msgbuf << "MySQL IDO instance id: " << static_cast(m_InstanceID) << " (schema version: '" + version + "')"; - Log(LogInformation, "db_ido_mysql", msgbuf.str()); + Log(LogInformation, "IdoMysqlConnection", msgbuf.str()); /* set session time zone to utc */ Query("SET SESSION TIME_ZONE='+00:00'"); @@ -268,7 +268,7 @@ void IdoMysqlConnection::Reconnect(void) /* deactivate all deleted configuration objects */ BOOST_FOREACH(const DbObject::Ptr& dbobj, active_dbobjs) { if (dbobj->GetObject() == NULL) { - Log(LogNotice, "db_ido", "Deactivate deleted object name1: '" + Convert::ToString(dbobj->GetName1() + + Log(LogNotice, "IdoMysqlConnection", "Deactivate deleted object name1: '" + Convert::ToString(dbobj->GetName1() + "' name2: '" + Convert::ToString(dbobj->GetName2() + "'."))); DeactivateObject(dbobj); } @@ -284,7 +284,7 @@ IdoMysqlResult IdoMysqlConnection::Query(const String& query) { AssertOnWorkQueue(); - Log(LogDebug, "db_ido_mysql", "Query: " + query); + Log(LogDebug, "IdoMysqlConnection", "Query: " + query); if (mysql_query(&m_Connection, query.CStr()) != 0) BOOST_THROW_EXCEPTION( @@ -619,7 +619,7 @@ void IdoMysqlConnection::InternalExecuteQuery(const DbQuery& query, DbQueryType if (type == DbQueryInsert && query.Table == "notifications" && query.NotificationObject) { // FIXME remove hardcoded table name SetNotificationInsertID(query.NotificationObject, GetLastInsertID()); - Log(LogDebug, "db_ido", "saving contactnotification notification_id=" + Convert::ToString(static_cast(GetLastInsertID()))); + Log(LogDebug, "IdoMysqlConnection", "saving contactnotification notification_id=" + Convert::ToString(static_cast(GetLastInsertID()))); } } diff --git a/components/db_ido_pgsql/idopgsqlconnection.cpp b/components/db_ido_pgsql/idopgsqlconnection.cpp index fe192c67e..d9fe92ad1 100644 --- a/components/db_ido_pgsql/idopgsqlconnection.cpp +++ b/components/db_ido_pgsql/idopgsqlconnection.cpp @@ -96,7 +96,7 @@ void IdoPgsqlConnection::Pause(void) void IdoPgsqlConnection::ExceptionHandler(boost::exception_ptr exp) { - Log(LogWarning, "db_ido_pgsql", "Exception during database operation: " + DiagnosticInformation(exp)); + Log(LogWarning, "IdoPgsqlConnection", "Exception during database operation: " + DiagnosticInformation(exp)); boost::mutex::scoped_lock lock(m_ConnectionMutex); @@ -232,7 +232,7 @@ void IdoPgsqlConnection::Reconnect(void) std::ostringstream msgbuf; msgbuf << "pgSQL IDO instance id: " << static_cast(m_InstanceID) << " (schema version: '" + version + "')"; - Log(LogInformation, "db_ido_pgsql", msgbuf.str()); + Log(LogInformation, "IdoPgsqlConnection", msgbuf.str()); /* record connection */ Query("INSERT INTO " + GetTablePrefix() + "conninfo " + @@ -272,7 +272,7 @@ void IdoPgsqlConnection::Reconnect(void) /* deactivate all deleted configuration objects */ BOOST_FOREACH(const DbObject::Ptr& dbobj, active_dbobjs) { if (dbobj->GetObject() == NULL) { - Log(LogNotice, "db_ido", "Deactivate deleted object name1: '" + Convert::ToString(dbobj->GetName1() + + Log(LogNotice, "IdoPgsqlConnection", "Deactivate deleted object name1: '" + Convert::ToString(dbobj->GetName1() + "' name2: '" + Convert::ToString(dbobj->GetName2() + "'."))); DeactivateObject(dbobj); } @@ -288,7 +288,7 @@ IdoPgsqlResult IdoPgsqlConnection::Query(const String& query) { AssertOnWorkQueue(); - Log(LogDebug, "db_ido_pgsql", "Query: " + query); + Log(LogDebug, "IdoPgsqlConnection", "Query: " + query); PGresult *result = PQexec(m_Connection, query.CStr()); @@ -330,7 +330,7 @@ DbReference IdoPgsqlConnection::GetSequenceValue(const String& table, const Stri std::ostringstream msgbuf; msgbuf << "Sequence Value: " << row->Get("id"); - Log(LogDebug, "db_ido_pgsql", msgbuf.str()); + Log(LogDebug, "IdoPgsqlConnection", msgbuf.str()); return DbReference(Convert::ToLong(row->Get("id"))); } @@ -630,7 +630,7 @@ void IdoPgsqlConnection::InternalExecuteQuery(const DbQuery& query, DbQueryType if (type == DbQueryInsert && query.Table == "notifications" && query.NotificationObject) { // FIXME remove hardcoded table name String idField = "notification_id"; SetNotificationInsertID(query.NotificationObject, GetSequenceValue(GetTablePrefix() + query.Table, idField)); - Log(LogDebug, "db_ido", "saving contactnotification notification_id=" + Convert::ToString(static_cast(GetSequenceValue(GetTablePrefix() + query.Table, idField)))); + Log(LogDebug, "IdoPgsqlConnection", "saving contactnotification notification_id=" + Convert::ToString(static_cast(GetSequenceValue(GetTablePrefix() + query.Table, idField)))); } } diff --git a/components/demo/demo.cpp b/components/demo/demo.cpp index d1f298624..250302c57 100644 --- a/components/demo/demo.cpp +++ b/components/demo/demo.cpp @@ -53,13 +53,13 @@ void Demo::DemoTimerHandler(void) ApiListener::Ptr listener = ApiListener::GetInstance(); if (listener) { listener->RelayMessage(MessageOrigin(), DynamicObject::Ptr(), message, true); - Log(LogInformation, "demo", "Sent demo::HelloWorld message"); + Log(LogInformation, "Demo", "Sent demo::HelloWorld message"); } } Value Demo::DemoMessageHandler(const MessageOrigin& origin, const Dictionary::Ptr&) { - Log(LogInformation, "demo", "Got demo message from '" + origin.FromClient->GetEndpoint()->GetName() + "'"); + Log(LogInformation, "Demo", "Got demo message from '" + origin.FromClient->GetEndpoint()->GetName() + "'"); return Empty; } diff --git a/components/livestatus/attributefilter.cpp b/components/livestatus/attributefilter.cpp index 03ace091b..72aa8e2f0 100644 --- a/components/livestatus/attributefilter.cpp +++ b/components/livestatus/attributefilter.cpp @@ -65,7 +65,7 @@ bool AttributeFilter::Apply(const Table::Ptr& table, const Value& row) boost::smatch what; bool ret = boost::regex_search(operand.GetData(), what, expr); - //Log(LogDebug, "livestatus", "Attribute filter '" + m_Operand + " " + m_Operator + " " + + //Log(LogDebug, "LivestatusListener/AttributeFilter", "Attribute filter '" + m_Operand + " " + m_Operator + " " + // static_cast(value) + "' " + (ret ? "matches" : "doesn't match") + "." ); return ret; @@ -77,7 +77,7 @@ bool AttributeFilter::Apply(const Table::Ptr& table, const Value& row) boost::smatch what; bool ret = boost::regex_search(operand.GetData(), what, expr); - //Log(LogDebug, "livestatus", "Attribute filter '" + m_Operand + " " + m_Operator + " " + + //Log(LogDebug, "LivestatusListener/AttributeFilter", "Attribute filter '" + m_Operand + " " + m_Operator + " " + // static_cast(value) + "' " + (ret ? "matches" : "doesn't match") + "." ); return ret; diff --git a/components/livestatus/listener.cpp b/components/livestatus/listener.cpp index dfb8a1aed..776462597 100644 --- a/components/livestatus/listener.cpp +++ b/components/livestatus/listener.cpp @@ -74,7 +74,7 @@ void LivestatusListener::Start(void) boost::thread thread(boost::bind(&LivestatusListener::ServerThreadProc, this, socket)); thread.detach(); - Log(LogInformation, "livestatus", "Created tcp socket listening on host '" + GetBindHost() + "' port '" + GetBindPort() + "'."); + Log(LogInformation, "LivestatusListener", "Created tcp socket listening on host '" + GetBindHost() + "' port '" + GetBindPort() + "'."); } else if (GetSocketType() == "unix") { #ifndef _WIN32 @@ -93,10 +93,10 @@ void LivestatusListener::Start(void) boost::thread thread(boost::bind(&LivestatusListener::ServerThreadProc, this, socket)); thread.detach(); - Log(LogInformation, "livestatus", "Created unix socket in '" + GetSocketPath() + "'."); + Log(LogInformation, "LivestatusListener", "Created unix socket in '" + GetSocketPath() + "'."); #else /* no unix sockets on windows */ - Log(LogCritical, "livestatus", "Unix sockets are not supported on Windows."); + Log(LogCritical, "LivestatusListener", "Unix sockets are not supported on Windows."); return; #endif } @@ -123,7 +123,7 @@ void LivestatusListener::ServerThreadProc(const Socket::Ptr& server) for (;;) { Socket::Ptr client = server->Accept(); - Log(LogNotice, "livestatus", "Client connected"); + Log(LogNotice, "LivestatusListener", "Client connected"); Utility::QueueAsyncCallback(boost::bind(&LivestatusListener::ClientHandler, this, client)); } diff --git a/components/livestatus/logtable.cpp b/components/livestatus/logtable.cpp index 179ad4e6d..11138816b 100644 --- a/components/livestatus/logtable.cpp +++ b/components/livestatus/logtable.cpp @@ -91,7 +91,7 @@ String LogTable::GetName(void) const void LogTable::FetchRows(const AddRowFunction& addRowFn) { - Log(LogNotice, "livestatus", "Pre-selecting log file from " + Convert::ToString(m_TimeFrom) + " until " + Convert::ToString(m_TimeUntil)); + Log(LogNotice, "LivestatusListener/LogTable", "Pre-selecting log file from " + Convert::ToString(m_TimeFrom) + " until " + Convert::ToString(m_TimeUntil)); /* create log file index */ LogUtility::CreateLogIndex(m_CompatLogPath, m_LogFileIndex); diff --git a/components/livestatus/logutility.cpp b/components/livestatus/logutility.cpp index f8b105923..032d5b93f 100644 --- a/components/livestatus/logutility.cpp +++ b/components/livestatus/logutility.cpp @@ -68,7 +68,7 @@ void LogUtility::CreateLogIndexFileHandler(const String& path, std::map index, HistoryTable *ta /* no attributes available - invalid log line */ if (!log_entry_attrs) { - Log(LogDebug, "livestatus", "Skipping invalid log line: '" + line + "'."); + Log(LogDebug, "LivestatusListener/LogUtility", "Skipping invalid log line: '" + line + "'."); continue; } @@ -127,7 +127,7 @@ Dictionary::Ptr LogUtility::GetAttributes(const String& text) */ unsigned long time = atoi(text.SubStr(1, 11).CStr()); - Log(LogDebug, "livestatus", "Processing log line: '" + text + "'."); + Log(LogDebug, "LivestatusListener/LogUtility", "Processing log line: '" + text + "'."); bag->Set("time", time); size_t colon = text.FindFirstOf(':'); diff --git a/components/livestatus/query.cpp b/components/livestatus/query.cpp index d1aea90bb..1584a96fa 100644 --- a/components/livestatus/query.cpp +++ b/components/livestatus/query.cpp @@ -62,7 +62,7 @@ Query::Query(const std::vector& lines, const String& compat_log_path) BOOST_FOREACH(const String& line, lines) { msg += line + "\n"; } - Log(LogDebug, "livestatus", msg); + Log(LogDebug, "LivestatusListener/Query", msg); m_CompatLogPath = compat_log_path; @@ -202,10 +202,10 @@ Query::Query(const std::vector& lines, const String& compat_log_path) if (header == "Or" || header == "StatsOr") { filter = make_shared(); - Log(LogDebug, "livestatus", "Add OR filter for " + params + " column(s). " + Convert::ToString(deq.size()) + " filters available."); + Log(LogDebug, "LivestatusListener/Query", "Add OR filter for " + params + " column(s). " + Convert::ToString(deq.size()) + " filters available."); } else { filter = make_shared(); - Log(LogDebug, "livestatus", "Add AND filter for " + params + " column(s). " + Convert::ToString(deq.size()) + " filters available."); + Log(LogDebug, "LivestatusListener/Query", "Add AND filter for " + params + " column(s). " + Convert::ToString(deq.size()) + " filters available."); } if (num > deq.size()) { @@ -217,7 +217,7 @@ Query::Query(const std::vector& lines, const String& compat_log_path) while (num > 0 && num--) { filter->AddSubFilter(deq.back()); - Log(LogDebug, "livestatus", "Add " + Convert::ToString(num) + " filter."); + Log(LogDebug, "LivestatusListener/Query", "Add " + Convert::ToString(num) + " filter."); deq.pop_back(); if (&deq == &stats) aggregators.pop_back(); @@ -340,7 +340,7 @@ Filter::Ptr Query::ParseFilter(const String& params, unsigned long& from, unsign } } - Log(LogDebug, "livestatus", "Parsed filter with attr: '" + attr + "' op: '" + op + "' val: '" + val + "'."); + Log(LogDebug, "LivestatusListener/Query", "Parsed filter with attr: '" + attr + "' op: '" + op + "' val: '" + val + "'."); return filter; } @@ -393,7 +393,7 @@ void Query::PrintCsvArray(std::ostream& fp, const Array::Ptr& array, int level) void Query::ExecuteGetHelper(const Stream::Ptr& stream) { - Log(LogInformation, "livestatus", "Table: " + m_Table); + Log(LogInformation, "LivestatusListener/Query", "Table: " + m_Table); Table::Ptr table = Table::GetByName(m_Table, m_CompatLogPath, m_LogTimeFrom, m_LogTimeUntil); @@ -498,14 +498,14 @@ void Query::ExecuteCommandHelper(const Stream::Ptr& stream) l_ExternalCommands++; } - Log(LogInformation, "livestatus", "Executing command: " + m_Command); + Log(LogInformation, "LivestatusListener/Query", "Executing command: " + m_Command); ExternalCommandProcessor::Execute(m_Command); SendResponse(stream, LivestatusErrorOK, ""); } void Query::ExecuteErrorHelper(const Stream::Ptr& stream) { - Log(LogDebug, "livestatus", "ERROR: Code: '" + Convert::ToString(m_ErrorCode) + "' Message: '" + m_ErrorMessage + "'."); + Log(LogDebug, "LivestatusListener/Query", "ERROR: Code: '" + Convert::ToString(m_ErrorCode) + "' Message: '" + m_ErrorMessage + "'."); SendResponse(stream, m_ErrorCode, m_ErrorMessage); } @@ -521,7 +521,7 @@ void Query::SendResponse(const Stream::Ptr& stream, int code, const String& data std::ostringstream info; info << "Exception thrown while writing to the livestatus socket: " << std::endl << DiagnosticInformation(ex); - Log(LogCritical, "livestatus", info.str()); + Log(LogCritical, "LivestatusListener/Query", info.str()); } } } @@ -541,14 +541,14 @@ void Query::PrintFixed16(const Stream::Ptr& stream, int code, const String& data std::ostringstream info; info << "Exception thrown while writing to the livestatus socket: " << std::endl << DiagnosticInformation(ex); - Log(LogCritical, "livestatus", info.str()); + Log(LogCritical, "LivestatusListener/Query", info.str()); } } bool Query::Execute(const Stream::Ptr& stream) { try { - Log(LogInformation, "livestatus", "Executing livestatus query: " + m_Verb); + Log(LogInformation, "LivestatusListener/Query", "Executing livestatus query: " + m_Verb); if (m_Verb == "GET") ExecuteGetHelper(stream); diff --git a/components/livestatus/statehisttable.cpp b/components/livestatus/statehisttable.cpp index 6efe76dde..350ea93aa 100644 --- a/components/livestatus/statehisttable.cpp +++ b/components/livestatus/statehisttable.cpp @@ -117,7 +117,7 @@ void StateHistTable::UpdateLogEntries(const Dictionary::Ptr& log_entry_attrs, in state_hist_service_states->Add(state_hist_bag); - Log(LogDebug, "livestatus", "statehist: Adding new object '" + checkable->GetName() + "' to services cache."); + Log(LogDebug, "LivestatusListener/StateHistTable", "statehist: Adding new object '" + checkable->GetName() + "' to services cache."); } else { state_hist_service_states = m_CheckablesCache[checkable]; state_hist_bag = state_hist_service_states->Get(state_hist_service_states->GetLength()-1); /* fetch latest state from history */ @@ -173,7 +173,7 @@ void StateHistTable::UpdateLogEntries(const Dictionary::Ptr& log_entry_attrs, in state_hist_service_states->Add(state_hist_bag_new); - Log(LogDebug, "livestatus", "statehist: State change detected for object '" + + Log(LogDebug, "LivestatusListener/StateHistTable", "statehist: State change detected for object '" + checkable->GetName() + "' in '" + log_line + "'."); } break; @@ -252,7 +252,7 @@ String StateHistTable::GetName(void) const void StateHistTable::FetchRows(const AddRowFunction& addRowFn) { - Log(LogNotice, "livestatus", "Pre-selecting log file from " + Convert::ToString(m_TimeFrom) + " until " + Convert::ToString(m_TimeUntil)); + Log(LogNotice, "LivestatusListener/StateHistTable", "Pre-selecting log file from " + Convert::ToString(m_TimeFrom) + " until " + Convert::ToString(m_TimeUntil)); /* create log file index */ LogUtility::CreateLogIndex(m_CompatLogPath, m_LogFileIndex); diff --git a/components/notification/notificationcomponent.cpp b/components/notification/notificationcomponent.cpp index 90a12b8cb..cec7cc4d0 100644 --- a/components/notification/notificationcomponent.cpp +++ b/components/notification/notificationcomponent.cpp @@ -105,7 +105,7 @@ void NotificationComponent::NotificationTimerHandler(void) } try { - Log(LogInformation, "notification", "Sending reminder notification for object '" + checkable->GetName() + "'"); + Log(LogInformation, "NotificationComponent", "Sending reminder notification for object '" + checkable->GetName() + "'"); notification->BeginExecuteNotification(NotificationProblem, checkable->GetLastCheckResult(), false); } catch (const std::exception& ex) { std::ostringstream msgbuf; @@ -113,7 +113,7 @@ void NotificationComponent::NotificationTimerHandler(void) << GetName() << "': " << DiagnosticInformation(ex); String message = msgbuf.str(); - Log(LogWarning, "icinga", message); + Log(LogWarning, "NotificationComponent", message); } } } diff --git a/components/perfdata/graphitewriter.cpp b/components/perfdata/graphitewriter.cpp index 22250bfbf..5472ad982 100644 --- a/components/perfdata/graphitewriter.cpp +++ b/components/perfdata/graphitewriter.cpp @@ -77,16 +77,16 @@ void GraphiteWriter::ReconnectTimerHandler(void) try { if (m_Stream) { m_Stream->Write("\n", 1); - Log(LogNotice, "perfdata", "GraphiteWriter already connected on socket on host '" + GetHost() + "' port '" + GetPort() + "'."); + Log(LogNotice, "GraphiteWriter", "GraphiteWriter already connected on socket on host '" + GetHost() + "' port '" + GetPort() + "'."); return; } } catch (const std::exception& ex) { - Log(LogWarning, "perfdata", "GraphiteWriter socket on host '" + GetHost() + "' port '" + GetPort() + "' gone. Attempting to reconnect."); + Log(LogWarning, "GraphiteWriter", "GraphiteWriter socket on host '" + GetHost() + "' port '" + GetPort() + "' gone. Attempting to reconnect."); } TcpSocket::Ptr socket = make_shared(); - Log(LogNotice, "perfdata", "GraphiteWriter: Reconnect to tcp socket on host '" + GetHost() + "' port '" + GetPort() + "'."); + Log(LogNotice, "GraphiteWriter", "GraphiteWriter: Reconnect to tcp socket on host '" + GetHost() + "' port '" + GetPort() + "'."); socket->Connect(GetHost(), GetPort()); m_Stream = make_shared(socket); @@ -163,7 +163,7 @@ void GraphiteWriter::SendMetric(const String& prefix, const String& name, double msgbuf << prefix << "." << name << " " << value << " " << static_cast(Utility::GetTime()) << "\n"; String metric = msgbuf.str(); - Log(LogDebug, "perfdata", "GraphiteWriter: Add to metric list:'" + metric + "'."); + Log(LogDebug, "GraphiteWriter", "GraphiteWriter: Add to metric list:'" + metric + "'."); ObjectLock olock(this); @@ -177,7 +177,7 @@ void GraphiteWriter::SendMetric(const String& prefix, const String& name, double msgbuf << "Exception thrown while writing to the Graphite socket: " << std::endl << DiagnosticInformation(ex); - Log(LogCritical, "perfdata", msgbuf.str()); + Log(LogCritical, "GraphiteWriter", msgbuf.str()); m_Stream.reset(); } diff --git a/components/perfdata/perfdatawriter.cpp b/components/perfdata/perfdatawriter.cpp index 9da2707ae..ea256e2c1 100644 --- a/components/perfdata/perfdatawriter.cpp +++ b/components/perfdata/perfdatawriter.cpp @@ -122,7 +122,7 @@ void PerfdataWriter::RotateFile(std::ofstream& output, const String& temp_path, output.open(temp_path.CStr()); if (!output.good()) - Log(LogWarning, "icinga", "Could not open perfdata file '" + temp_path + "' for writing. Perfdata will be lost."); + Log(LogWarning, "PerfdataWriter", "Could not open perfdata file '" + temp_path + "' for writing. Perfdata will be lost."); } void PerfdataWriter::RotationTimerHandler(void)