Change log message identifier for libbase.

Refs #6346
This commit is contained in:
Michael Friedrich 2014-05-28 13:17:02 +02:00
parent 0f9d76d40b
commit 076d297931
6 changed files with 31 additions and 31 deletions

View File

@ -149,9 +149,9 @@ void Application::SetResourceLimits(void)
rl.rlim_max = rl.rlim_cur;
if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
Log(LogNotice, "base", "Could not adjust resource limit for open file handles (RLIMIT_NOFILE)");
Log(LogNotice, "Application", "Could not adjust resource limit for open file handles (RLIMIT_NOFILE)");
# else /* RLIMIT_NOFILE */
Log(LogNotice, "base", "System does not support adjusting the resource limit for open file handles (RLIMIT_NOFILE)");
Log(LogNotice, "Application", "System does not support adjusting the resource limit for open file handles (RLIMIT_NOFILE)");
# endif /* RLIMIT_NOFILE */
# ifdef RLIMIT_NPROC
@ -159,9 +159,9 @@ void Application::SetResourceLimits(void)
rl.rlim_max = rl.rlim_cur;
if (setrlimit(RLIMIT_NPROC, &rl) < 0)
Log(LogNotice, "base", "Could not adjust resource limit for number of processes (RLIMIT_NPROC)");
Log(LogNotice, "Application", "Could not adjust resource limit for number of processes (RLIMIT_NPROC)");
# else /* RLIMIT_NPROC */
Log(LogNotice, "base", "System does not support adjusting the resource limit for number of processes (RLIMIT_NPROC)");
Log(LogNotice, "Application", "System does not support adjusting the resource limit for number of processes (RLIMIT_NPROC)");
# endif /* RLIMIT_NPROC */
# ifdef RLIMIT_STACK
@ -181,7 +181,7 @@ void Application::SetResourceLimits(void)
rl.rlim_max = rl.rlim_cur;
if (setrlimit(RLIMIT_STACK, &rl) < 0)
Log(LogNotice, "base", "Could not adjust resource limit for stack size (RLIMIT_STACK)");
Log(LogNotice, "Application", "Could not adjust resource limit for stack size (RLIMIT_STACK)");
else {
char **new_argv = static_cast<char **>(malloc(sizeof(char *) * (argc + 2)));
@ -209,7 +209,7 @@ void Application::SetResourceLimits(void)
}
}
# else /* RLIMIT_STACK */
Log(LogNotice, "base", "System does not support adjusting the resource limit for stack size (RLIMIT_STACK)");
Log(LogNotice, "Application", "System does not support adjusting the resource limit for stack size (RLIMIT_STACK)");
# endif /* RLIMIT_STACK */
#endif /* _WIN32 */
}
@ -250,7 +250,7 @@ mainloop:
Utility::Sleep(2.5);
if (m_RequestReopenLogs) {
Log(LogNotice, "base", "Reopening log files");
Log(LogNotice, "Application", "Reopening log files");
m_RequestReopenLogs = false;
OnReopenLogs();
}
@ -264,7 +264,7 @@ mainloop:
msgbuf << "We jumped "
<< (timeDiff < 0 ? "forward" : "backward")
<< " in time: " << abs(timeDiff) << " seconds";
Log(LogInformation, "base", msgbuf.str());
Log(LogInformation, "Application", msgbuf.str());
Timer::AdjustTimers(-timeDiff);
}
@ -285,7 +285,7 @@ mainloop:
goto mainloop;
}
Log(LogInformation, "base", "Shutting down Icinga...");
Log(LogInformation, "Application", "Shutting down Icinga...");
DynamicObject::StopObjects();
Application::GetInstance()->OnShutdown();
@ -307,13 +307,13 @@ void Application::OnShutdown(void)
static void ReloadProcessCallback(const ProcessResult& pr)
{
if (pr.ExitStatus != 0)
Log(LogCritical, "base", "Found error in config: reloading aborted");
Log(LogCritical, "Application", "Found error in config: reloading aborted");
l_Restarting = false;
}
pid_t Application::StartReloadProcess(void)
{
Log(LogInformation, "base", "Got reload command: Starting new instance.");
Log(LogInformation, "Application", "Got reload command: Starting new instance.");
// prepare arguments
Array::Ptr args = make_shared<Array>();
@ -683,7 +683,7 @@ void Application::UpdatePidFile(const String& filename, pid_t pid)
lock.l_whence = SEEK_SET;
if (fcntl(fd, F_SETLK, &lock) < 0) {
Log(LogCritical, "base", "Could not lock PID file. Make sure that only one instance of the application is running.");
Log(LogCritical, "Application", "Could not lock PID file. Make sure that only one instance of the application is running.");
_exit(EXIT_FAILURE);
}

View File

@ -229,7 +229,7 @@ Value DynamicObject::InvokeMethod(const String& method,
void DynamicObject::DumpObjects(const String& filename, int attributeTypes)
{
Log(LogInformation, "base", "Dumping program state to file '" + filename + "'");
Log(LogInformation, "DynamicObject", "Dumping program state to file '" + filename + "'");
String tempFilename = filename + ".tmp";
@ -297,7 +297,7 @@ void DynamicObject::RestoreObject(const String& message, int attributeTypes)
ASSERT(!object->IsActive());
#ifdef _DEBUG
Log(LogDebug, "base", "Restoring object '" + name + "' of type '" + type + "'.");
Log(LogDebug, "DynamicObject", "Restoring object '" + name + "' of type '" + type + "'.");
#endif /* _DEBUG */
Dictionary::Ptr update = persistentObject->Get("update");
Deserialize(object, update, false, attributeTypes);
@ -306,7 +306,7 @@ void DynamicObject::RestoreObject(const String& message, int attributeTypes)
void DynamicObject::RestoreObjects(const String& filename, int attributeTypes)
{
Log(LogInformation, "base", "Restoring program state from file '" + filename + "'");
Log(LogInformation, "DynamicObject", "Restoring program state from file '" + filename + "'");
std::fstream fp;
fp.open(filename.CStr(), std::ios_base::in);
@ -329,7 +329,7 @@ void DynamicObject::RestoreObjects(const String& filename, int attributeTypes)
std::ostringstream msgbuf;
msgbuf << "Restored " << restored << " objects";
Log(LogInformation, "base", msgbuf.str());
Log(LogInformation, "DynamicObject", msgbuf.str());
}
void DynamicObject::StopObjects(void)

View File

@ -426,7 +426,7 @@ void Process::Run(const boost::function<void(const ProcessResult&)>& callback)
m_FD = outReadPipe;
m_PID = pi.dwProcessId;
Log(LogNotice, "base", "Running command '" + m_Arguments +
Log(LogNotice, "Process", "Running command '" + m_Arguments +
"': PID " + Convert::ToString(m_PID));
#else /* _WIN32 */
@ -531,7 +531,7 @@ void Process::Run(const boost::function<void(const ProcessResult&)>& callback)
m_PID = m_Process;
Log(LogNotice, "base", "Running command '" + boost::algorithm::join(m_Arguments, "', '") +
Log(LogNotice, "Process", "Running command '" + boost::algorithm::join(m_Arguments, "', '") +
"': PID " + Convert::ToString(m_PID));
m_Arguments.clear();
@ -582,7 +582,7 @@ bool Process::DoEvents(void)
double timeout = m_Result.ExecutionStart + m_Timeout;
if (timeout < Utility::GetTime()) {
Log(LogNotice, "base", "Killing process '" + Convert::ToString(m_PID) + " after timeout of " + Convert::ToString(m_Timeout) + " seconds");
Log(LogNotice, "Process", "Killing process '" + Convert::ToString(m_PID) + " after timeout of " + Convert::ToString(m_Timeout) + " seconds");
m_OutputStream << "<Timeout exceeded.>";
#ifdef _WIN32
@ -630,7 +630,7 @@ bool Process::DoEvents(void)
DWORD exitcode;
GetExitCodeProcess(m_Process, &exitcode);
Log(LogNotice, "base", "PID " + Convert::ToString(m_PID) + " terminated with exit code " + Convert::ToString(exitcode));
Log(LogNotice, "Process", "PID " + Convert::ToString(m_PID) + " terminated with exit code " + Convert::ToString(exitcode));
#else /* _WIN32 */
int status, exitcode;
if (waitpid(m_Process, &status, 0) != m_Process) {
@ -642,9 +642,9 @@ bool Process::DoEvents(void)
if (WIFEXITED(status)) {
exitcode = WEXITSTATUS(status);
Log(LogNotice, "base", "PID " + Convert::ToString(m_PID) + " terminated with exit code " + Convert::ToString(exitcode));
Log(LogNotice, "Process", "PID " + Convert::ToString(m_PID) + " terminated with exit code " + Convert::ToString(exitcode));
} else if (WIFSIGNALED(status)) {
Log(LogNotice, "base", "PID " + Convert::ToString(m_PID) + " was terminated by signal " + Convert::ToString(WTERMSIG(status)));
Log(LogNotice, "Process", "PID " + Convert::ToString(m_PID) + " was terminated by signal " + Convert::ToString(WTERMSIG(status)));
std::ostringstream outputbuf;
outputbuf << "<Terminated by signal " << WTERMSIG(status) << ".>";

View File

@ -136,9 +136,9 @@ void ThreadPool::WorkerThread::ThreadProc(Queue& queue)
msgbuf << "Exception thrown in event handler: " << std::endl
<< DiagnosticInformation(ex);
Log(LogCritical, "base", msgbuf.str());
Log(LogCritical, "ThreadPool", msgbuf.str());
} catch (...) {
Log(LogCritical, "base", "Exception of unknown type thrown in event handler.");
Log(LogCritical, "ThreadPool", "Exception of unknown type thrown in event handler.");
}
double et = Utility::GetTime();
@ -178,7 +178,7 @@ void ThreadPool::WorkerThread::ThreadProc(Queue& queue)
msgbuf << "Event call took " << (et - st) << "s";
# endif /* RUSAGE_THREAD */
Log(LogWarning, "base", msgbuf.str());
Log(LogWarning, "ThreadPool", msgbuf.str());
}
#endif /* _DEBUG */
}
@ -289,7 +289,7 @@ void ThreadPool::ManagerThreadProc(void)
if (tthreads != 0) {
std::ostringstream msgbuf;
msgbuf << "Thread pool; current: " << alive << "; adjustment: " << tthreads;
Log(LogNotice, "base", msgbuf.str());
Log(LogNotice, "ThreadPool", msgbuf.str());
}
for (int i = 0; i < -tthreads; i++)
@ -319,7 +319,7 @@ void ThreadPool::ManagerThreadProc(void)
<< (long)(total_avg_latency * 1000 / (sizeof(m_Queues) / sizeof(m_Queues[0]))) << "ms"
<< "; Threads: " << total_alive
<< "; Pool utilization: " << (total_utilization / (sizeof(m_Queues) / sizeof(m_Queues[0]))) << "%";
Log(LogNotice, "base", msgbuf.str());
Log(LogNotice, "ThreadPool", msgbuf.str());
}
}
}
@ -331,7 +331,7 @@ void ThreadPool::Queue::SpawnWorker(boost::thread_group& group)
{
for (size_t i = 0; i < sizeof(Threads) / sizeof(Threads[0]); i++) {
if (Threads[i].State == ThreadDead) {
Log(LogDebug, "base", "Spawning worker thread.");
Log(LogDebug, "ThreadPool", "Spawning worker thread.");
Threads[i] = WorkerThread(ThreadIdle);
Threads[i].Thread = group.create_thread(boost::bind(&ThreadPool::WorkerThread::ThreadProc, boost::ref(Threads[i]), boost::ref(*this)));
@ -348,7 +348,7 @@ void ThreadPool::Queue::KillWorker(boost::thread_group& group)
{
for (size_t i = 0; i < sizeof(Threads) / sizeof(Threads[0]); i++) {
if (Threads[i].State == ThreadIdle && !Threads[i].Zombie) {
Log(LogDebug, "base", "Killing worker thread.");
Log(LogDebug, "ThreadPool", "Killing worker thread.");
group.remove_thread(Threads[i].Thread);
Threads[i].Thread->detach();

View File

@ -368,7 +368,7 @@ Utility::LoadExtensionLibrary(const String& library)
path = "lib" + library + ".so";
#endif /* _WIN32 */
Log(LogInformation, "base", "Loading library '" + path + "'");
Log(LogInformation, "Utility", "Loading library '" + path + "'");
#ifdef _WIN32
HMODULE hModule = LoadLibrary(path.CStr());

View File

@ -124,7 +124,7 @@ void WorkQueue::StatusTimerHandler(void)
{
boost::mutex::scoped_lock lock(m_Mutex);
Log(LogNotice, "base", "WQ #" + Convert::ToString(m_ID) + " items: " + Convert::ToString(m_Items.size()));
Log(LogNotice, "WorkQueue", "#" + Convert::ToString(m_ID) + " items: " + Convert::ToString(m_Items.size()));
}
void WorkQueue::WorkerThreadProc(void)