I've found different ways to log something in Progress 4GL but none are satisfying:
The simple MESSAGE
statement has the drawback that it handles frames very badly:
ON CHOOSE OF btn-Q4
DO:
MESSAGE "Line 1".
MESSAGE "Line 2".
MESSAGE "Line 3".
PROMPT-FOR ...
WITH FRAME ...
...
MESSAGE "Alert message" VIEW-AS ALERT-BOX.
PROMPT-FOR ...
WITH FRAME ... /* (another frame) */
...
MESSAGE "Another alert message" VIEW-AS ALERT-BOX.
...
MESSAGE "Normal message".
END.
This starts by showing lines 1 and 2, there's a scrollbar for line 3, but this inaccessible due to the other dialogbox-like frames and once those are gone, the original messages lines are not there anymore.
Another possibility, already shown, is the MESSAGE ... VIEW-AS ALERT-BOX
. This works fine, and there even is the possibility for copy-paste, but all messages are shown in individual alert boxes, which makes it very difficult to handle.
A third possibility, mentioned on this site, is the usage of a log-manager, but I don't have a file, called *log*manager*
somewhere on my Progress 4GL installation, so I don't know how to use this.
Can anybody explain me how to do logging? What I would like is the following:
...
LOG("Line1").
...
LOG("Line2").
...
LOG("Line3").
...
The indentation stands for the location in the callstack ("Line3" is called by a function, while "Line2" is called by a subsubfunction, called by a subfunction, called by a function).
The idea is to see (in a copy-pastable format):
Ideally:
Line1
......Line2
..Line3
In case this is not possible, I settle for:
Line1
Line2
Line3
Does anbody know if this exists and how to realise it?
Thanks in advance
If you just want to log some simple messages, you can redirect output to a file. Use the OUTPUT TO
statement with some messages:
OUTPUT TO VALUE("logfile.txt").
PUT UNFORMATTED "Message 1" SKIP.
PUT UNFORMATTED "Message 2" SKIP.
PUT UNFORMATTED "Message 3" SKIP.
OUTPUT CLOSE.
This will create a "logfile.txt" file in your start-in folder. It will contain the following:
Message 1
Message 2
Message 3
The PUT UNFORMATTED
statement sends a string to the file. The SKIP
keyword adds a linefeed. The OUTPUT CLOSE
statement closes the file.
If you want to add onto an existing file, use APPEND
on the OUTPUT
statement:
OUTPUT TO VALUE("logfile.txt") APPEND.