#include <XrdSysLogger.hh>
|
static void | setForwarding (bool onoff) |
| Set call-out to logging plug-in on or off.
|
|
|
static const int | onFifo = (int)0x80000000 |
|
|
static int | TimeStamp (struct timeval &tVal, unsigned long tID, char *tbuff, int tbsz, bool hires) |
|
◆ XrdSysLogger()
XrdSysLogger::XrdSysLogger |
( |
int |
ErrFD = STDERR_FILENO , |
|
|
int |
xrotate = 1 |
|
) |
| |
Constructor
- Parameters
-
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(). |
◆ ~XrdSysLogger()
XrdSysLogger::~XrdSysLogger |
( |
| ) |
|
|
inline |
◆ AddMsg()
void XrdSysLogger::AddMsg |
( |
const char * |
msg | ) |
|
Add a message to be printed at midnight.
- Parameters
-
msg | The message to be printed. A copy of the message is saved. |
◆ AtMidnight()
void XrdSysLogger::AtMidnight |
( |
Task * |
mnTask | ) |
|
◆ Bind()
int XrdSysLogger::Bind |
( |
const char * |
path, |
|
|
int |
lfh = 0 |
|
) |
| |
◆ Capture()
Capture allows you to capture all messages (they are not routed). This is a global setting so use with caution!
- Parameters
-
tFIFO | Pointer to the XrdOucTListFIFO where messages are saved. If the pointer is nil, capturing is turned off. |
◆ FifoMake()
int XrdSysLogger::FifoMake |
( |
| ) |
|
|
private |
◆ FifoWait()
void XrdSysLogger::FifoWait |
( |
| ) |
|
|
private |
◆ Flush()
void XrdSysLogger::Flush |
( |
| ) |
|
|
inline |
Flush any pending output.
References eFD, and fsync.
◆ HandleLogRotateLock()
int XrdSysLogger::HandleLogRotateLock |
( |
bool |
dorotate | ) |
|
|
private |
◆ originalFD()
int XrdSysLogger::originalFD |
( |
| ) |
|
|
inline |
Get the file descriptor passed at construction time.
- Returns
- the file descriptor passed to the constructor.
References baseFD.
◆ ParseKeep()
int XrdSysLogger::ParseKeep |
( |
const char * |
arg | ) |
|
Parse the keep option argument.
- Parameters
-
arg | Pointer to the argument. The argument syntax is: <count> | <size> | fifo | <signame> |
- Returns
- !0 Parsing succeeded. The return value is the argument that must be passed as the lfh parameter to Bind().
-
=0 Invalid keep argument.
◆ Put()
void XrdSysLogger::Put |
( |
int |
iovcnt, |
|
|
struct iovec * |
iov |
|
) |
| |
Output data and optionally prefix with date/time
- Parameters
-
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. |
◆ putEmsg()
void XrdSysLogger::putEmsg |
( |
char * |
msg, |
|
|
int |
msz |
|
) |
| |
|
private |
◆ ReBind()
int XrdSysLogger::ReBind |
( |
int |
dorename = 1 | ) |
|
|
private |
◆ RmLogRotateLock()
void XrdSysLogger::RmLogRotateLock |
( |
| ) |
|
|
private |
◆ setForwarding()
static void XrdSysLogger::setForwarding |
( |
bool |
onoff | ) |
|
|
inlinestatic |
Set call-out to logging plug-in on or off.
References doForward.
◆ setHiRes()
void XrdSysLogger::setHiRes |
( |
| ) |
|
|
inline |
Set log file timstamp to high resolution (hh:mm:ss.uuuu).
References hiRes.
◆ setKeep()
void XrdSysLogger::setKeep |
( |
long long |
knum | ) |
|
|
inline |
Set log file keep value.
- Parameters
-
knum | The keep value. If knum < 0 then abs(knum) files are kept. Otherwise, only knum bytes of log files are kept. |
References eKeep.
◆ setRotate()
void XrdSysLogger::setRotate |
( |
int |
onoff | ) |
|
|
inline |
Set log file rotation on/off.
- Parameters
-
onoff | When !0 turns on log file rotations. Otherwise, rotation is turned off. |
References doLFR.
◆ Time()
int XrdSysLogger::Time |
( |
char * |
tbuff | ) |
|
|
private |
◆ TimeStamp()
static int XrdSysLogger::TimeStamp |
( |
struct timeval & |
tVal, |
|
|
unsigned long |
tID, |
|
|
char * |
tbuff, |
|
|
int |
tbsz, |
|
|
bool |
hires |
|
) |
| |
|
staticprivate |
◆ traceBeg()
char * XrdSysLogger::traceBeg |
( |
| ) |
|
|
inline |
◆ traceEnd()
char XrdSysLogger::traceEnd |
( |
| ) |
|
|
inline |
◆ Trim()
void XrdSysLogger::Trim |
( |
| ) |
|
|
private |
◆ xlogFN()
const char * XrdSysLogger::xlogFN |
( |
| ) |
|
|
inline |
Get the log file routing.
- Returns
- the filename of the log file or "stderr".
References ePath.
◆ zHandler()
void XrdSysLogger::zHandler |
( |
| ) |
|
Internal method to handle the logfile. This is public because it needs to be called by an external thread.
◆ baseFD
◆ doForward
bool XrdSysLogger::doForward |
|
staticprivate |
◆ doLFR
◆ eFD
◆ eInt
◆ eKeep
long long XrdSysLogger::eKeep |
|
private |
◆ ePath
char* XrdSysLogger::ePath |
|
private |
◆ fifoFN
char* XrdSysLogger::fifoFN |
|
private |
◆ Filesfx
char XrdSysLogger::Filesfx[8] |
|
private |
◆ hiRes
◆ lfhTID
pthread_t XrdSysLogger::lfhTID |
|
private |
◆ Logger_Mutex
◆ msgList
mmMsg* XrdSysLogger::msgList |
|
private |
◆ onFifo
const int XrdSysLogger::onFifo = (int)0x80000000 |
|
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.
- Parameters
-
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. |
- Returns
- 0 Processing successful.
-
<0 Unable to bind, returned value is -errno of the reason.
◆ reserved1
int XrdSysLogger::reserved1 |
|
private |
◆ taskQ
Task* XrdSysLogger::taskQ |
|
private |
◆ TBuff
char XrdSysLogger::TBuff[32] |
|
private |
The documentation for this class was generated from the following file: