Kbase P126526: How to redirect the standard streams of an application running in batchmode?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  5/8/2009 |
|
Status: Verified
GOAL:
How to redirect the standard streams of an application running in batchmode?
GOAL:
How to redirect stdout and sterr of an application running in batchmode?
GOAL:
How to redirect standard output and standard error of an application running in batchmode?
FACT(s) (Environment):
Progress 9.x
OpenEdge 10.x
DOS
Windows
FIX:
When starting the application in batch mode use the > redirection operator to write the command output to a file or a device instead of the Command Prompt window, or use the >> redirection operator to append the command output to the end of a file without deleting the information that is already in the file. In order to redirect stderr to a file or a device, use the 2> redirection operator.
Example:
mbpro -p test1.p > stdout.txt 2> stderr.txt
File contention issues will be encountered when redirecting stdout or stderr of multiple applications running in batchmode in Windows to the same file. Some available options for allowing multiple batch processes to send standard out or standard error to same file are:
1. Modify the applications to write their outputs to a database table and create another application to regularly read from that output table and append the entries to the same file. Some drawbacks to this option are if the output exceeds the character limit of the table field, or the database goes down, the output will not be captured.
2. Modify the application to send output messages directly to a SonicMQ broker or to another procedure that will handle sending the output messages to the SonicMQ broker. This is the best solution. There will be more flexibility with message size, the option to set the messages as persistent so that no output from the batch applications will be lost, message priority options, etc. A client application can then be created to read the messages off the broker queue and append their contents to a file.