(imported topic written by RichB91)
For several reasons, I don’t like using the
appendfile
command to append lines to an existing log file.
-
The entire file gets copied twice instead of just appending a line to the original file. I see this as an inefficient drive and CPU utilization.
-
Especially for Fixlets or Tasks with longer than average running times, the chance that a non-BigFix process will write to the same log file between the time that the Task copies the original log file to the __appendfile and the time the Task copies the __appendfile back to the original log file is too high for my purposes.
-
If a Task was designed to write to the log once at the beginning, the middle and the end of the task, but fails between the middle and the end, none of the log entries get written. If the log file was appended in real time (as each line is added) then at least the log entires at the beginning and middles would still be recorded.
How can I append (actually append, not just use the appendfile command) a line of text to an existing file in real time?
I think this works for Windows:
waithidden cmd.exe /C echo {“MyCustomText”} >> {"C:\Log.txt ")}
What is the equivalent for Unix?
Are there any alternate options for Windows?
Is there a single option that will work for both operating systems without relying on the appendfile command?