Re: writing to a log reliably
- From: LesK <5mre20@xxxxxxxxxxxxxxx>
- Date: Wed, 17 Jun 2009 03:58:58 -0400
Mark,
There's no difference in the code below for Replace and Append! Surely a typo?
Les (Change Arabic to Roman to email me)
markh wrote:
On Jun 17, 8:59 am, AJ <ajNOwebSPAMo...@xxxxxxxxxx> wrote:.Hi,
I'm sure everyone must have a version of this ...
But how do I write to a log file reliably?
I have a simple procedure to append a line of text to a log file then
close the file. This works fine on my Linux test machine, but when I run
it on the main AIX server I find that only the first call to my log
procedure seems to produce anything.
The rest of the program works fine and any SAY statements I put in the
procedure display correctly, but nothing new is added to my log.
Any ideas?
This is using oorex 3.2 with classic code only.
Here's the test program
*Rexx */
Trace 'o'
/* log testing */
log_name='/home/alan/logtest.log'
call logit "Start of run"
Do k = 1 to 10
Call logit "Inside loop ==> " k
end
Exit
logit: procedure expose log_name
parse arg logline
logline2 = time("c") logline
rc = Lineout(log_name,logline2)
rc = Lineout(log_name)
say logline2
return
On linux I get 11 lines output to the log.
On AIX I just get the first line "Start of run"
That looks like a bug with ooRexx on AIX. I'd suggest you log a bug
report on the ooRexx SourceForge site:
https://sourceforge.net/tracker/?group_id=119701&atid=684730
To be more reliable anyway, you should specify how you want the log
file opened. Do you want to overwrite the contents of the existing
log file (if any), or append to it.
Before you write to the file, explicitly open it. And when you have
finished writing, close it.
To replace:
Call Stream log_name, 'C', 'OPEN WRITE REPLACE'
To append:
Call Stream log_name, 'C', 'OPEN WRITE REPLACE'
To close:
Call Stream log_name, 'C', 'CLOSE'
Cheers, Mark
- Follow-Ups:
- Re: writing to a log reliably
- From: markh
- Re: writing to a log reliably
- References:
- writing to a log reliably
- From: AJ
- Re: writing to a log reliably
- From: markh
- writing to a log reliably
- Prev by Date: Re: writing to a log reliably
- Next by Date: Re: writing to a log reliably
- Previous by thread: Re: writing to a log reliably
- Next by thread: Re: writing to a log reliably
- Index(es):
Relevant Pages
|
Loading