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

Re: FTP Messages



Very cool...I'll use that. Thanks!

On 2/6/07, Scott Klement <sk@xxxxxxxxxxxxxxxx> wrote:
> Hello,
>
> > How can I redirect the information that goes to the job log? I want to
> > create a file of completion/error messages that I can query.
>
> You can register your own logging routine as an "exit procedure" to
> FTPAPI.  Every time FTPAPI tries to write a debug message, it'll call your
> routine instead of writing it to the job log.  It'll be up to you to
> supply code that writes it to a file (or whatever you want to do with it.)
>
> For example:
>
>          sess = FTP_open('ftp.example.com');
>          // check error
>          FTP_exitProc(sess: FTP_EXTLOG: %paddr(MyLogger): *null);
>          FTP_logging(*ON);
>
>          if (FTP_login(sess: 'UserID': 'Password') = -1);
>            // handle error
>          endif;
>
>          // other FTP commands here
>
>          FTP_quit(sess);
>
> The call to FTP_exitProc() tells FTPAPI to log messages by calling the
> MyLogger() subprocedure (which you'll write) rather than using it's own
> internal routine that writes to the job log.
>
> The logging procedure will be a subprocedure that YOU MUST WRITE and
> should be in the same program with the preceding FTP commands.  It must
> have a PR/PI like the following.
>
>        D MyLogger        PI
>        D   Msg                        256A   Const
>        D   extra                         *   value
>
> This procedure will be called repeatedly by FTPAPI.  It'll be called each
> time a log message is to be written.  The message that's normally in the
> job log will be in the "msg" parameter.  It's up to you to write code to
> save it to a PF or whatever you want to do with it.
>
> The 2nd parameter ("extra") is the same pointer you pass in the 4th
> parameter to FTP_exitProc().  In the preceding example, I passed *NULL, so
> it'll always get *NULL as the "extra" parameter.  It's useful if you want
> to pass some additional info to the procedure.  For example, if you have
> two FTP sessions running, and you want to pass a string to each one that
> identifies the individual session, you could use the "extra" parameter to
> pass it.
>
> IF my explanation of the "Extra" parameter doesn't make sense, don't sweat
> it.  The parameter can be safely ignored...
> -----------------------------------------------------------------------
> This is the FTPAPI mailing list.  To unsubscribe, please go to:
> http://www.scottklement.com/mailman/listinfo/ftpapi
> -----------------------------------------------------------------------
>
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------