D
Data Cruncher
My process writes to the log file. I want to periodically flush it so
that tail -f on the the log file shows the progress on a regular
basis.
This is what I do to write in the log file:-
open(LOGFILE,"> file name") or die ...
print LOGFILE "aaaaa\n" ;
this print is done during the life of the process.
What is happening is that until the process terminates
the log file can not be viewed by tail -f because perl is
still buffering the output to the log file.
and then finally
close(LOGFILE);
How do I flush it. There is no command like flush(LOGFILE).
What I have done is a crude approach of closing the log file
and then reopening it with '>>filename'. As it happens only
once a minute, it is not that expensive. But I am not happy
with this approach. It is not an elegant approach.
TIA.
that tail -f on the the log file shows the progress on a regular
basis.
This is what I do to write in the log file:-
open(LOGFILE,"> file name") or die ...
print LOGFILE "aaaaa\n" ;
this print is done during the life of the process.
What is happening is that until the process terminates
the log file can not be viewed by tail -f because perl is
still buffering the output to the log file.
and then finally
close(LOGFILE);
How do I flush it. There is no command like flush(LOGFILE).
What I have done is a crude approach of closing the log file
and then reopening it with '>>filename'. As it happens only
once a minute, it is not that expensive. But I am not happy
with this approach. It is not an elegant approach.
TIA.