![]() |
XRootD
|
#include <XrdSysLogger.hh>
Classes | |
class | Task |
Public Member Functions | |
XrdSysLogger (int ErrFD=STDERR_FILENO, int xrotate=1) | |
~XrdSysLogger () | |
Destructor. More... | |
void | AddMsg (const char *msg) |
void | AtMidnight (Task *mnTask) |
int | Bind (const char *path, int lfh=0) |
void | Capture (XrdOucTListFIFO *tFIFO) |
void | Flush () |
Flush any pending output. More... | |
int | originalFD () |
int | ParseKeep (const char *arg) |
void | Put (int iovcnt, struct iovec *iov) |
void | setHiRes () |
Set log file timstamp to high resolution (hh:mm:ss.uuuu). More... | |
void | setKeep (long long knum) |
void | setRotate (int onoff) |
char * | traceBeg () |
char | traceEnd () |
const char * | xlogFN () |
void | zHandler () |
Static Public Member Functions | |
static void | setForwarding (bool onoff) |
Set call-out to logging plug-in on or off. More... | |
Static Public Attributes | |
static const int | onFifo = (int)0x80000000 |
Definition at line 52 of file XrdSysLogger.hh.
XrdSysLogger::XrdSysLogger | ( | int | ErrFD = STDERR_FILENO , |
int | xrotate = 1 |
||
) |
Constructor
ErrFD | is the filedescriptor of where error messages normally go if this class is not used. Default is stderr. |
xrotate | when not zero performs internal log rotatation. Otherwise, log rotation is suppressed. See also setRotate(). |
Definition at line 141 of file XrdSysLogger.cc.
References Bind().
|
inline |
Destructor.
Definition at line 71 of file XrdSysLogger.hh.
void XrdSysLogger::AddMsg | ( | const char * | msg | ) |
Add a message to be printed at midnight.
msg | The message to be printed. A copy of the message is saved. |
Definition at line 173 of file XrdSysLogger.cc.
References XrdSysMutex::Lock(), and XrdSysMutex::UnLock().
Referenced by XrdConfig::Configure(), and XrdFrmConfig::Configure().
void XrdSysLogger::AtMidnight | ( | XrdSysLogger::Task * | mnTask | ) |
Definition at line 202 of file XrdSysLogger.cc.
References XrdSysMutex::Lock(), and XrdSysMutex::UnLock().
Referenced by XrdCmsBlackList::Init().
int XrdSysLogger::Bind | ( | const char * | path, |
int | lfh = 0 |
||
) |
Definition at line 217 of file XrdSysLogger.cc.
References XrdSysLoggerRP::active, BLAB, XrdSysThread::Kill(), onFifo, XrdSysThread::Run(), XrdSysUtils::SigBlock(), XrdSysSemaphore::Wait(), XrdSysE2T(), and XrdSysLoggerRT().
Referenced by XrdSysLogger(), XrdFrmConfig::Configure(), and XrdSysLogging::Configure().
void XrdSysLogger::Capture | ( | XrdOucTListFIFO * | tFIFO | ) |
Capture allows you to capture all messages (they are not routed). This is a global setting so use with caution!
tFIFO | Pointer to the XrdOucTListFIFO where messages are saved. If the pointer is nil, capturing is turned off. |
Definition at line 275 of file XrdSysLogger.cc.
References XrdSysMutex::Lock(), and XrdSysMutex::UnLock().
Referenced by XrdOucPsx::ConfigSetup().
|
inline |
Flush any pending output.
Definition at line 152 of file XrdSysLogger.hh.
References fsync().
|
inline |
Get the file descriptor passed at construction time.
Definition at line 160 of file XrdSysLogger.hh.
Referenced by XrdSysError::baseFD(), and XrdOucStream::Exec().
int XrdSysLogger::ParseKeep | ( | const char * | arg | ) |
Parse the keep option argument.
arg | Pointer to the argument. The argument syntax is: <count> | <size> | fifo | <signame> |
Definition at line 295 of file XrdSysLogger.cc.
References XrdSysUtils::GetSigNum(), and onFifo.
Referenced by XrdConfig::Configure(), and XrdFrmConfig::Configure().
void XrdSysLogger::Put | ( | int | iovcnt, |
struct iovec * | iov | ||
) |
Output data and optionally prefix with date/time
iovcnt | The number of elements in iov vector. |
iov | The vector describing what to print. If iov[0].iov_base is zero, the message is prefixed by date and time. |
Definition at line 330 of file XrdSysLogger.cc.
References XrdSysLogging::Forward(), XrdSysMutex::Lock(), XrdSysThread::Num(), XrdSysMutex::UnLock(), and writev().
Referenced by XrdSysError::Emsg(), XrdSsiLogger::Msgv(), XrdSysTrace::operator<<(), and XrdSysError::Say().
|
inlinestatic |
Set call-out to logging plug-in on or off.
Definition at line 190 of file XrdSysLogger.hh.
Referenced by XrdSysLogging::Configure().
|
inline |
Set log file timstamp to high resolution (hh:mm:ss.uuuu).
Definition at line 196 of file XrdSysLogger.hh.
Referenced by XrdFrmConfig::Configure(), and XrdSysLogging::Configure().
|
inline |
Set log file keep value.
knum | The keep value. If knum < 0 then abs(knum) files are kept. Otherwise, only knum bytes of log files are kept. |
Definition at line 205 of file XrdSysLogger.hh.
|
inline |
Set log file rotation on/off.
onoff | When !0 turns on log file rotations. Otherwise, rotation is turned off. |
Definition at line 214 of file XrdSysLogger.hh.
|
inline |
Start trace message serialization. This method must be followed by a call to traceEnd().
Definition at line 223 of file XrdSysLogger.hh.
References XrdSysMutex::Lock().
Referenced by XrdSsiLogger::TBeg(), and XrdSysError::TBeg().
|
inline |
Stop trace message serialization. This method must be preceeded by a call to traceBeg().
Definition at line 232 of file XrdSysLogger.hh.
References XrdSysMutex::UnLock().
Referenced by XrdSsiLogger::TEnd(), and XrdSysError::TEnd().
|
inline |
Get the log file routing.
Definition at line 240 of file XrdSysLogger.hh.
void XrdSysLogger::zHandler | ( | ) |
Internal method to handle the logfile. This is public because it needs to be called by an external thread.
Definition at line 806 of file XrdSysLogger.cc.
References BLAB, XrdSysMutex::Lock(), XrdSysThread::Run(), XrdSysMutex::UnLock(), XrdSysTimer::Wait4Midnight(), XrdSysE2T(), and XrdSysLoggerMN().
Referenced by XrdSysLoggerRT().
|
static |
Bind allows you to bind the file descriptor passed at construction time to a file with an optional periodic closing and opening of the file.
path | The log file path. The file is created, if need be. If path is null, messages are routed to stderr and the lfh argument is ignored. |
lfh | Log file handling: >0 file is to be closed and opened at midnight. This implies automatic log rotation. =0 file is to be left open all the time. This implies no log rotation. <0 file is to be closed and opened only on signal abs(lfh) unless the value equals onFifo. In this case a fifo is used to control log file rotation. The name of the fifo is path with the filename component prefixed by dot. This implies manual log rotation. Warning! Using signals requires that Bind() be called before starting any threads so that the signal is properly blocked. |
Definition at line 134 of file XrdSysLogger.hh.
Referenced by Bind(), and ParseKeep().