Catch output in batchmode

Posted by sublam on 23-Sep-2015 06:02

Hello,

Ist there a way to catch the "output" that is piped out of the prowin32.exe (in batchmode( in the ABL Session?

At the moment i pipe the output to a textfile with an external exe but i would like to catch the messages in the ABL Session.

All Replies

Posted by Brian K. Maher on 23-Sep-2015 06:14
 
Hi Sublam,
 
I'm not sure if this is what you want, but you can catch all 4GL messages by using either client logging (startup parameters) or the LOG-MANAGER handle (in your code).
 
-clientlog some_log_file_name_goes_here -logginglevel 4 -logentrytypes 4GLMessages
 
LOG-MANAGER:LOGFILE-NAME = "some_log_file_name_goes_here".
LOG-MANAGER:LOGGING-LEVEL = 4.
LOG-MANAGER:LOG-ENTRY-TYPES = "4GLMessages".
... application code ...
LOG-MANAGER:CLOSE-LOG().  /* if you need to close the log file to look at its contents */
 
Brian
 
 
Posted by sublam on 23-Sep-2015 06:17

Hello Brian,

Sadly that is not what i want.

I want to "catch" the messages that are written by the prowin32.exe in batchmode through stdout (i guess) in the abl session.

Like a "global" catch for all messages.

Posted by Brian K. Maher on 23-Sep-2015 06:25
 
Hi Sublam,
 
Define "the messages".  What are these messages and what ABL statements create them?
 
Brian
 
Posted by sublam on 23-Sep-2015 06:33

Error Messages for example.

Afaik OE Pipes all Messages to the stdout (when batch mode is activated).

Long story short: I wand to get everything that the prowin32.exe pipes out when batch mode is activated.

Posted by Simon L. Prinsloo on 23-Sep-2015 06:39

You mean you want to redirect your own default output stream to your own default input stream?

Posted by Simon L. Prinsloo on 23-Sep-2015 06:41

If you are in an interactive session and you want to start a batch job and get its output, you can do this:

INPUT THROUGH prowin32 -b -p mybatch.p.

REPEAT:

 IMPORT UNFORMATTED cLine.

END.

INPUT CLOSE.

Posted by sublam on 23-Sep-2015 07:21

Thank you for you answer Simon,

Basically yes.

The reason behind it is that i want to store the (error) messages in my OE database for our custom monitoring system.

The answer you provided would work but i would really like to avoid doubling the number of running prowin32.exe processes on the server.

Posted by Brian K. Maher on 23-Sep-2015 07:27
Sublam,
 
I don't understand why capturing these Progress error messages using the LOG-MANAGER handle would not do what you want.  Yes, the resulting data would be in a file that you would have to process but no secondary process would be needed.  I think you need to give the LOG-MANAGER suggestion another look.
 
I wonder if, even though you say that you "want to store the (error) messages" you mean your own custom messages and not the Progress messages (i.e. the ones that have an error number in parentheses).
 
Brian
 
 
Posted by sublam on 23-Sep-2015 07:40

I mean the Progress Messages, i don't display any messages myself when in batchmode.

I know that i could write the Messages to a file (and currently that is what i do).

I was just wondering if there is a possibility to do this without a logfile.

Posted by Brian K. Maher on 23-Sep-2015 07:45
Sublam,
 
Sure there is.  Simply use NO-ERROR on every statement where it is an option, add a call to a routine that walks through error-status:num-messages and sends the messages to where ever you want them to go.  Is this clumsy and (from my perspective) painful?  Absolutely.  Using log-manager and processing the resulting file is cleaner.
 
Brian
Posted by sublam on 23-Sep-2015 07:47

I guess i have to keep my logfile :(

Posted by Brian K. Maher on 23-Sep-2015 07:50
Sublam,
 
Yes, it does sound like it.  Sorry there is no better answer.
 
Brian
This thread is closed