Skip to content

Commit

Permalink
HPCC-31755 Soapcall LOG multi-line separator
Browse files Browse the repository at this point in the history
Signed-off-by: M Kelly <[email protected]>
  • Loading branch information
mckellyln committed Sep 24, 2024
1 parent ce9b821 commit 608dee7
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 6 deletions.
32 changes: 26 additions & 6 deletions common/thorhelper/thorsoapcall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ using roxiemem::OwnedRoxieString;
#define CONNECTION "Connection"

unsigned soapTraceLevel = 1;
StringBuffer soapSepString("");

#define WSCBUFFERSIZE 0x10000
#define MAXWSCTHREADS 50 //Max Web Service Call Threads
Expand Down Expand Up @@ -1951,10 +1952,19 @@ class CWSCAsyncFor : implements IWSCAsyncFor, public CInterface, public CAsyncFo
{
if (soapTraceLevel > 6 || master->logXML)
{
if (!contentEncoded)
master->logctx.mCTXLOG("%s: request(%s)", master->wscCallTypeText(), request.str());
StringBuffer contentStr("");
if (contentEncoded)
contentStr.append(", content encoded.");
if ( (master->logXML) && (soapSepString.length() > 0) )
{
StringBuffer request2(request);
request2.replaceString("\r\n", soapSepString.str());
request2.replaceString("\r", soapSepString.str());
request2.replaceString("\n", soapSepString.str());
master->logctx.mCTXLOG("%s: request(%s)%s", master->wscCallTypeText(), request2.str(), contentStr.str());
}
else
master->logctx.mCTXLOG("%s: request(%s), content encoded.", master->wscCallTypeText(), request.str());
master->logctx.mCTXLOG("%s: request(%s)%s", master->wscCallTypeText(), request.str(), contentStr.str());
}
}

Expand Down Expand Up @@ -2250,9 +2260,19 @@ class CWSCAsyncFor : implements IWSCAsyncFor, public CInterface, public CAsyncFo
if (checkContentDecoding(dbgheader, response, contentEncoding))
decodeContent(contentEncoding.str(), response);
if (soapTraceLevel > 6 || master->logXML)
master->logctx.mCTXLOG("%s: LEN=%d %sresponse(%s%s)", getWsCallTypeName(master->wscType),response.length(),chunked?"CHUNKED ":"", dbgheader.str(), response.str());
else if (soapTraceLevel > 8)
master->logctx.mCTXLOG("%s: LEN=%d %sresponse(%s)", getWsCallTypeName(master->wscType),response.length(),chunked?"CHUNKED ":"", response.str()); // not sure this is that useful but...
{
if ( (master->logXML) && (soapSepString.length() > 0) )
{
StringBuffer response2(dbgheader);
response2.append(response);
response2.replaceString("\r\n", soapSepString.str());
response2.replaceString("\r", soapSepString.str());
response2.replaceString("\n", soapSepString.str());
master->logctx.mCTXLOG("%s: LEN=%d %sresponse(%s)", getWsCallTypeName(master->wscType),response.length(),chunked?"CHUNKED ":"", response2.str());
}
else
master->logctx.mCTXLOG("%s: LEN=%d %sresponse(%s%s)", getWsCallTypeName(master->wscType),response.length(),chunked?"CHUNKED ":"", dbgheader.str(), response.str());
}
return rval;
}

Expand Down
1 change: 1 addition & 0 deletions common/thorhelper/thorsoapcall.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,6 @@ interface IRoxieAbortMonitor
extern THORHELPER_API unsigned soapTraceLevel;
extern THORHELPER_API IWSCHelper * createSoapCallHelper(IWSCRowProvider *, IEngineRowAllocator * outputAllocator, const char *authToken, SoapCallMode scMode, ClientCertificate *clientCert, const IContextLogger &logctx, IRoxieAbortMonitor * roxieAbortMonitor);
extern THORHELPER_API IWSCHelper * createHttpCallHelper(IWSCRowProvider *, IEngineRowAllocator * outputAllocator, const char *authToken, SoapCallMode scMode, ClientCertificate *clientCert, const IContextLogger &logctx, IRoxieAbortMonitor * roxieAbortMonitor);
extern THORHELPER_API StringBuffer soapSepString;

#endif /* __THORSOAPCALL_HPP_ */
5 changes: 5 additions & 0 deletions ecl/hthor/hthor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7738,6 +7738,11 @@ void CHThorWSCBaseActivity::init()
JBASE64_Encode(uidpair.str(), uidpair.length(), authToken, false);
}
soapTraceLevel = agent.queryWorkUnit()->getDebugValueInt("soapTraceLevel", 1);
StringBuffer soapSepStr;
StringBufferAdaptor soapSepAdaptor(soapSepStr);
agent.queryWorkUnit()->getDebugValue("soapLogSepString", soapSepAdaptor);
if (!soapSepStr.isEmpty())
soapSepString.clear().append(soapSepStr);
}

//---------------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions roxie/ccd/ccdmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,8 @@ int CCD_API roxie_main(int argc, const char *argv[], const char * defaultYaml)
udpTraceLevel = topology->getPropInt("@udpTraceLevel", runOnce ? 0 : 1);
roxiemem::setMemTraceLevel(topology->getPropInt("@memTraceLevel", runOnce ? 0 : 1));
soapTraceLevel = topology->getPropInt("@soapTraceLevel", runOnce ? 0 : 1);
if (topology->hasProp("@soapLogSepString"))
topology->getProp("@soapLogSepString", soapSepString);
miscDebugTraceLevel = topology->getPropInt("@miscDebugTraceLevel", 0);
traceRemoteFiles = topology->getPropBool("@traceRemoteFiles", false);
testAgentFailure = topology->getPropInt("expert/@testAgentFailure", testAgentFailure);
Expand Down
5 changes: 5 additions & 0 deletions roxie/ccd/ccdstate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2925,6 +2925,11 @@ class CRoxiePackageSetManager : implements IRoxieQueryPackageManagerSet, impleme
soapTraceLevel = control->getPropInt("@level", 0);
topology->setPropInt("@soapTraceLevel", soapTraceLevel);
}
else if (stricmp(queryName, "control:soapLogSepString")==0)
{
if (control->hasProp("@string"))
control->getProp("@string", soapSepString);
}
else if (stricmp(queryName, "control:socketCheckInterval")==0)
{
socketCheckInterval = (unsigned) control->getPropInt64("@val", 0);
Expand Down
1 change: 1 addition & 0 deletions thorlcr/graph/thgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2750,6 +2750,7 @@ void CJobBase::init()
failOnLeaks = getOptBool(THOROPT_FAIL_ON_LEAKS);
maxLfnBlockTimeMins = getOptInt(THOROPT_MAXLFN_BLOCKTIME_MINS, DEFAULT_MAXLFN_BLOCKTIME_MINS);
soapTraceLevel = getOptInt(THOROPT_SOAP_TRACE_LEVEL, 1);
getOpt(THOROPT_SOAP_LOG_SEP_STRING, soapSepString);

StringBuffer tracing("maxActivityCores = ");
if (maxActivityCores)
Expand Down
1 change: 1 addition & 0 deletions thorlcr/thorutil/thormisc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
#define THOROPT_MEMORY_SPILL_AT "memorySpillAt" // The threshold (%) that roxiemem will request memory to be reduced (default=80)
#define THOROPT_FAIL_ON_LEAKS "failOnLeaks" // If any leaks are detected at the end of graph, fail the query (default=false)
#define THOROPT_SOAP_TRACE_LEVEL "soapTraceLevel" // The trace SOAP level (default=1)
#define THOROPT_SOAP_LOG_SEP_STRING "soapLogSepString" // The SOAP request/response separator string for logging (default="")
#define THOROPT_SORT_ALGORITHM "sortAlgorithm" // The algorithm used to sort records (quicksort/mergesort)
#define THOROPT_COMPRESS_ALLFILES "v9_4_compressAllOutputs" // Compress all output files (default: bare-metal=off, cloud=on)
#define THOROPT_AVOID_RENAME "avoidRename" // Avoid rename, write directly to target physical filenames (no temp file)
Expand Down

0 comments on commit 608dee7

Please sign in to comment.