]> granicus.if.org Git - icinga2/commitdiff
Change log message identifier for libbase.
authorMichael Friedrich <michael.friedrich@netways.de>
Wed, 28 May 2014 11:17:02 +0000 (13:17 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Wed, 28 May 2014 12:42:00 +0000 (14:42 +0200)
Refs #6346

lib/base/application.cpp
lib/base/dynamicobject.cpp
lib/base/process.cpp
lib/base/threadpool.cpp
lib/base/utility.cpp
lib/base/workqueue.cpp

index 802089567cf0431d1e429014bf9c798177db3d66..ef5fcc3aa4ce4e7b1eccb80db9e29cbc9f02630b 100644 (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);
        }
index a5ae9c8cedd4324b9771f7f9201c390605b63e79..e02d54ee8ed2b354414b4280efa0e1fc3898057c 100644 (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)
index 2ed95077bc3290b67a284041577597f217f1ec66..e978803d90da1422a05e32e7ad5173699e4f7dfd 100644 (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) << ".>";
index b2eb754bd84b81cf8a8070175aa0fc64dde8a16a..6a7bf9fa2333bc4f39206ee42a9e39f257d2bb92 100644 (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();
index f6d1d51bdd97dc8084704cb93b1ab2785fc09aa5..7c1b63bd06ee8c9f2e89ea13d2ec74d1294d5410 100644 (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());
index 43594c42529a5bf7e0f1f16950b16ea127073039..1a1a87ca5645dd7d4134c5ca54896ed54bbfe522 100644 (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)