#include <XrdSysLogging.hh>
Definition at line 47 of file XrdSysLogging.hh.
◆ XrdSysLogging()
XrdSysLogging::XrdSysLogging |
( |
| ) |
|
|
inline |
◆ ~XrdSysLogging()
XrdSysLogging::~XrdSysLogging |
( |
| ) |
|
|
inline |
◆ Configure()
Configure the logger object using the parameters above.
- Parameters
-
logr | Reference to the logger object. |
parms | Reference to the parameters. |
- Returns
- true if successful and false if log could not be configured.
Definition at line 72 of file XrdSysLogging.cc.
84 {
if (strcmp(parms.logfn,
"-") && (rc=logr.
Bind(parms.logfn,parms.keepV)))
85 {sprintf(eBuff,
"Error %d (%s) binding to log file %s.\n",
87 return EMsg(logr, eBuff);
94 if (!parms.logpi) {lclOut =
true;
return true;}
95 piLogger= parms.logpi;
109 int bsz = (parms.bufsz < 0 ? 65536 : parms.bufsz);
110 rc = posix_memalign((
void **)&buffOrg, getpagesize(), bsz);
111 if (rc != 0 || !buffOrg)
return EMsg(logr,
"Unable to allocate log buffer!\n");
113 buffBeg = buffOrg + buffOvhd;
114 buffEnd = buffOrg + bsz;
119 {sprintf(eBuff,
"Error %d (%s) starting LogPI handler.\n",
121 return EMsg(logr, eBuff);
const char * XrdSysE2T(int errcode)
void setHiRes()
Set log file timstamp to high resolution (hh:mm:ss.uuuu).
static void setForwarding(bool onoff)
Set call-out to logging plug-in on or off.
int Bind(const char *path, int lfh=0)
static int Run(pthread_t *, void *(*proc)(void *), void *arg, int opts=0, const char *desc=0)
References XrdSysLogger::Bind(), XrdSysLogging::Parms::bufsz, XrdSysLogging::Parms::hiRes, XrdSysLogging::Parms::keepV, XrdSysLogging::Parms::logfn, XrdSysLogging::Parms::logpi, XrdSysThread::Run(), XrdSysLogger::setForwarding(), XrdSysLogger::setHiRes(), and XrdSysE2T().
Referenced by XrdOucLogging::configLog().
◆ Forward()
bool XrdSysLogging::Forward |
( |
struct timeval |
mtime, |
|
|
unsigned long |
tID, |
|
|
struct iovec * |
iov, |
|
|
int |
iovcnt |
|
) |
| |
|
static |
Forward a log message to a plugin.
- Parameters
-
mtime | The time the message was generated. |
tID | The thread ID that issued the message. |
iov | The vector describing what to forward. |
iovcnt | The number of elements in iov vector. |
- Returns
- false if the message needs to also be placed in a local log file. true if all processing has completed.
Definition at line 172 of file XrdSysLogging.cc.
176 char *fence, *freeMsg, *msgText;
177 int dwords, msgLen = 0;
182 for (
int i = 0; i < iovcnt; i++) msgLen +=
iov[i].iov_len;
187 {
char *mbP, mbuff[syncBSZ];
188 if (msgLen >= syncBSZ) msgLen = CopyTrunc(mbuff,
iov, iovcnt);
190 for (
int i = 0; i < iovcnt; i++)
191 {memcpy(mbP,
iov[i].iov_base,
iov[i].iov_len);
192 mbP +=
iov[i].iov_len;
196 (*piLogger)(mtime, tID, mbuff, msgLen);
206 if (msgLen > maxMsgLen)
217 dwords = msgLen+8 +
sizeof(MsgBuff);
218 if (numLost) dwords +=
sizeof(MsgBuff);
228 {freeMsg = lastMsg + ((MsgBuff *)lastMsg)->buffsz*8;
229 fence = (lastMsg >= pendMsg ? buffEnd : pendMsg);
240 if ((freeMsg + (dwords*8)) > fence)
251 {theMsg = (MsgBuff *)freeMsg;
252 theMsg->msgtod = mtime;
254 theMsg->buffsz = mbDwords;
255 theMsg->msglen = -numLost;
256 if (lastMsg) ((MsgBuff *)lastMsg)->next = freeMsg - buffOrg;
263 theMsg = (MsgBuff *)freeMsg;
264 theMsg->msgtod = mtime;
267 theMsg->buffsz = dwords;
268 theMsg->msglen = msgLen;
269 if (lastMsg) ((MsgBuff *)lastMsg)->next = freeMsg - buffOrg;
274 msgText = freeMsg + msgOff;
275 for (
int i = 0; i < iovcnt; i++)
276 {memcpy(msgText,
iov[i].iov_base,
iov[i].iov_len);
277 msgText +=
iov[i].iov_len;
286 if (doPost) pendMsg = freeMsg;
288 if (doPost) msgAlert.Post();
Referenced by XrdSysLogger::Put().
The documentation for this class was generated from the following files: