I'm doing a routine sending Protheus information to my system. To submit the information, I'm using the HttpPost
function and submit an update data package. Each request sends, just payload, something around 190KiB.
To send all the data I need, several submissions are required (about 2000 requests). I noticed that for each of these submissions the entire request (including method, URL, headers and payload) is being printed in the log file.
Can you avoid this writing in the log file? In the function documentation there is no information available on this, including it was a surprise to see this. I would not like to write more than 300 MiB in the log unnecessarily.
These logs mentioned above were found in the files console_KVP4XK_PRD_COMP_11001.log
and console_kvp4xk_prd_comp_11001.bak
. Below I have removed two excerpts that I believe are representative.
In the program that was running, I had the call of CONOUT
to simply display the result of the call HttpPost
, indicating the string returned by my service (or, if nothing returns, write " Result null "). I have now realized that the request is only printed in the case where my server returns success.
Below is the code for the function SENDJS
in a state very close to what was used in the second excerpt:
static function sendJs(cUrl, cPostPar, nTimeOut, aHeaderStr, aResponse)
Local cMsgHttp := "[XXXX] Resposta HttpPost: "
Local cResponse
Local cHeaderRet
If cPostPar <> "INATIVO"
cResponse := HttpPost( cUrl, "", cPostPar, nTimeOut, aHeaderStr, @cHeaderRet)
If cResponse == nil
cResponse := "Resultado nulo"
EndIf
conout(cMsgHttp + cResponse)
Else
cResponse := "INATIVO"
EndIf
aadd(aResponse, cResponse)
Return cResponse
No CONOUT
more.
An excerpt that I believe to be significant from the log:
POST /my/exemplo/end-point HTTP/1.1
Host: my.example.http.host:8080
HEADER_PVT: PVT_VALUE
Content-type: application/json
Content-Length: 195145
{"cliente":[{"cd_cliente":"YYYY","nm_cliente":"NOME NOME NOME","nm_fantasia":"NOME NOME NOME",...resto do payload
[XXXX] Resposta HttpPost: OK
[XXXX] Resposta HttpPost: Resultado nulo
[XXXX] Resposta HttpPost: Resultado nulo
[XXXX] Resposta HttpPost: Resultado nulo
[XXXX] Resposta HttpPost: Resultado nulo
[XXXX] Resposta HttpPost: Resultado nulo
[XXXX] Resposta HttpPost: Resultado nulo
[XXXX] Resposta HttpPost: Resultado nulo
POST /my/exemplo/end-point HTTP/1.1
Host: my.example.http.host:8080
HEADER_PVT: PVT_VALUE
Content-type: application/json
Content-Length: 194517
{"cliente":[{"cd_cliente":"ZZZZ","nm_cliente":"NOME NOME NOME","nm_fantasia":"NOME NOME NOME",...resto do payload
[XXXX] Resposta HttpPost: OK
[XXXX] Resposta HttpPost: Resultado nulo
[XXXX] Resposta HttpPost: Resultado nulo
[XXXX] Resposta HttpPost: Resultado nulo
/*-------------------------------------------------------
THREAD ERROR ([9540], ####, #####) 20/11/2018 11:44:00
Remote Connection BROKEN on RETFILENAME(APLIB070.PRW) 28/05/2018 10:29:39 line : 542
[build: 7.00.131227A-20180425]
[environment: KVP4XK_PRD_COMP]
[thread: 9540]
[dbthread: 4916]
[rpodb: Top]
[localfiles: CTREE]
[remark: |Emp :02/02020099 Logged : SIGAFAT Obj :WFPrepEnv]
[stack: 42448 bytes]
[memory: 28345912 bytes]
[peak memory: 28534528 bytes]
[threadtype: RmtSockThread]
Called from MSFILE(APLIB070.PRW) 28/05/2018 10:29:39 line : 173
Called from CHKFILE(APLIB200.PRW) 23/05/2017 15:25:06 line : 915
Called from XCHKFILE(APLIB240.PRW) 18/08/2017 17:44:03 line : 405
Called from RTERRHANDLER(APLIB240.PRW) 18/08/2017 17:44:03 line : 342
Called from { |E| RTERRHANDLER(E) } line : 1
Called from LINHAJSON(SGEOF001.PRW) 19/11/2018 18:12:45
Called from U_MAKEALLJSON(SGEOF001.PRW) 19/11/2018 18:12:45 line : 302
Called from U_ENVJSONAPLIC(SGEOF003.PRW) 19/11/2018 18:12:45 line : 74
Called from U_EXECATU(SGEOF004.PRW) 19/11/2018 18:12:45 line : 93
Called from U_SGEOJ001(SGEOJ001.PRW) 12/11/2018 11:06:43 line : 35
Stack :
Remote Connection BROKEN on RETFILENAME(APLIB070.PRW) 28/05/2018 10:29:39 line : 542
[build: 7.00.131227A-20180425]
[environment: KVP4XK_PRD_COMP]
[thread: 9540]
[dbthread: 4916]
[rpodb: Top]
[localfiles: CTREE]
[remark: |Emp :02/02020099 Logged : SIGAFAT Obj :WFPrepEnv]
[stack: 42448 bytes]
[memory: 28345912 bytes]
[peak memory: 28534528 bytes]
[threadtype: RmtSockThread]
Called from MSFILE(APLIB070.PRW) 28/05/2018 10:29:39 line : 173
Called from CHKFILE(APLIB200.PRW) 23/05/2017 15:25:06 line : 915
Called from XCHKFILE(APLIB240.PRW) 18/08/2017 17:44:03 line : 405
Called from RTERRHANDLER(APLIB240.PRW) 18/08/2017 17:44:03 line : 342
Called from { |E| RTERRHANDLER(E) } line : 1
Called from LINHAJSON(SGEOF001.PRW) 19/11/2018 18:12:45
Called from U_MAKEALLJSON(SGEOF001.PRW) 19/11/2018 18:12:45 line : 302
Called from U_ENVJSONAPLIC(SGEOF003.PRW) 19/11/2018 18:12:45 line : 74
Called from U_EXECATU(SGEOF004.PRW) 19/11/2018 18:12:45 line : 93
Called from U_SGEOJ001(SGEOJ001.PRW) 12/11/2018 11:06:43 line : 35
-------------------------------------------------------*/
[INFO ][SERVER] [Thread 9540] [20/11/2018 11:44:00] Thread finished (####, #####, 27.21 MB.)
[INFO ][SERVER] Cleaning 1 Global Variable Value(s).
[INFO ][SERVER] [Thread 9596] [21/11/2018 11:27:27] Starting Debugger (####, #####)
[INFO ][SERVER] [Thread 9596] [21/11/2018 11:27:32] Debugger finished (####, #####)
[INFO ][SERVER] [Thread 16636] [21/11/2018 11:27:41] Starting Debugger (####, #####)
[INFO ][SERVER] [Thread 16636] Env [KVP4XK_PRD_COMP] DBAccess Connection Pulse Interval set to [60] seconds.
The second excerpt, result with the call to SENDJS
previously described:
[INFO ][SERVER] [Thread 12172] Env [KVP4XK_PRD_COMP] DBAccess Connection Pulse Interval set to [60] seconds.
************************ (#####,####) ************************
[WARNING] RPO incomplete compilation. Some programs will not work.
Environment ... KVP4XK_PRD_COMP
RPO ........... \IPA.IPB.IPC.IPD\kvp4xk_pr_prd_apo\outsourcing\clientes\kvp4xk_prd\apo_comp_erp\tttp110.rpo
Source List ... M460FIM.PRW
[INFO ][SERVER] [21/11/2018 11:36:16] Starting Program U_SGEOJ001 Thread 12172 (####,#####)
*** Loading dbapi.dll
[21/11|11:36][WFPREPENV] Inicialização de ambiente
[21/11|11:36][WFPREPENV] Empresa: XX
[21/11|11:36][WFPREPENV] Filial: YYYYYY
[21/11|11:36][WFPREPENV] Função: WFPrepEnv
[XXXX] CONFIGURANDO AMBIENTE XX ZZZZZZ ------------
[XXXX] INICIO EXECUCAO JOB ENVIO XXXX 21/11/18 11:36:20 ------------
[XXXX] Resposta HttpPost: Resultado nulo
[XXXX] Resposta HttpPost: Resultado nulo
[XXXX] Resposta HttpPost: Resultado nulo
[XXXX] Resposta HttpPost: Resultado nulo
[XXXX] Resposta HttpPost: Resultado nulo
[XXXX] Resposta HttpPost: Resultado nulo
POST /my/exemplo/end-point HTTP/1.1
Host: my.example.http.host:8080
HEADER_PVT: PVT_VALUE
Content-type: application/json
Content-Length: 190598
{"cliente":[{"cd_cliente":"MMMM","nm_cliente":"NOME NOME NOME","nm_fantasia":"NOME NOME NOME",...resto do payload
[XXXX] Resposta HttpPost: OK
POST /my/exemplo/end-point HTTP/1.1
Host: my.example.http.host:8080
HEADER_PVT: PVT_VALUE
Content-type: application/json
Content-Length: 190457
{"cliente":[{"cd_cliente":"LLLL","nm_cliente":"NOME NOME NOME","nm_fantasia":"NOME NOME NOME",...resto do payload
[XXXX] Resposta HttpPost: OK
[XXXX] Resposta HttpPost: Resultado nulo
POST /my/exemplo/end-point HTTP/1.1
Host: my.example.http.host:8080
HEADER_PVT: PVT_VALUE
Content-type: application/json
Content-Length: 190424
{"cliente":[{"cd_cliente":"WWWW","nm_cliente":"NOME NOME NOME","nm_fantasia":"NOME NOME NOME",...resto do payload
[XXXX] Resposta HttpPost: OK
[XXXX] Resposta HttpPost: Resultado nulo
[INFO ][SERVER] [Thread 16304] [21/11/2018 11:40:16] Starting Monitor (####, #####)
[INFO ][SERVER] [Thread 16304] Env [KVP4XK_PRD_COMP] DBAccess Connection Pulse Interval set to [60] seconds.
POST /my/exemplo/end-point HTTP/1.1
Host: my.example.http.host:8080
HEADER_PVT: PVT_VALUE
Content-type: application/json
Content-Length: 190681
{"cliente":[{"cd_cliente":"KKKK","nm_cliente":"NOME NOME NOME","nm_fantasia":"NOME NOME NOME",...resto do payload
[XXXX] Resposta HttpPost: OK
[INFO ][SERVER] Send TERMINATE (IMMEDIATE) to Thread (12172) User [####] Computer [#####] Server []
/*-------------------------------------------------------
THREAD ERROR ([12172], ####, #####) 21/11/2018 11:40:25
Connection terminated by the administrator. on ESCENVST(SGEOF001.PRW) 21/11/2018 11:28:55 line : 147
[build: 7.00.131227A-20180425]
[environment: KVP4XK_PRD_COMP]
[thread: 12172]
[dbthread: 16076]
[rpodb: Top]
[localfiles: CTREE]
[remark: |Emp :02/02020099 Logged : SIGAFAT Obj :WFPrepEnv]
[stack: 31904 bytes]
[memory: 28475704 bytes]
[peak memory: 28469104 bytes]
[threadtype: RmtSockThread]
Called from LINHAJSON(SGEOF001.PRW) 21/11/2018 11:28:55 line : 147
Called from U_MAKEALLJSON(SGEOF001.PRW) 21/11/2018 11:28:55 line : 308
Called from U_ENVJSONAPLIC(SGEOF003.PRW) 19/11/2018 18:12:45 line : 74
Called from U_EXECATU(SGEOF004.PRW) 19/11/2018 18:12:45 line : 93
Called from U_SGEOJ001(SGEOJ001.PRW) 12/11/2018 11:06:43 line : 35
Variables in use
... diversas variáveis ...
STACK U_SGEOJ001(SGEOJ001.PRW) 12/11/2018 11:06:43
Private 1: LPROCESS(L) :.F.
Local 1: AAREA(A) :
Local 2: CCODEMP(C) :02
Local 3: CCODFIL(C) :02010001
STACK U_EXECATU(SGEOF004.PRW) 19/11/2018 18:12:45
Param 1: CEXEC(C) : J
Private 1: BEXECROT(L) :.T.
Local 1: CEXEC(C) :J
Local 2: CRESULT(C) :
Local 3: I(N) :1
Local 4: CTABELA(C) :
Local 5: ATABPRO(A) :
Local 6: ATABGEO(A) :
Local 7: NREGISTROS(N) :1
Local 8: NCNT(N) :1
Local 9: AREGISTROS(A) :
Local 10: CMSGYN(C) :MSG MSG MSG pergunta?
Esta Operação não poderá ser cancelada.
Local 11: CMSGEXEC(C) :
Local 12: CMSGERRO(C) :
Local 13: CMSGATU(C) :
Local 14: CTIC(C) :11:36:20
Local 15: CTAC(C) :
Local 16: CELAPSED(C) :
STACK U_ENVJSONAPLIC(SGEOF003.PRW) 19/11/2018 18:12:45
Param 1: CTABELA(C) : SA1
Param 2: COP(C) : T
Param 3: CTABGEO(C) : CLIENTE
Local 1: CTABELA(C) :SA1
Local 2: COP(C) :T
Local 3: CTABGEO(C) :CLIENTE
Local 4: CHOST(C) :my.example.http.host:8080/my/exemplo/end-point
Local 5: CPATH(C) :end-point
Local 6: CEMPHOST(C) :exemplo
Local 7: AHEADERSTR(A) :
Local 8: CURL(C) :my.example.http.host:8080/my/exemplo/end-point
Local 9: XPOSTPAR(C) :
Local 10: NTIMEOUT(N) :240
Local 11: CHEADERRET(C) :
Local 12: CRESPONSE(C) :
Local 13: ARESPONSE(A) :
Local 14: CMSGHTTP(C) :[XXXX] Resposta HttpPost:
STACK U_MAKEALLJSON(SGEOF001.PRW) 21/11/2018 11:28:55
Param 1: CTABELA(C) : SA1
Param 2: CTABGEO(C) : CLIENTE
Param 3: BTRATATIVAEVENTOS(B) : {|CJSONSTUFF|, SENDJS(CURL, CJSONSTUFF, NTIMEOUT, AHEADERSTR, ARESPONSE)}
Private 1: _CALIAS(C) :TABSQL
Private 2: _CTABELA(C) :SA1
Private 3: CCHAVE(C) : 000001
Local 1: CTABELA(C) :SA1
Local 2: CTABGEO(C) :CLIENTE
Local 3: BTRATATIVAEVENTOS(B) :{|CJSONSTUFF|, SENDJS(CURL, CJSONSTUFF, NTIMEOUT, AHEADERSTR, ARESPONSE)}
Local 4: CJSON(C) :{"cliente":[{"cd_cliente":"NNNN","nm_cliente":"NOME NOME NOME","nm_fantasia":"NOME NOME NOME",...resto do payload
Local 5: NCNT(N) :232
Local 6: NSIZE(N) :181259
Local 7: CCODTAB(C) :
Local 8: CTABPROTHEUS(C) :SA1
Local 9: CTABXXXX(C) :CLIENTE
Local 10: CSTATUS(C) :A
Local 11: CLINHA(C) :{"cliente":[{"cd_cliente":"PPPP","nm_cliente":"NOME NOME NOME","nm_fantasia":"NOME NOME NOME",...resto do payload
Local 12: CSQL(C) :SELECT SQL SQL SQL
Local 13: ACPO(A) :
Local 14: CVALOR(C) :
STACK LINHAJSON(SGEOF001.PRW) 21/11/2018 11:28:55
Param 1: CTABELA(C) : TABSQL
Param 2: CCHAVE(C) : 000001
Param 3: CVERIFICAEXCLUSAO(C) : (_cAlias)->DELETED == 'T'
Local 1: CTABELA(C) :TABSQL
Local 2: CCHAVE(C) : 000001
Local 3: CVERIFICAEXCLUSAO(C) :(_cAlias)->DELETED == 'T'
Local 4: CTIPO(C) :C
Local 5: XRESULT(C) :ENDRECO RUA LOGRADOURO
Local 6: CJSON(C) :{"cliente":[{"cd_cliente":"OOOO","nm_cliente":"NOME NOME NOME","nm_fantasia":"NOME NOME NOME",...resto do payload
STACK ESCENVST(SGEOF001.PRW) 21/11/2018 11:28:55
Param 1: CTEXT(C) : ENDERECO RUA LOGRADOURO
Local 1: CTEXT(C) :ENDERECO RUA LOGRADOURO
Local 2: CCLEAN(C) :
Local 3: NLEN(N) :28
Local 4: NFIM(U) :NIL
Local 5: NDELTA(U) :NIL
Local 6: I(N) :13
Local 7: NIDX(N) :1
Local 8: CCHAR(C) :R
Local 9: NCHARASC(N) :65
Files
... diversas linhas...
Stack :
Connection terminated by the administrator. on ESCENVST(SGEOF001.PRW) 21/11/2018 11:28:55 line : 147
[build: 7.00.131227A-20180425]
[environment: KVP4XK_PRD_COMP]
[thread: 12172]
[dbthread: 16076]
[rpodb: Top]
[localfiles: CTREE]
[remark: |Emp :02/02020099 Logged : SIGAFAT Obj :WFPrepEnv]
[stack: 31904 bytes]
[memory: 28475704 bytes]
[peak memory: 28469104 bytes]
[threadtype: RmtSockThread]
Called from LINHAJSON(SGEOF001.PRW) 21/11/2018 11:28:55 line : 147
Called from U_MAKEALLJSON(SGEOF001.PRW) 21/11/2018 11:28:55 line : 308
Called from U_ENVJSONAPLIC(SGEOF003.PRW) 19/11/2018 18:12:45 line : 74
Called from U_EXECATU(SGEOF004.PRW) 19/11/2018 18:12:45 line : 93
Called from U_SGEOJ001(SGEOJ001.PRW) 12/11/2018 11:06:43 line : 35
-------------------------------------------------------*/
[INFO ][SERVER] [Thread 12172] [21/11/2018 11:40:25] Thread finished (####, #####, 27.15 MB.)
[INFO ][SERVER] [Thread 16304] [21/11/2018 11:40:26] Monitor finished (####, #####)