Merge pull request #1394 from rgerhards/q-debug

core: add additional debug output
This commit is contained in:
Rainer Gerhards 2017-02-10 08:54:31 +01:00 committed by GitHub
commit ed5d4aed7a
5 changed files with 20 additions and 5 deletions

View File

@ -6,7 +6,7 @@
*
* File begun on 2007-12-20 by RGerhards (extracted from syslogd.c)
*
* Copyright 2007-2016 Rainer Gerhards and Adiscon GmbH.
* Copyright 2007-2017 Rainer Gerhards and Adiscon GmbH.
*
* This file is part of rsyslog.
*
@ -1054,7 +1054,7 @@ static rsRetVal readSocket(lstn_t *pLstn)
#endif
iRcvd = recvmsg(pLstn->fd, &msgh, MSG_DONTWAIT);
DBGPRINTF("Message from UNIX socket: #%d\n", pLstn->fd);
DBGPRINTF("Message from UNIX socket: #%d, size %d\n", pLstn->fd, (int) iRcvd);
if(iRcvd > 0) {
cred = NULL;
ts = NULL;

View File

@ -1407,6 +1407,9 @@ MsgDeserialize(smsg_t * const pMsg, strm_t *pStrm)
finalize_it:
if(pVar != NULL)
var.Destruct(&pVar);
if(Debug && iRet != RS_RET_OK) {
dbgprintf("MsgDeserialize error %d\n", iRet);
}
RETiRet;
}
#undef isProp

View File

@ -720,6 +720,10 @@ static rsRetVal objDeserializeTrailer(strm_t *pStrm)
NEXTC; if(c != '\n') ABORT_FINALIZE(RS_RET_INVALID_TRAILER);
finalize_it:
if(Debug && iRet != RS_RET_OK) {
dbgprintf("objDeserializeTrailer fails with %d\n", iRet);
}
RETiRet;
}
@ -938,6 +942,12 @@ finalize_it:
if(pstrID != NULL)
rsCStrDestruct(&pstrID);
if(Debug && iRet != RS_RET_OK) {
dbgprintf("objDeserializeWithMethods fails with %d, stream state:\n", iRet);
strmDebugOutBuf(pStrm);
}
RETiRet;
}

View File

@ -987,6 +987,8 @@ static rsRetVal qDeqDisk(qqueue_t *pThis, smsg_t **ppMsg)
DEFiRet;
iRet = objDeserializeWithMethods(ppMsg, (uchar*) "msg", 3, pThis->tVars.disk.pReadDeq, NULL,
NULL, msgConstructForDeserializer, NULL, MsgDeserialize);
DBGOPRINT((obj_t*) pThis, "qDeqDisk error %d happened at around offset %lld\n",
iRet, (long long) pThis->tVars.disk.pReadDeq->iCurrOffs);
RETiRet;
}

View File

@ -660,9 +660,9 @@ strmDebugOutBuf(const strm_t *const pThis)
int strtIdx = pThis->iBufPtr - 50;
if(strtIdx < 0)
strtIdx = 0;
DBGOPRINT((obj_t*) pThis, "strmRead index %zd, max %zd, buf '%.*s'\n",
pThis->iBufPtr, pThis->iBufPtrMax, (int) pThis->iBufPtrMax - strtIdx,
pThis->pIOBuf+strtIdx);
DBGOPRINT((obj_t*) pThis, "strmRead ungetc %d, index %zd, max %zd, buf '%.*s', CURR: '%.*s'\n",
pThis->iUngetC, pThis->iBufPtr, pThis->iBufPtrMax, (int) pThis->iBufPtrMax - strtIdx,
pThis->pIOBuf+strtIdx, (int) (pThis->iBufPtrMax - pThis->iBufPtr), pThis->pIOBuf+pThis->iBufPtr);
}
/* logically "read" a character from a file. What actually happens is that