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
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
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)));
}
}
# 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 */
}
Utility::Sleep(2.5);
if (m_RequestReopenLogs) {
- Log(LogNotice, "base", "Reopening log files");
+ Log(LogNotice, "Application", "Reopening log files");
m_RequestReopenLogs = false;
OnReopenLogs();
}
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);
}
goto mainloop;
}
- Log(LogInformation, "base", "Shutting down Icinga...");
+ Log(LogInformation, "Application", "Shutting down Icinga...");
DynamicObject::StopObjects();
Application::GetInstance()->OnShutdown();
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>();
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);
}
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";
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);
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);
std::ostringstream msgbuf;
msgbuf << "Restored " << restored << " objects";
- Log(LogInformation, "base", msgbuf.str());
+ Log(LogInformation, "DynamicObject", msgbuf.str());
}
void DynamicObject::StopObjects(void)
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 */
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();
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
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) {
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) << ".>";
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();
msgbuf << "Event call took " << (et - st) << "s";
# endif /* RUSAGE_THREAD */
- Log(LogWarning, "base", msgbuf.str());
+ Log(LogWarning, "ThreadPool", msgbuf.str());
}
#endif /* _DEBUG */
}
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++)
<< (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());
}
}
}
{
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)));
{
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();
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());
{
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)