Web Connection
Extended Logging
Gravatar is a globally recognized avatar based on your email address. Extended Logging
  Paul Nesci
  All
  Jun 18, 2020 @ 07:52am

Hi Rick and rest Long time since I have posted - anyway licensed version 7.08.1 seems to be very querky with extended logging? I went through most of the architecture as the DOCS said it was possible to save requests & responses but no hint as to how to turn it on... Use wconnect.h #DEFINE WWC_EXTENDED_LOGGING_FORMAT .T.

Anyway it does not seem to save responses. Has this been enhanced since my version? Also the "browse log" just make 3 fields available it would be good to see more like request(M) and result(M). Thanks Paul

Gravatar is a globally recognized avatar based on your email address. re: Extended Logging
  Rick Strahl
  Paul Nesci
  Jun 18, 2020 @ 01:19pm

There's no support for output logging, but you can add your own. Output logging would produce way too much output to log. No realistic system logging solution I know of provides output logging.

If you really want to log output override you can override YourServer::SaveRequestFiles. The base method has code that extracts the request and response data and you can basically do something similar directly:

*** NOTE: Must have `SaveRequestFiles` flag enabled in app.ini
FUNCTION SaveRequestFiles
LOCAL lcOutput, lcRequest
*** call existing SaveRequestFiles functionality
* DODEFAULT()

lcOutput = ""
IF THIS.lcomobject
   lcOutput = this.cOutput
ELSE
   IF FILE(THIS.oRequest.cOutputFile)
      lcOutput = File2Var(THIS.oRequest.cOutputFile)
   ENDIF
ENDIF

lcRequest =  THIS.oRequest.cServerVars
IF LEN(this.oRequest.cFormVars) > 1
	lcRequest = lcRequest + POST_BOUNDARY + ;
                THIS.oRequest.cFormVars
ENDIF

LogString( CHR(13) + "--- Request ---" + CHR(13) + lcRequest + CHR(13) +;
	 "--- Response ---" + CHR(13) + ;
	 lcOutput + CHR(13) + ;
	 "--- End Request ---" + CHR(13),;
	 "temp\SaveRequestFiles.log")

ENDFUNC

This will capture the raw request and raw response in a log file.

You will not want to do this in a production system because it'll be slow - the writing and the sequential access to the file to write the log entries, but it'll get you what you want.

You will also want to clean up this file frequently as it will get very large, very quickly...

It's a great Foot Gun, so use with caution...

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Extended Logging
  Paul Nesci
  Rick Strahl
  Jun 18, 2020 @ 03:45pm

Excellent, thank you as thought I was going crazy. Great products, great support as always...

Gravatar is a globally recognized avatar based on your email address. re: Extended Logging
  Rick Strahl
  Paul Nesci
  Jun 18, 2020 @ 04:46pm

Gave this some thought and made a few small changes in Web Connection to accommodate this better:

  • Change Logging Settings to a Config Setting nLogFormat
  • Modes: 1 - normal, 2 - extended, 3 - extended plus Response
  • Also added Server variables which now show in 2 and 3 modes

In mode 3 you now get:

This allows for making a configuration change, rather than having to recompile as before that single extended logging format was a compiler switch. This gives more control over the process and while I still think this is not a good idea it's easier to set up and manage. Note that this does have some overhead.

One upshot is that for request capture we can now see more than one request in Display Last Request. Haven't hooked that up yet, but will do so. This should be useful when debugging more interactively.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Extended Logging
  Paul Nesci
  Rick Strahl
  Jun 22, 2020 @ 12:14am

Hi Rick this is excellent! Yes the Compile time switch got me as well.

Absolutely agree extended logging is really a super-Debug as would not use this in LIVE unless sniffing out errors. In this case trying convince the external service providers it was their issue was impossible unless I had the inputs/outputs...

Let me know when the bits might be ready or I guess could be in the next update 😃 Thanks Paul

Gravatar is a globally recognized avatar based on your email address. re: Extended Logging
  Rick Strahl
  Paul Nesci
  Jun 22, 2020 @ 11:46am

It'll be in the next update which shouldn't be too far off... another rollup release of small fixes and changes.

+++ Rick ---

© 1996-2024