[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: http_debug append



Thanks, Scott, I'll look through that next week to see if it meets my needs or if I should go another route.  The debug file is obviously a convenient way to have everything I might need, though for the production environment it is overkill.  I actually have a data area that enables/disables debug logging, so I can turn it off/on without changing the program.  The idea was to only turn it on when there was a problem, but I'm dealing with an outside vendor providing the web service and times when nobody knows what really happened.  That was compounded by the first file being overwritten, so I lost that history of what occurred.

I have many options on logging and don't see any major hurdles in implementing them.  Modifying HTTPAPI to allow append should be pretty easy too, but then I'd have to modify it after any upgrade or make the code good enough for you to include.  I'm pretty sure you understood that as my logic for not wanting to make that modification.

I'm glad the hard part this time is figuring out exactly what I want.  The rest should be easy.
--
Sean Porterfield
________________________________________
From: Scott Klement
Sent: Friday, October 25, 2013 18:02

Hi Sean,

I did not intend for people to use the debug/trace files in a production
environment... these were intended, really, as a way to provide the
details I need when people have problems.  Before adding the debug/trace
file tools, people would send me messages saying stuff like "I got a 500
error" or "The program froze", and I have absolutely no way to know what
the problem was -- with the debug file, they can send me this and I'll
have everything I need to know about the HTTP conversation.

It was not intended to be used in production, however.   After you've
worked the bugs out of your program, I would expect you to simply use
http_msg() to get an error message.   (Maybe I'm wrong about that, but
was what I was thinking.)

Therefore, the need to append an existing debug file never occurred to
me.  My thinking was that you would, essentially, want a new debug file
for each time you ran HTTPAPI.


One way to work around this is to use a debug exit proc.  With this, you
wouldn't use HTTPAPI's routines for writing to the IFS, instead you'd
register a subprocedure that HTTPAPI could call any time it wanted to
write a debug message.  You could then write your own code to put the
data into a file.  You could therefore have complete control over how it
writes the messages, when it clears the files, etc, without having to
make any change to HTTPAPI itself.

To do this, you would call

      http_xproc( HTTP_POINT_DEBUG: %paddr(YourProcName));

And your subprocedure would look like this:

*P YourProcName    B **
**D                 PI **
**D   data                          *   value**
**D   Length                      10i 0 value**
** /free **
**    // logic to write log goes here. **
** /end-free **
**P                 E

Instead of going to an IFS file, all debugging messages would then be
passed to that procedure (it's called automatically for each debug
message, so will be called repeatedly during the transaction.)  You can
write any logic you want to control which file it goes to, and any logic
you want to determine when to re-use vs. replace any file.

*

On 10/25/2013 3:53 PM, Porterfield, Sean wrote:
> Is there currently a mechanism to append to the debug log instead of overwriting it every time?
>
> I've been using multiple files to be able to get more detail, but that increases my maintenance and still has overwrite problems when I hit the same file name multiple times.
>
> I was just about to try enabling debug once and leaving it on, but I realized that won't work in my program.  I have a <shudder> subfile of orders that are being processed, and I want one debug file for each order that is selected.  It's perfectly normal to go back and select the same order again or later for another action, so my current ideas don't leave me a good solution.
>
> I'm calling something like:
> BasicHttp_IWorkOrderService_setHttpDebug( *ON: '/tmp/myordernum.txt');
>
> As I trace through, it seems to get back to http_debug( *ON:'/tmp/myordernum.txt'); which has
> callp     unlink(HTTP_DEBUG_FILE)
>
> I think that explains the current overwrite.
>
> I could theoretically modify HTTPAPI to prevent that, but it's not exactly at the top of my list of things that would be good to do.
>
> My environment:
> OS 7.1 TR 5
> WSDL2RPG Ver 1.13.2 released 2011-07-15
> HTTPAPI Ver 1.24beta11 released 2010-09-09
> --
> Sean Porterfield

This email is confidential, intended only for the named recipient(s) above and may contain information that is privileged.  If you have received this message in error or are not the named recipient(s), please notify the sender immediately and delete this email message from your computer as any and all unauthorized distribution or use of this message is strictly prohibited.  Thank you.
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------