NCBI C++ ToolKit
|
#include "task_server_pch.hpp"
#include <corelib/ncbimtx.hpp>
#include <corelib/ncbifile.hpp>
#include <corelib/request_ctx.hpp>
#include <corelib/ncbireg.hpp>
#include "logging.hpp"
#include "threads_man.hpp"
#include "memory_man.hpp"
#include "server_core.hpp"
#include <fcntl.h>
Go to the source code of this file.
Go to the SVN repository for this file.
Classes | |
struct | SLogData |
class | CLogWriter |
void AssignThreadLogging | ( | SSrvThread * | thr | ) |
Definition at line 606 of file logging.cpp.
References s_AllocMainData(), s_AllocNewData(), s_MainData, and thr.
Referenced by s_AllocThread().
void CheckLoggingFlush | ( | SSrvThread * | thr | ) |
Definition at line 619 of file logging.cpp.
References CSrvTime::CurSecs(), data, s_CheckFatalAbort(), s_MaxFlushPeriod, s_RotateLogBuf(), and thr.
Referenced by s_PerJiffyTasks_Main(), s_PerJiffyTasks_Service(), and s_PerJiffyTasks_Worker().
void ConfigureLogging | ( | const CNcbiRegistry * | reg, |
CTempString | section | ||
) |
Definition at line 524 of file logging.cpp.
References IRegistry::GetBool(), IRegistry::GetInt(), IRegistry::GetString(), i, kUSecsPerMSec, NULL, s_FileReopenPeriod, s_LogBufSize, s_LogRequests, s_LongCmd, s_MaxFlushPeriod, s_SevNames, s_SoftFatal, s_SoftFatalActions, s_VisibleSev, NStr::StringToUInt8_DataSize(), and tmp.
Referenced by ReConfig_Logging(), and s_ReadConfiguration().
void FinalizeLogging | ( | void | ) |
Definition at line 583 of file logging.cpp.
References SLogData::buf, close(), SLogData::cur_ptr, CSrvTime::Current(), CTaskServer::GetStartTime(), CSrvTime::NSec(), NULL, s_AddLogPrefix(), s_AddToLog(), s_LogFd, s_MainData, s_WriteLog(), and CSrvTime::Sec().
Referenced by CTaskServer::Finalize().
string GetLogFileName | ( | void | ) |
Definition at line 146 of file logging.cpp.
References s_FileName.
Referenced by main(), and CNCServer::WriteEnvInfo().
string GetLogVisibility | ( | void | ) |
Definition at line 151 of file logging.cpp.
References s_SevNames, and s_VisibleSev.
Referenced by CNCStat::PrintState(), and WriteSetup_Logging().
string GetSoftFatalAction | ( | void | ) |
Definition at line 156 of file logging.cpp.
References s_SoftFatal, and s_SoftFatalActions.
Referenced by CNCStat::PrintState(), and WriteSetup_Logging().
void InitLogging | ( | void | ) |
Definition at line 573 of file logging.cpp.
References s_AllocMainData(), s_InitFileName(), s_LogWriter, and s_MainData.
Referenced by CTaskServer::Initialize().
Definition at line 555 of file logging.cpp.
References s_LongCmd.
Referenced by CNCMessageHandler::x_CleanCmdResources().
void Logging_DiskSpaceAlert | ( | void | ) |
Definition at line 126 of file logging.cpp.
References s_DiskSpaceAlert.
Referenced by CNCBlobStorage::CheckDiskSpace().
void LogNoteThreadsStarted | ( | void | ) |
Definition at line 517 of file logging.cpp.
References s_MainData, s_RotateLogBuf(), and s_ThreadsStarted.
Referenced by s_StartAllThreads().
const CSrvDiagMsg& operator<< | ( | const CSrvDiagMsg & | msg, |
EOldStyleSeverity | sev | ||
) |
Definition at line 982 of file logging.cpp.
References msg(), and s_ConvertSeverity().
const CSrvDiagMsg& operator<< | ( | const CSrvDiagMsg & | msg, |
ErrCode | err_code | ||
) |
Definition at line 989 of file logging.cpp.
References ErrCode::m_Code, ErrCode::m_SubCode, and msg().
bool ReConfig_Logging | ( | const CTempString & | section, |
const CNcbiRegistry & | new_reg, | ||
string & | err_message | ||
) |
Definition at line 549 of file logging.cpp.
References ConfigureLogging().
Referenced by CTaskServer::ReConfig().
void ReleaseThreadLogging | ( | SSrvThread * | thr | ) |
Definition at line 653 of file logging.cpp.
References data, s_WriteLog(), and thr.
Referenced by s_JoinAllThreads().
|
static |
Definition at line 370 of file logging.cpp.
References AtomicAdd(), CSrvTime::Current(), data, CSrvTime::eFmtLogging, CTaskServer::GetHostName(), CRequestContext::GetNextRequestID(), len, CSrvTime::Print(), s_AddToLog(), s_AppBaseName, s_AppUID, s_CheckBufSize(), s_ProcessPostNum, s_UnkClient, s_UnkSession, str(), and thr.
Referenced by FinalizeLogging(), CSrvDiagMsg::PrintExtra(), s_AllocMainData(), CSrvDiagMsg::StartInfo(), CSrvDiagMsg::StartRequest(), CSrvDiagMsg::StartSrvLog(), and CSrvDiagMsg::StopRequest().
|
static |
Definition at line 421 of file logging.cpp.
References CTempString::data(), data, s_AddToLog(), s_CheckBufSize(), and CTempString::size().
Referenced by CSrvDiagMsg::PrintParam().
Definition at line 298 of file logging.cpp.
References data, s_AddToLog(), and str().
Definition at line 278 of file logging.cpp.
References data, s_CheckBufSize(), ncbi::grid::netcache::search::fields::size, and str().
Referenced by FinalizeLogging(), CSrvDiagMsg::operator<<(), CSrvDiagMsg::PrintExtra(), CSrvDiagMsg::PrintParam(), s_AddLogPrefix(), s_AddParamName(), s_AddToLog(), s_AllocMainData(), CSrvDiagMsg::StartInfo(), CSrvDiagMsg::StartRequest(), CSrvDiagMsg::StartSrvLog(), and CSrvDiagMsg::StopRequest().
Definition at line 310 of file logging.cpp.
References data, s_AddToLog(), and str().
Definition at line 322 of file logging.cpp.
References data, i, max(), s_AddToLog(), s_CheckBufSize(), and str().
Definition at line 363 of file logging.cpp.
References data, NStr::DoubleToString(), and s_AddToLog().
Definition at line 346 of file logging.cpp.
References data, and s_AddToLog().
Definition at line 339 of file logging.cpp.
References data, NStr::Int8ToString(), and s_AddToLog().
Definition at line 332 of file logging.cpp.
References data, s_AddToLog(), and NStr::UInt8ToString().
Definition at line 352 of file logging.cpp.
References data, i, max(), s_AddToLog(), s_CheckBufSize(), and NStr::UInt8ToString().
Definition at line 304 of file logging.cpp.
References data, s_AddToLogStripLF(), and str().
Definition at line 287 of file logging.cpp.
References data, s_CheckBufSize(), ncbi::grid::netcache::search::fields::size, and str().
Referenced by CSrvDiagMsg::operator<<(), and s_AddToLogStripLF().
Definition at line 316 of file logging.cpp.
References data, s_AddToLogStripLF(), and str().
|
static |
Definition at line 446 of file logging.cpp.
References SLogData::cur_msg_ptr, SLogData::cur_ptr, NULL, s_AddLogPrefix(), s_AddToLog(), s_AllocNewData(), s_CmdLine, s_InitConstants(), and s_MainData.
Referenced by AssignThreadLogging(), CSrvDiagMsg::CSrvDiagMsg(), and InitLogging().
Definition at line 235 of file logging.cpp.
References data, and malloc().
Referenced by s_AllocNewData(), and s_RotateLogBuf().
|
static |
Definition at line 435 of file logging.cpp.
References data, s_AllocNewBuf(), s_InitLogPrefix(), and s_LogBufSize.
Referenced by AssignThreadLogging(), s_AllocMainData(), and StartThreadLogging().
Definition at line 270 of file logging.cpp.
References data, and s_RotateLogBuf().
Referenced by CSrvDiagMsg::Flush(), s_AddLogPrefix(), s_AddParamName(), s_AddToLog(), and s_AddToLogStripLF().
|
inlinestatic |
Definition at line 503 of file logging.cpp.
References CFutex::AddValue(), data, GetCurThread(), SSrvThread::log_data, s_CntHaltedThreads, s_Halt, s_NeedFatalHalt, s_QueueLogWrite(), CFutex::WaitValueChange(), and CFutex::WakeUpWaiters().
Referenced by CheckLoggingFlush(), CSrvDiagMsg::CSrvDiagMsg(), CLogWriter::ExecuteSlice(), and StopThreadLogging().
|
inlinestatic |
Definition at line 756 of file logging.cpp.
References data, CSrvDiagMsg::IsSeverityVisible(), msg(), and SRV_FATAL.
Referenced by CSrvDiagMsg::operator<<().
|
inlinestatic |
Definition at line 796 of file logging.cpp.
References CSrvDiagMsg::Critical, eDiag_Critical, eDiag_Error, eDiag_Fatal, eDiag_Info, eDiag_Trace, eDiag_Warning, CSrvDiagMsg::Error, CSrvDiagMsg::Fatal, CSrvDiagMsg::Info, SRV_FATAL, CSrvDiagMsg::Trace, and CSrvDiagMsg::Warning.
|
inlinestatic |
Definition at line 774 of file logging.cpp.
References Critical(), CSrvDiagMsg::Critical, Error(), CSrvDiagMsg::Error, Fatal(), CSrvDiagMsg::Fatal, Info(), CSrvDiagMsg::Info, SRV_FATAL, Trace(), CSrvDiagMsg::Trace, Warning(), and CSrvDiagMsg::Warning.
Referenced by operator<<(), and SDiagMessage::Write().
Definition at line 472 of file logging.cpp.
References abort(), CFutex::AddValue(), close(), data, GetCntRunningThreads(), CFutex::GetValue(), ITERATE, s_CntHaltedThreads, s_FileNameInitialized, s_InitFileName(), s_JiffyTime, s_LogFd, s_NeedFatalHalt, s_ThreadsStarted, s_WriteLog(), s_WriteQueue, str(), and CFutex::WaitValueChange().
Referenced by CSrvDiagMsg::Flush().
|
static |
Definition at line 162 of file logging.cpp.
References CTaskServer::GetHostName(), CCurrentProcess::GetPid(), ITERATE, s_AppUID, s_Pid, t, and NStr::UInt8ToString().
Referenced by s_AllocMainData(), and CDiagContext::UpdatePID().
|
static |
Definition at line 458 of file logging.cpp.
References kEmptyStr, CDirEntry::MakePath(), s_AppBaseName, s_FileName, s_FileNameInitialized, s_InApplog, s_LogFd, and s_OpenLogFile().
Referenced by InitLogging(), and s_DoFatalAbort().
|
inlinestatic |
Definition at line 258 of file logging.cpp.
References data, s_Pid, and NStr::UInt8ToString().
Referenced by s_AllocNewData(), and CDiagContext::UpdatePID().
|
inlinestatic |
Definition at line 187 of file logging.cpp.
References s_DiskSpaceAlert, s_FileName, and s_LogFd.
Referenced by s_InitFileName(), and s_WriteLog().
|
static |
Definition at line 706 of file logging.cpp.
References CTempString::assign(), find_match(), len, NULL, and str_rev_str().
Referenced by CDiagCompileInfo::ParseCurrFunctName(), and CSrvDiagMsg::StartSrvLog().
|
static |
Definition at line 220 of file logging.cpp.
References buf, CMiniMutex::Lock(), s_LogWriter, s_WriteQueue, s_WriteQueueLock, CSrvTask::SetRunnable(), ncbi::grid::netcache::search::fields::size, and CMiniMutex::Unlock().
Referenced by s_CheckFatalAbort(), s_RotateLogBuf(), and StopThreadLogging().
Definition at line 243 of file logging.cpp.
References CSrvTime::CurSecs(), data, s_AllocNewBuf(), s_LogBufSize, and s_QueueLogWrite().
Referenced by CheckLoggingFlush(), LogNoteThreadsStarted(), and s_CheckBufSize().
Definition at line 200 of file logging.cpp.
References buf, CSrvTime::CurSecs(), s_LastReopenTime, s_LogFd, s_OpenLogFile(), and ncbi::grid::netcache::search::fields::size.
Referenced by CLogWriter::ExecuteSlice(), FinalizeLogging(), ReleaseThreadLogging(), and s_DoFatalAbort().
Definition at line 132 of file logging.cpp.
References s_CmdLine.
Referenced by s_ProcessParameters().
void SetLogFileName | ( | CTempString | name | ) |
Definition at line 138 of file logging.cpp.
References CDirEntry::ConcatPath(), CDir::GetCwd(), CDirEntry::IsAbsolutePath(), CDirEntry::NormalizePath(), and s_FileName.
Referenced by s_ProcessParameters().
void StartThreadLogging | ( | SSrvThread * | thr | ) |
Definition at line 635 of file logging.cpp.
References s_AllocNewData(), and thr.
Referenced by s_StartCurMgrThread().
void StopThreadLogging | ( | SSrvThread * | thr | ) |
Definition at line 641 of file logging.cpp.
References data, free(), s_CheckFatalAbort(), s_QueueLogWrite(), and thr.
Referenced by s_StopCurMgrThread().
void WriteSetup_Logging | ( | CSrvSocketTask & | task | ) |
Definition at line 560 of file logging.cpp.
References GetLogVisibility(), GetSoftFatalAction(), kUSecsPerMSec, s_FileReopenPeriod, s_LogBufSize, s_LogRequests, s_LongCmd, s_MaxFlushPeriod, CSrvSocketTask::WriteBool(), CSrvSocketTask::WriteNumber(), and CSrvSocketTask::WriteText().
Referenced by CTaskServer::WriteSetup().
|
static |
Definition at line 97 of file logging.cpp.
|
static |
Definition at line 96 of file logging.cpp.
Referenced by CSrvDiagMsg::Flush().
|
extern |
Definition at line 77 of file server_core.cpp.
Referenced by s_AddLogPrefix(), and s_InitFileName().
|
static |
Definition at line 104 of file logging.cpp.
Referenced by s_AddLogPrefix(), s_InitConstants(), and CDiagContext::UpdatePID().
|
static |
Definition at line 102 of file logging.cpp.
Referenced by s_AllocMainData(), and SaveAppCmdLine().
|
static |
Definition at line 118 of file logging.cpp.
Referenced by s_CheckFatalAbort(), and s_DoFatalAbort().
Definition at line 117 of file logging.cpp.
Referenced by Logging_DiskSpaceAlert(), and s_OpenLogFile().
|
static |
Definition at line 105 of file logging.cpp.
Referenced by GetLogFileName(), s_InitFileName(), s_OpenLogFile(), and SetLogFileName().
Definition at line 115 of file logging.cpp.
Referenced by s_DoFatalAbort(), and s_InitFileName().
|
static |
Definition at line 100 of file logging.cpp.
Referenced by ConfigureLogging(), CLogWriter::ExecuteSlice(), and WriteSetup_Logging().
|
static |
Definition at line 119 of file logging.cpp.
Referenced by s_CheckFatalAbort().
Definition at line 108 of file logging.cpp.
Referenced by CSrvDiagMsg::operator<<(), and s_InitFileName().
|
extern |
Definition at line 54 of file time_man.cpp.
Referenced by s_DoFatalAbort().
|
static |
Definition at line 113 of file logging.cpp.
Referenced by CLogWriter::ExecuteSlice(), and s_WriteLog().
|
static |
Definition at line 98 of file logging.cpp.
Referenced by ConfigureLogging(), s_AllocNewData(), s_RotateLogBuf(), and WriteSetup_Logging().
|
static |
Definition at line 112 of file logging.cpp.
Referenced by CLogWriter::ExecuteSlice(), FinalizeLogging(), s_DoFatalAbort(), s_InitFileName(), s_OpenLogFile(), and s_WriteLog().
Definition at line 90 of file logging.cpp.
Referenced by ConfigureLogging(), CSrvDiagMsg::PrintExtra(), CSrvDiagMsg::PrintParam(), CSrvDiagMsg::StartRequest(), CSrvDiagMsg::StopRequest(), and WriteSetup_Logging().
|
static |
Definition at line 111 of file logging.cpp.
Referenced by InitLogging(), and s_QueueLogWrite().
|
static |
Definition at line 101 of file logging.cpp.
Referenced by ConfigureLogging(), IsLongCommand(), and WriteSetup_Logging().
Definition at line 107 of file logging.cpp.
Referenced by AssignThreadLogging(), CSrvDiagMsg::CSrvDiagMsg(), FinalizeLogging(), InitLogging(), LogNoteThreadsStarted(), s_AllocMainData(), and CDiagContext::UpdatePID().
|
static |
Definition at line 99 of file logging.cpp.
Referenced by CheckLoggingFlush(), ConfigureLogging(), and WriteSetup_Logging().
Definition at line 114 of file logging.cpp.
Referenced by s_CheckFatalAbort(), and s_DoFatalAbort().
|
static |
Definition at line 103 of file logging.cpp.
Referenced by s_InitConstants(), and s_InitLogPrefix().
|
static |
Definition at line 106 of file logging.cpp.
Referenced by s_AddLogPrefix().
|
static |
Definition at line 93 of file logging.cpp.
Referenced by ConfigureLogging(), GetLogVisibility(), CSrvDiagMsg::StartSrvLog(), and SDiagMessage::Write().
|
static |
Definition at line 95 of file logging.cpp.
Referenced by ConfigureLogging(), CSrvDiagMsg::Flush(), and GetSoftFatalAction().
|
static |
Definition at line 94 of file logging.cpp.
Referenced by ConfigureLogging(), and GetSoftFatalAction().
|
extern |
Definition at line 59 of file threads_man.cpp.
Referenced by CDiagContext::UpdatePID().
Definition at line 116 of file logging.cpp.
Referenced by LogNoteThreadsStarted(), and s_DoFatalAbort().
|
static |
Definition at line 91 of file logging.cpp.
Referenced by s_AddLogPrefix().
|
static |
Definition at line 92 of file logging.cpp.
Referenced by s_AddLogPrefix().
|
static |
Definition at line 89 of file logging.cpp.
Referenced by ConfigureLogging(), GetLogVisibility(), and CSrvDiagMsg::IsSeverityVisible().
|
static |
Definition at line 110 of file logging.cpp.
Referenced by CLogWriter::ExecuteSlice(), s_DoFatalAbort(), and s_QueueLogWrite().
|
static |
Definition at line 109 of file logging.cpp.
Referenced by CLogWriter::ExecuteSlice(), and s_QueueLogWrite().